コード例 #1
0
    def __init__(self, lexicon):
        BaseIndex.__init__(self, lexicon)

        # ._wordinfo for Okapi is
        # wid -> {docid -> frequency}; t -> D -> f(D, t)

        # ._docweight for Okapi is
        # docid -> # of words in the doc
        # This is just len(self._docwords[docid]), but _docwords is stored
        # in compressed form, so uncompressing it just to count the list
        # length would be ridiculously expensive.

        # sum(self._docweight.values()), the total # of words in all docs
        # This is a long for "better safe than sorry" reasons.  It isn't
        # used often enough that speed should matter.
        self._totaldoclen = 0L
コード例 #2
0
ファイル: OkapiIndex.py プロジェクト: bendavis78/zope
    def __init__(self, lexicon):
        BaseIndex.__init__(self, lexicon)

        # ._wordinfo for Okapi is
        # wid -> {docid -> frequency}; t -> D -> f(D, t)

        # ._docweight for Okapi is
        # docid -> # of words in the doc
        # This is just len(self._docwords[docid]), but _docwords is stored
        # in compressed form, so uncompressing it just to count the list
        # length would be ridiculously expensive.

        # sum(self._docweight.values()), the total # of words in all docs
        # This is a long for "better safe than sorry" reasons.  It isn't
        # used often enough that speed should matter.
        # Use a BTree.Length.Length object to avoid concurrent write conflicts
        self._totaldoclen = Length(0L)
コード例 #3
0
 def __init__(self, lexicon):
     BaseIndex.__init__(self, lexicon)
コード例 #4
0
ファイル: CosineIndex.py プロジェクト: wpjunior/proled
 def __init__(self, lexicon):
     BaseIndex.__init__(self, lexicon)
コード例 #5
0
ファイル: OkapiIndex.py プロジェクト: bendavis78/zope
 def unindex_doc(self, docid):
     self._change_doc_len(-self._docweight[docid])
     BaseIndex.unindex_doc(self, docid)
コード例 #6
0
ファイル: OkapiIndex.py プロジェクト: bendavis78/zope
 def _reindex_doc(self, docid, text):
     self._change_doc_len(-self._docweight[docid])
     return BaseIndex._reindex_doc(self, docid, text)
コード例 #7
0
ファイル: OkapiIndex.py プロジェクト: bendavis78/zope
 def index_doc(self, docid, text):
     count = BaseIndex.index_doc(self, docid, text)
     self._change_doc_len(count)
     return count
コード例 #8
0
 def unindex_doc(self, docid):
     self._change_doc_len(-self._docweight[docid])
     BaseIndex.unindex_doc(self, docid)
コード例 #9
0
 def _reindex_doc(self, docid, text):
     self._change_doc_len(-self._docweight[docid])
     return BaseIndex._reindex_doc(self, docid, text)
コード例 #10
0
 def index_doc(self, docid, text):
     count = BaseIndex.index_doc(self, docid, text)
     self._change_doc_len(count)
     return count
コード例 #11
0
 def unindex_doc(self, docid):
     self._totaldoclen -= self._docweight[docid]
     BaseIndex.unindex_doc(self, docid)
コード例 #12
0
 def _reindex_doc(self, docid, text):
     self._totaldoclen -= self._docweight[docid]
     return BaseIndex._reindex_doc(self, docid, text)
コード例 #13
0
 def index_doc(self, docid, text):
     count = BaseIndex.index_doc(self, docid, text)
     self._totaldoclen += count
     return count