Re: TermEnum trick

2008-01-25 Thread Grant Ingersoll
How about a QueryWrapperFilter.bits(IndexReader)? -Grant On Jan 25, 2008, at 10:49 AM, Cam Bazz wrote: Hello, How about getting which documents have the that term as a bitset? In other words, now that I have field=a, field=b do I use regular query logic to get the bitsets with hitcollecto

Re: TermEnum trick

2008-01-25 Thread Erick Erickson
Several things. 1> you're allocating a new bitset each time around. Do it outside the loop. 2> You want to use TermDocs. Something like (but I haven't tried it in this form) Term term = new Term(blah blah blah); TermDocs td = ir.termDocs(term); BitSet b

Re: TermEnum trick

2008-01-25 Thread Cam Bazz
Currently I am doing: do { term = te.term(); if ((term == null) || ! term.field().equals("cat")) { return; } final BitSet bits = new BitSet(reader.maxDoc()); searcher.search(new TermQuery(new Term("cat", term.text())), new HitCollector() { pub

Re: TermEnum trick

2008-01-25 Thread Erick Erickson
Can you show us what you've tried? Erick On Jan 25, 2008 10:49 AM, Cam Bazz <[EMAIL PROTECTED]> wrote: > Hello, > > How about getting which documents have the that term as a bitset? > > In other words, now that I have field=a, field=b do I use regular query > logic to get the bitsets with hitcol

Re: TermEnum trick

2008-01-25 Thread Cam Bazz
Hello, How about getting which documents have the that term as a bitset? In other words, now that I have field=a, field=b do I use regular query logic to get the bitsets with hitcollector, or do can I do it with TermDocs() - (I could not figure it out with termdocs); Best, and thanks a lot for y

Re: TermEnum trick

2008-01-25 Thread Erick Erickson
Try this, where ir is an IndexReader. The trick is that starting with "" gives you the entire list.. Note that you'll go off the end of the field sometime. TermEnum theTerms = ir.terms(new Term("field", "")); Term term = null; do { term = theTerms.term