diff options
Diffstat (limited to 'src/carquinyol/indexstore.py')
-rw-r--r-- | src/carquinyol/indexstore.py | 17 |
1 files changed, 10 insertions, 7 deletions
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) |