Hi Christian, Why not create the filter using QueryWrapperFilter using the previous Query? Or simply combine the previous with the new query using a BooleanQuery with Occur.MUST?
Even with the new API it is not possible what you want to do. The IndexReader passed to getDocIdSet/bits is not the same Reader as used for collecting hits for TopDocs before [By the way: Creating the filter would have gone faster if you simply implemented a (Hit)Collector that marks the hits in the BitSet] Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Christian Reuschling [mailto:christian.reuschl...@gmail.com] > Sent: Friday, October 16, 2009 10:25 PM > To: java-user@lucene.apache.org > Subject: Filter for searching in result lists with 2.9 > > Hi guys, > > in our app we gives the possibility to search inside a set of documents, > which > is the result list of a former search. Thus, someone can shrink down a > search > according different criterias. > > For this, we implemented a simple Filter that simply gets a TopDocs Object > and > creates a bitSet out of the document numbers: > > class SearchInResultsFilter extends Filter > { > private BitSet bitSet; > > public SearchInResultsFilter(TopDocs topDocs) > { > bitSet = new BitSet(topDocs.scoreDocs.length); > for (ScoreDoc scoreDoc : topDocs.scoreDocs) > { > bitSet.set(scoreDoc.doc); > } > } > > @Override > public BitSet bits(IndexReader reader) throws IOException > { > return bitSet; > } > } > > With Lucene 2.9, the reader object given in bits(..) is not the 'big > reader', > but some kind of subreader, i.e. a SegmentReader. Thus, the document ids > of > the topDocs and this object are not compatible anymore. > I think, in the new, non-deprecated 'DocIdSet getDocIdSet(IndexReader > reader)' > will be the same SegmentReader. > > I solved a similar scenario in our custom FieldComparator, by recognizing > the > reader-specific docbase given in the method > 'public void setNextReader(IndexReader reader, int docBase)' > > But inside Filter, I don't have such a nice method. What is the trick? > > > Thanks for all potential hints > > > Christian --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org