diff --git a/src/DocumentLibrary/CatalogPlus.py b/src/DocumentLibrary/CatalogPlus.py index df5c466..411d83d 100644 --- a/src/DocumentLibrary/CatalogPlus.py +++ b/src/DocumentLibrary/CatalogPlus.py @@ -84,6 +84,7 @@ ############################################################################## from Products.ZCatalog.Catalog import Catalog +from Products.PluginIndexes.TextIndex.Lexicon import Lexicon try: # Try to import PluginIndexes (Zope 2.4 or higher) @@ -104,6 +105,7 @@ threshold = 10000 _v_total = 0 _v_transaction = None + __userdefined__ = Lexicon(useSplitter="UnicodeSplitter") def catalog_object(self, obj, uid=None): """ wrapper around catalog """ @@ -152,15 +154,5 @@ self.uncatalogObject(uid) def getLexicon(self): -# lexicon = self.lexicon - lexicon = None - - if type(lexicon) == type(''): - vocabulary = getattr(self, lexicon, None) - if vocabulary: - return vocabulary.getLexicon() - else: - return None - else: - return lexicon + return Lexicon(useSplitter="UnicodeSplitter") diff --git a/src/DocumentLibrary/tests/testDocumentHandling.py b/src/DocumentLibrary/tests/testDocumentHandling.py index d4d9fa0..83e6305 100755 --- a/src/DocumentLibrary/tests/testDocumentHandling.py +++ b/src/DocumentLibrary/tests/testDocumentHandling.py @@ -40,5 +40,15 @@ self.app.REQUEST.set('URL1', 'http://www.somewhere.com/') self.ds.addDocumentFile(self.app.REQUEST) + def testRecatalog(self): + assert self.ds != None + f = open('test.pdf') + nf = NamedFile('test.pdf', f) + self.app.REQUEST.set('file', nf) + self.app.REQUEST.set('title', 'test pdf document') + self.app.REQUEST.set('URL1', 'http://www.somewhere.com/') + self.ds.addDocumentFile(self.app.REQUEST) + self.ds.manage_reinitCatalog() + if __name__ == '__main__': framework()