[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG - TextIndexNG.py:1.2.2.13
Andreas Jung
andreas@digicool.com
Wed, 16 Jan 2002 10:40:00 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG
In directory cvs.zope.org:/tmp/cvs-serv1070
Modified Files:
Tag: ajung-textindexng-branch
TextIndexNG.py
Log Message:
integrated new QueryParser making the TextIndex much smarter
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/TextIndexNG.py 1.2.2.12 => 1.2.2.13 ===
from TextOperators import *
from TextIndexCommon import *
-from queryparser.TextIndexGgen import LoadTextIndexG
-from queryparser.TextIndexGgen import Collector,C
+from queryparser.queryparser import QueryParser
import Stemmer
import Proximity
@@ -131,8 +130,6 @@
raise ValueError,'nearStorage must be either "internal"'\
' or "documentLookup"'
- # get instance for query parser
- self._parser = LoadTextIndexG()
self.clear()
@@ -458,30 +455,27 @@
res = self.query( q )
- print res
return res
def query(self, q):
""" to be finished """
- LL = self.LexiconLookup
- PL = self.ProximityLookup
- txIntersection = self.txIntersection
- txUnion = self.txUnion
- txNear = self.txNear
-
- print "query",q
-
- self._parser.DoParse1( q )
-
- # XXX: Hack !!!
- parsed_query = C.getResult()
- print "parsed query", parsed_query
+ LL = self.LexiconLookup
+ PL = self.ProximityLookup
+ txI = self.txIntersection
+ txU = self.txUnion
+ txN = self.txNear
+
+ debug('Query: ',q)
+
+ parsed_query = QueryParser()(q)
+
+ debug('parsed query: ', parsed_query)
res = eval( parsed_query )
- print "result",res
+ debug('Result:',res)
# Bah....this sucks
return res.docIds(), (self.id,)
@@ -516,6 +510,7 @@
r = ResultSet( docIds, (word,))
return r
+
def ProximityLookup(self,word):
""" search a word in the proximity lexicon and return