[Zope-CVS] CVS: Products/ZCTextIndex - OkapiIndex.py:1.1.2.5
Guido van Rossum
guido@python.org
Tue, 14 May 2002 10:35:52 -0400
Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv32520
Modified Files:
Tag: TextIndexDS9-branch
OkapiIndex.py
Log Message:
Some quick hacks to make the search side of things "work". The
query_weight() function is bogus -- I just stuck in the number 10
because that made the percentages come out between 10 and 100. :-)
=== Products/ZCTextIndex/OkapiIndex.py 1.1.2.4 => 1.1.2.5 ===
for wid in wids:
d2f = self._wordinfo[wid] # map {docid -> f(docid, wid)}
- idf = inverse_doc_frequency(len(d2w), N) # this is an unscaled float
+ idf = inverse_doc_frequency(len(d2f), N) # this is an unscaled float
result = IIBucket()
for docid, f in d2f.items():
lenweight = B_from1 + B * self._doclen[docid] / meandoclen
@@ -177,9 +177,13 @@
y, wy = merge.pop_smallest()
dummy, z = weightedUnion(x, y, wx, wy)
merge.add((z, 1), len(z))
- result, dummy = merge.pop_smallest()
+ (result, weight), score = merge.pop_smallest()
return result
+ def query_weight(self, terms):
+ # XXX I have no idea what to put here
+ return 10
+
def _get_frequencies(self, wids):
"""Return individual term frequencies."""
# Computes f(d, t) for each term.
@@ -250,6 +254,7 @@
return WidCode.decode(self._docwords[docid])
# The rest are helper methods to support unit tests
+ # XXX These don't work for Okapi, I assume
def _get_wdt(self, d, t):
wid, = self._lexicon.termToWordIds(t)