Diff for /cdli/cdli_files.py between versions 1.115 and 1.116

version 1.115, 2010/03/19 14:01:41 version 1.116, 2010/03/23 16:20:40
Line 888  class CDLIRoot(Folder): Line 888  class CDLIRoot(Folder):
   
   
   
     def searchText(self, query, index='graphemes'):      def searchText(self, query, index='graphemes', resultFilter=None):
         """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
              resultFilter is matched against the beginning of the file ID"""
         # 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))          logging.debug("searchtext for '%s' in index %s"%(query,index))
         #import Products.ZCTextIndex.QueryParser          #import Products.ZCTextIndex.QueryParser
Line 900  class CDLIRoot(Folder): Line 901  class CDLIRoot(Folder):
         # do search          # do search
         resultset = idx.search(query_request=idxQuery,sort_index='textid')          resultset = idx.search(query_request=idxQuery,sort_index='textid')
         # put only the P-Number in the result           # put only the P-Number in the result 
           if resultFilter is None:
         results = [res.getId[:7] for res in resultset]          results = [res.getId[:7] for res in resultset]
           else:
               results = [res.getId[:7] for res in resultset if res.getId.startswith(resultFilter)]
         logging.debug("searchtext: found %d texts"%len(results))          logging.debug("searchtext: found %d texts"%len(results))
         return results          return results
   

Removed from v.1.115  
changed lines
  Added in v.1.116


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>