[pylucene-dev] TopFieldDocs returned from indexSearcher are wrong

Yura Smolsky info at altervisionmedia.com
Sat Sep 9 03:40:26 PDT 2006


Hello.

object of TopFieldDocs returned from
IndexSearcher.search(Weight weight, Filter filter, int nDocs, Sort
sort) is wrong. Here is piece of code:

from PyLucene import *

dir = FSDirectory.getDirectory("../../index/index", False)
searcher = IndexSearcher(dir)
query = QueryParser("summary", StandardAnalyzer()).parse("good")
weight = query.weight(searcher)
print 'weight:', weight
tfd = searcher.search(weight, None, 10, Sort())
print 'TopFieldDocs:', tfd
print 'TopFieldDocs.fields:', tfd.fields


It tells me this:

weight: weight(summary:good)
TopFieldDocs: org.apache.lucene.search.TopFieldDocs at 15bc048
TopFieldDocs.fields:
Traceback (most recent call last):
  File "TopFieldDoc.py", line 14, in ?
    print 'TopFieldDocs.fields:', tfd.fields
AttributeError: 'PyLucene.TopDocs' object has no attribute 'fields'

--
Yura Smolsky,
http://altervisionmedia.com/




More information about the pylucene-dev mailing list