version 1.80.2.6, 2007/11/02 15:37:46
|
version 1.80.2.7, 2007/11/19 15:14:44
|
Line 2127 class CDLIRoot(Folder):
|
Line 2127 class CDLIRoot(Folder):
|
def searchText(self, query, index='graphemes'): |
def searchText(self, query, index='graphemes'): |
"""searches query in the fulltext index and returns a list of file ids/P-numbers""" |
"""searches query in the fulltext index and returns a list of file ids/P-numbers""" |
# see also: http://www.plope.com/Books/2_7Edition/SearchingZCatalog.stx#2-13 |
# see also: http://www.plope.com/Books/2_7Edition/SearchingZCatalog.stx#2-13 |
|
logging.debug("searchtext for '%s' in index %s"%(query,index)) |
|
#import Products.ZCTextIndex.QueryParser |
|
#qp = QueryParser.QueryParser() |
|
#logging.debug() |
idxQuery = {index:{'query':query}} |
idxQuery = {index:{'query':query}} |
idx = getattr(self, self.file_catalog) |
idx = getattr(self, self.file_catalog) |
# do search |
# do search |
Line 2171 class CDLIRoot(Folder):
|
Line 2175 class CDLIRoot(Folder):
|
bounds = self.splitter[indexName].bounds |
bounds = self.splitter[indexName].bounds |
splitexp = "(%s|\s)(%%s)(%s|\s|\Z)"%(bounds,bounds) |
splitexp = "(%s|\s)(%%s)(%s|\s|\Z)"%(bounds,bounds) |
# compile into regexp objects |
# compile into regexp objects |
wordlist = [re.compile(splitexp%w,re.IGNORECASE) for w in word.split(' ')] |
wordlist = [re.compile(splitexp%w) for w in word.split(' ')] |
|
|
for line in file.split("\n"): |
for line in file.split("\n"): |
for word in wordlist: |
for word in wordlist: |