This is a nice solution! By having MultiSearcher create the Weight, it can pass itself in as the searcher, thereby allowing the correct docFreq() method to be called. This is similar to what I tried to do with topmostSearcher, but a much better way to do it.
I'm still left wondering if having MultiSearcher query all the RemoteSearchable's on every call to docFreq() within each TermQuery, PhraseQuery, SpanQuery and PhrasePrefixQuery is the way to go long term, although it seems like the best thing to do right now. The calls only happen when the Weight's are created, so maybe it's not too bad. Longer term, it might be better to distribute the idf information out to the RemoteSearchable's to minimize the required number of remote accesses for each Query. Wolf, do you want to implement Doug's solution? Chuck > -----Original Message----- > From: Doug Cutting [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 11, 2005 1:13 PM > To: Lucene Developers List > Subject: Re: How to proceed with Bug 31841 - MultiSearcher problems with > Similarity.docFreq() ? > > Chuck Williams wrote: > > As Wolf does, I hope a committer with deep knowledge of Lucene's > design > > in this area will weigh in on the issue and help to resolve it. > > The root of the bug is in MultiSearcher.search(). This should construct > a Weight, weight the query, then score the now-weighted query. > > Here's a potential way to fix it: > > 1. Replace all of the > > ... search(Query, ...) > > methods in Searchable.java with > > ... search(Weight, ...) > > methods. > > 2. Add search(Query, ...) convenience methods to Searcher.java which do > something like: > > public ... search(Query query, ...) { > return search(query.weight(this), ...); > } > > 3. Update the search() methods in IndexSearcher, MultiSearcher and > RemoteSearchable to operate on Weight's instead of queries. > > Does that make sense? > > Doug > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]