[Zope-dev] SearchIndex/ZCatalog comments.

Erik Enge erik@thingamy.net
Fri, 15 Jun 2001 10:46:29 +0200 (CEST)


When writing the PossitionIndex, a bunch of questions arrised (Zope
2.3.2):

This is from UnTextIndex.py Zope 2.3.2 line 250 (or there abouts).
Why is the wordMap needed?

"""
    def getEntryForObject(self, rid, default=None):
        """Get all information contained for a specific object.

        This takes the objects record ID as it's main argument."""

        wordMap = self.getLexicon(self._lexicon)._lexicon.items()
        results = self._unindex.get(rid, None)

        if results is None:
            return default
        else:
            return tuple(map(self.getLexicon(self._lexicon).getWord,
                             results))
        
"""

I thought we didn't make it into a BTree 'till it was > 5?:

"""            
            else:
                if indexRow.get(documentId, -1) != score:
                    # score changed (or new entry)
                    
                    if type(indexRow) is DictType:
                        indexRow[documentId] = score
>>>>>>>>                if len(indexRow) > 3:
                            # Big enough to give it's own database record
                            indexRow=IIBTree(indexRow) 
                        index[entry] = indexRow
                    else:
                        indexRow[documentId] = score
"""

shouldn't "objects" be "object"?:

"""
    def index_object(self, documentId, obj, threshold=None):
        """ Index an object:
        'documentId' is the integer id of the document
        
        'obj' is the objects to be indexed
"""

do we need this is ZCatalog.py?:

"""
from SearchIndex import UnIndex, UnTextIndex 
"""

this isn't true?  what about keywordindexes (only 'Field' and 'Text'
mentioned)?:

"""
class ZCatalog(Folder, Persistent, Implicit):
    """ZCatalog object

    A ZCatalog contains arbirary index like references to Zope
    objects.  ZCatalog's can index either 'Field' values of object, or 
    'Text' values.
"""                    

do we need this in UnTextIndex.py?:

"""
from Splitter import Splitter
"""

from ResultList.py:

"""
    def __or__(self, x):
        return self.__class__(
            weightedUnion(self._dict, x._dict)[1],
            union(self._words, x._words),
            self._index,
            )
        return self.__class__(result, self._words+x._words, self._index)
"""

two returns?

Sorry if this is all mambo-jambo, or if it is already fixed in 2.4.