Commit 5fa82d8e authored by Andreas Jung's avatar Andreas Jung

Made aquisition of vocabularies for TextIndexes working.

parent bd2ea537
......@@ -87,7 +87,7 @@
"""
__version__ = '$Revision: 1.11 $'[11:-2]
__version__ = '$Revision: 1.12 $'[11:-2]
import string, re
......@@ -185,8 +185,14 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
self.clear()
if extra: self.vocabulary_id = extra.vocabulary
else: self.vocabulary_id = "Vocabulary"
if extra:
self.vocabulary_id = extra.vocabulary
self.catalog = extra.catalog
else:
self.vocabulary_id = "Vocabulary"
self.catalog = None
self._lexicon = None
......@@ -198,13 +204,16 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
self.vocabulary_id = '__userdefined__'
def getLexicon(self, vocab_id=None):
"""Return the Lexicon in use. Removed lots of stinking code"""
if self._lexicon is None:
## if no lexicon is provided, create a default one
try:
self._lexicon = self.aq_parent.getattr(self.vocabulary_id).getLexicon()
self._lexicon = getattr(self.catalog,self.vocabulary_id).getLexicon()
except:
self._lexicon = Lexicon()
self.vocabulary_id = '__intern__'
......@@ -348,6 +357,7 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
return 0
lexicon = self.getLexicon()
splitter = lexicon.Splitter
wordScores = OIBTree()
......
......@@ -830,6 +830,7 @@ class ZCatalog(Folder, Persistent, Implicit):
# an "extra" record.
if 'extra' in base.__init__.func_code.co_varnames:
extra.catalog = self
index = apply(base,(name,), {"extra":extra})
else:
index = base(name,self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment