I verified, by modifying the RemoteSearcher.py code you sent me yesterday that 'searchSorted' is working properly. The code is attached.
Andi..
On Sat, 5 Feb 2005, Yura Smolsky wrote:
Hello, pylucene-dev.
I use ParallelMultiSearcher and I construct manually variables passed to search, searchSorted methods of Searchable implementation. I got this exception when I use sort and ParallerMultiSearcher:
scoreDoc: 261 scoreDoc: 211 ... skipped ... scoreDoc: 142 scoreDoc: 144 Exception in thread "MultiSearcher thread #1" java.lang.ClassCastException: org.apache.lucene.search.ScoreDoc cannot be cast to org.apache.lucene.search.FieldDoc at 0x012ce0ae (Unknown Source) ... skipped hits: 18
if I do not use sort or if I use Searchable implementation through searchSorted then everything is ok. I do not understand this.. Who is messing the data?.. Maybe method searchSorted of implementation of Searchable generates "bad" PyLucene classes?..
Thanks in advance.
Yura Smolsky
#!/usr/bin/python2.4
from PyLucene import *
class RemoteSearcher(Object):
def __init__(self, local):
self.local = local
def close(self):
self.local.close()
def docFreq(self, term):
return self.local.docFreq(term)
def maxDoc(self):
return self.local.maxDoc()
def searchAll(self, query, filter, hitCollector):
return self.local.search(query, filter, hitCollector)
def search(self, query, filter, n):
return self.local.search(query, filter, n)
def searchSorted(self, query, filter, n, sort):
print 'in searchSorted'
tfd = self.local.search(query, filter, n, sort)
print [str(sf) for sf in tfd.fields]
return tfd
def doc(self, i):
return self.local.doc(i)
def rewrite(self, original):
return self.local.rewrite(original)
def explain(self, query, doc):
return self.local.explain(query, doc)
a = StandardAnalyzer()
searcher = IndexSearcher("index")
remoteS = RemoteSearcher(searcher)
# create MultiSearcher with one Searcher
parallel = ParallelMultiSearcher([remoteS])
query = QueryParser.parse("albania", "contents", a)
hits = parallel.search(query, Sort.RELEVANCE)
print hits.length()
_______________________________________________ pylucene-dev mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
