From d86cfb826a9d41fbb3dadd001ada2a39c8842997 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Wed, 13 Apr 2011 17:54:22 +0100 Subject: [PATCH 1/2] Fix regression in searching breaking lookup names containing digits --- src/calibre/utils/search_query_parser.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/utils/search_query_parser.py b/src/calibre/utils/search_query_parser.py index 387ad1487e..d74276ff9e 100644 --- a/src/calibre/utils/search_query_parser.py +++ b/src/calibre/utils/search_query_parser.py @@ -19,8 +19,8 @@ If this module is run, it will perform a series of unit tests. import sys, string, operator from calibre.utils.pyparsing import CaselessKeyword, Group, Forward, \ - CharsNotIn, Suppress, OneOrMore, MatchFirst, CaselessLiteral, \ - Optional, NoMatch, ParseException, QuotedString, Word + CharsNotIn, Suppress, OneOrMore, MatchFirst, alphas, alphanums, \ + Optional, ParseException, QuotedString, Word from calibre.constants import preferred_encoding from calibre.utils.icu import sort_key @@ -129,7 +129,8 @@ class SearchQueryParser(object): self.optimize = optimize # Define a token self.standard_locations = locations - location = Optional(Word(string.ascii_letters+'#')+Suppress(':'), default='all') + location = Optional(Word(alphas+'#', bodyChars=alphanums)+Suppress(':'), + default='all') word_query = CharsNotIn(string.whitespace + '()') #quoted_query = Suppress('"')+CharsNotIn('"')+Suppress('"') quoted_query = QuotedString('"', escChar='\\') From ad72e89072875e8e82167da3ba6898d14a618852 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Wed, 13 Apr 2011 18:02:45 +0100 Subject: [PATCH 2/2] ... --- src/calibre/utils/search_query_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/search_query_parser.py b/src/calibre/utils/search_query_parser.py index d74276ff9e..10d8b64a0d 100644 --- a/src/calibre/utils/search_query_parser.py +++ b/src/calibre/utils/search_query_parser.py @@ -129,7 +129,7 @@ class SearchQueryParser(object): self.optimize = optimize # Define a token self.standard_locations = locations - location = Optional(Word(alphas+'#', bodyChars=alphanums)+Suppress(':'), + location = Optional(Word(alphas+'#', bodyChars=alphanums+'_')+Suppress(':'), default='all') word_query = CharsNotIn(string.whitespace + '()') #quoted_query = Suppress('"')+CharsNotIn('"')+Suppress('"')