[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG/queryparser - queryparser.py:1.1.2.10 TextIndexGgen.py:1.1.2.5
Andreas Jung
andreas@digicool.com
Tue, 12 Feb 2002 13:11:53 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG/queryparser
In directory cvs.zope.org:/tmp/cvs-serv6640
Modified Files:
Tag: ajung-textindexng-branch
queryparser.py TextIndexGgen.py
Log Message:
added support for NEAR search
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/queryparser/queryparser.py 1.1.2.9 => 1.1.2.10 ===
"""
+ NEARREGEX = 'near'
ANDREGEX = 'and'
ORREGEX = 'or'
STRREGEX = '[\w\*\?]*'
@@ -49,6 +50,7 @@
self.TextIndexG.Addterm("openp", self.OPENPREGEX, self.addOpenParens)
self.TextIndexG.Addterm("closep", self.CLOSEPREGEX, self.addCloseParens)
self.TextIndexG.Addterm("and", self.ANDREGEX, self.addOp)
+ self.TextIndexG.Addterm("near", self.NEARREGEX, self.addOp)
self.TextIndexG.Addterm("or", self.ORREGEX, self.addOp)
self.TextIndexG.Addterm("str", self.STRREGEX, self.addWord)
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/queryparser/TextIndexGgen.py 1.1.2.4 => 1.1.2.5 ===
@R R4 :: factor >> term
@R R5 :: factor >> term and term
+ @R R5a :: factor >> term near term
@R R6 :: term >> str
@R R7 :: term >> openp expr closep
@@ -35,6 +36,7 @@
MARSHALLEDFILENAME = "TextIndexG.mar"
ANDREGEX = 'and'
ORREGEX = 'or'
+NEARREGEX = 'near'
STRREGEX = '[a-zA-Z]*'
OPENPREGEX = r'('
CLOSEPREGEX = r')'
@@ -43,6 +45,7 @@
def DeclareTerminals(Grammar):
Grammar.Addterm("openp", OPENPREGEX, '')
Grammar.Addterm("closep",CLOSEPREGEX, '')
+ Grammar.Addterm("near", NEARREGEX, '')
Grammar.Addterm("and", ANDREGEX, '')
Grammar.Addterm("or", ORREGEX, '')
Grammar.Addterm("str", STRREGEX, '')