def getTerm(self, nr):
     if not hasattr(self, "_taxoReader"):
         self._taxoReader = DirectoryTaxonomyReader(self._taxoWriter)
     tr = DirectoryTaxonomyReader.openIfChanged(self._taxoReader)
     if tr:
         self._taxoReader.close()
         self._taxoReader = tr
     return self._taxoReader.getPath(nr).components[0]
Beispiel #2
0
 def runDrillDown(self):
     # open readers
     taxo = DirectoryTaxonomyReader(self.taxoDir)
     indexReader = DirectoryReader.open(self.indexDir)
     facetRes = SimpleSearcher.searchWithDrillDown(indexReader, taxo)
     # close readers
     taxo.close()
     indexReader.close()
     # return result
     return facetRes
Beispiel #3
0
 def runSimple(self):
     # open readers
     taxo = DirectoryTaxonomyReader(self.taxoDir)
     indexReader = DirectoryReader.open(self.indexDir)
     # returns List<FacetResult>
     facetRes = SimpleSearcher.searchWithFacets(indexReader, taxo)
     # close readers
     taxo.close()
     indexReader.close()
     # return result
     return facetRes
Beispiel #4
0
    def runDrillDown(self):
        # open readers
        taxo = DirectoryTaxonomyReader(self.taxoDir)
        indexReader = DirectoryReader.open(self.indexDir)

        for drilldown in drilldownCategories:
            print "search with drilldown: %s" %  '/'.join(drilldown)
            facetRes = SimpleSearcher.searchWithDrillDown(drilldown, indexReader,
                                                          taxo, self.facets_config)
        # close readers
        taxo.close()
        indexReader.close()
        # return result
        return facetRes
 def __init__(self, settings, indexDirectory=None, taxoDirectory=None):
     self._settings = settings
     self._similarity = settings.similarity
     self._numberOfConcurrentTasks = settings.numberOfConcurrentTasks
     self._reader = DirectoryReader.open(indexDirectory)
     self.taxoReader = DirectoryTaxonomyReader(taxoDirectory)
     self._readerSettingsWrapper = ReaderSettingsWrapper()
     self._readerSettingsWrapper.get = lambda: {
         "similarity": self.searcher.getSimilarity().toString(),
         "numberOfConcurrentTasks": self._numberOfConcurrentTasks
     }
     self._readerSettingsWrapper.set = self._setReadSettings
     self._searcher = None
     self._executor = None
     self._reopenSearcher = True
Beispiel #6
0
    def runSimple(self):
        # open readers
        taxo = DirectoryTaxonomyReader(self.taxoDir)
        indexReader = DirectoryReader.open(self.indexDir)

        for term in searchValues:
            print  "\nsearch by term '%s' ..." % term
            facetRes = SimpleSearcher.searchWithTerm(term, indexReader, taxo,
                                                       self.facets_config)
        print  "\nsearch all documents  ..."
        facetRes = SimpleSearcher.searchWithFacets(indexReader, taxo,
                                                   self.facets_config)
        # close readers
        taxo.close()
        indexReader.close()
        # return result
        return facetRes