Commit 8b4268a8 authored by Guido van Rossum's avatar Guido van Rossum

I figured out what numObjects() is for -- it is used by ZCatalog's

Index management screen.  Ditto for clear().  So group them together
and adjust the comment.  (So is manage_main, but since it's a DTML
method, it can stay in its separate UI group.)
parent 864dbb9f
...@@ -84,10 +84,6 @@ class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem): ...@@ -84,10 +84,6 @@ class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem):
chooser.addmany(results.items()) chooser.addmany(results.items())
return chooser.getbest(), len(results) return chooser.getbest(), len(results)
def numObjects(self):
"""Return number of object indexed"""
return self.index.length()
## Pluggable Index APIs ## ## Pluggable Index APIs ##
def index_object(self, docid, obj, threshold=None): def index_object(self, docid, obj, threshold=None):
...@@ -133,10 +129,14 @@ class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem): ...@@ -133,10 +129,14 @@ class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem):
get_word = self.lexicon.get_word get_word = self.lexicon.get_word
return [get_word(wid) for wid in word_ids] return [get_word(wid) for wid in word_ids]
## XXX To which API does this conform? ## ## The ZCatalog Index management screen uses these methods ##
def numObjects(self):
"""Return number of unique words in the index"""
return self.index.length()
def clear(self): def clear(self):
"""reinitialize the index""" """reinitialize the index (but not the lexicon)"""
self.index = self._index_factory(self.lexicon) self.index = self._index_factory(self.lexicon)
## User Interface Methods ## ## User Interface Methods ##
......
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