diff options
author | Sascha Silbe <sascha@silbe.org> | 2009-08-09 19:03:56 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha@silbe.org> | 2009-08-13 22:36:16 (GMT) |
commit | 1577020f4764c86359efc08d0f5f22b0525ac435 (patch) | |
tree | f2871dd72c9c8b6cd97dfcf0bc35c370763670cf | |
parent | 2a917b5941c3ac594e1e0ee3ae27622a47971965 (diff) |
remove locale setting, was only used for DateRangeProcessor
-rw-r--r-- | src/carquinyol/datastore.py | 3 | ||||
-rw-r--r-- | src/carquinyol/indexstore.py | 17 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py index 729f4a9..41b16b5 100644 --- a/src/carquinyol/datastore.py +++ b/src/carquinyol/datastore.py @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import logging -import locale import uuid import time import os @@ -51,8 +50,6 @@ class DataStore(dbus.service.Object): """ def __init__(self, **options): - # needed for locale-specific date parsing - locale.setlocale(locale.LC_ALL, '') bus_name = dbus.service.BusName(DS_SERVICE, bus=dbus.SessionBus(), replace_existing=False, diff --git a/src/carquinyol/indexstore.py b/src/carquinyol/indexstore.py index d66b10e..45f09a9 100644 --- a/src/carquinyol/indexstore.py +++ b/src/carquinyol/indexstore.py @@ -91,12 +91,15 @@ class TermGenerator (xapian.TermGenerator): elif not isinstance(value, basestring): value = str(value) - # add full value for dictionary-based searches + # We need to add the full value (i.e. not split into words) so + # dictionary-based queries work (they don't split the value + # into words). # TODO: change query parser to generate phrase query instead doc.add_term(prefix + value) - # index with and without prefix so specifying a prefix is optional - # in query strings + # We need to index both with and without prefix because Xapian + # only matches against non-prefix terms if no prefix is given + # inside the query. if prefix: self.index_text(value, 1, prefix) @@ -132,8 +135,8 @@ class QueryParser (xapian.QueryParser): def _parse_query_value_range(self, name, value, value_no): if len(value) != 2: raise TypeError( - "Only tuples of size 2 have a defined meaning. " - "Did you mean to pass a list instead?") + 'Only tuples of size 2 have a defined meaning. ' + 'Did you mean to pass a list instead?') start, end = value return Query(Query.OP_VALUE_RANGE, value_no, str(start), str(end)) @@ -168,7 +171,7 @@ class QueryParser (xapian.QueryParser): '') except xapian.QueryParserError, exception: - logging.warning("Invalid query string: "+exception.get_msg()) + logging.warning('Invalid query string: '+exception.get_msg()) return Query() def parse_query(self, query_dict, query_string): @@ -195,7 +198,7 @@ class QueryParser (xapian.QueryParser): if query_dict: logging.warning('Unknown term(s): %r', query_dict) - logging.debug("queries: %r", [str(q) for q in queries]) + logging.debug('queries: %r', [str(q) for q in queries]) return Query(Query.OP_AND, queries) |