Fix #4951 (Seach Interface History - Keyword Missmatch)

This commit is contained in:
Kovid Goyal 2010-02-20 09:57:35 -07:00
parent 7ca92a591c
commit e4b0e9f518

View File

@ -112,7 +112,7 @@ class SearchQueryParser(object):
And << (Group(
Not + Suppress(Keyword("and", caseless=True)) + And
).setResultsName("and") | Group(
Not + OneOrMore(~oneOf("and or") + And)
Not + OneOrMore(~oneOf("and or", caseless=True) + And)
).setResultsName("and") | Not)
Or << (Group(
@ -463,14 +463,14 @@ class Tester(SearchQueryParser):
tests = {
'Dysfunction' : set([348]),
'title:Dysfunction' : set([348]),
'title:Dysfunction or author:Laurie': set([348, 444]),
'title:Dysfunction OR author:Laurie': set([348, 444]),
'(tag:txt or tag:pdf)': set([33, 258, 354, 305, 242, 51, 55, 56, 154]),
'(tag:txt or tag:pdf) and author:Tolstoy': set([55, 56]),
'(tag:txt OR tag:pdf) and author:Tolstoy': set([55, 56]),
'Tolstoy txt': set([55, 56]),
'Hamilton Amsterdam' : set([]),
u'Beär' : set([91]),
'dysfunc or tolstoy': set([348, 55, 56]),
'tag:txt and not tolstoy': set([33, 258, 354, 305, 242, 154]),
'tag:txt AND NOT tolstoy': set([33, 258, 354, 305, 242, 154]),
'not tag:lrf' : set([305]),
'london:thames': set([13]),
'publisher:london:thames': set([13]),