From d750a77ffeb6da5ecd61824f7a8653b0c0ba68e9 Mon Sep 17 00:00:00 2001 From: Benjamin Saller Date: Mon, 16 Jul 2007 16:05:45 +0000 Subject: limit/offset -- set limit to 4096 per backend for now --- diff --git a/src/olpc/datastore/backingstore.py b/src/olpc/datastore/backingstore.py index fd7ca2f..a7a51ca 100644 --- a/src/olpc/datastore/backingstore.py +++ b/src/olpc/datastore/backingstore.py @@ -378,10 +378,7 @@ class FileBackingStore(BackingStore): def find(self, query): - limit = query.pop('limit', 50) - offset = query.pop('offset', 0) - - return self.indexmanager.search(query, offset, limit) + return self.indexmanager.search(query) def stop(self): self.indexmanager.stop() diff --git a/src/olpc/datastore/datastore.py b/src/olpc/datastore/datastore.py index 9880f43..34eb23c 100644 --- a/src/olpc/datastore/datastore.py +++ b/src/olpc/datastore/datastore.py @@ -27,6 +27,8 @@ DS_OBJECT_PATH = "/org/laptop/sugar/DataStore" logger = logging.getLogger(DS_LOG_CHANNEL) +DEFAULT_LIMIT = 65536 + class DataStore(dbus.service.Object): def __init__(self, **options): @@ -259,7 +261,7 @@ class DataStore(dbus.service.Object): order_by = kwargs.pop('order_by', []) # XXX: this is a workaround, deal properly with n backends - limit = kwargs.pop('limit', 50) + limit = kwargs.pop('limit', DEFAULT_LIMIT) offset = kwargs.pop('offset', 0) # distribute the search to all the mountpoints unless a diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py index c465b41..7effc4c 100644 --- a/src/olpc/datastore/xapianindex.py +++ b/src/olpc/datastore/xapianindex.py @@ -16,6 +16,7 @@ __license__ = 'The GNU Public License V2+' from Queue import Queue, Empty import logging import re +import sys import threading import warnings @@ -308,7 +309,7 @@ class IndexManager(object): # # Search - def search(self, query, start_index=0, end_index=50): + def search(self, query, start_index=0, end_index=4096): """search the xapian store. query is a string defining the serach in standard web search syntax. -- cgit v0.9.1