On Tue, 12 Sep 2006, Yura Smolsky wrote:
another issue... when I perform search on the field like this:
Field("link", link, Field.Store.YES, Field.Index.UN_TOKENIZED)
I got weird value of maxScore of TopFieldDocs.
Here is program:
from PyLucene import *
dir = FSDirectory.getDirectory("../../index/index", False)
searcher = IndexSearcher(dir)
query = PrefixQuery(Term("link", "yahoo.com"))
print query
weight = query.weight(searcher)
tfd = searcher.search(weight, None, 10, Sort())
print 'TopFieldDocs.maxScore:', tfd.getMaxScore()
output:
link:yahoo.com*
TopFieldDocs.maxScore: -1.#INF
That value should be -inf. Apparently, the maxScore is initialized to -inf
(negative infinity) in Lucene's FieldSortedHitQueue.java, line 77:
/** Stores the maximum score value encountered, needed for normalizing. */
protected float maxscore = Float.NEGATIVE_INFINITY;
and of course I cannot build object of TopFieldDocs with such value. I
am not sure where is error.. Please check.
In python, to create a float with negative infinity you say: float('-inf')
Andi..
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev