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() {
            public void collect(int docId, float v) {
               bits.set(docId);
            }
         });

         cats.put(term.text(), bits);

      } while (te.next());


I want to replace the search by a termDocs statement that returns me a
bitset.

Best.

On Jan 25, 2008 6:05 PM, Erick Erickson <[EMAIL PROTECTED]> wrote:

> 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 hitcollector, or do can I do it with
> > TermDocs() - (I could not figure it out with termdocs);
> >
> > Best, and thanks a lot for your help.
> >
> > -C.B.
> >
> > On Jan 25, 2008 5:31 PM, Erick Erickson <[EMAIL PROTECTED]> wrote:
> >
> > > 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();
> > >
> > >            if ((term == null) || ! term.field().equals("field")) {
> > >                return;
> > >            }
> > >            list.add(term.text());
> > >       } while (theTerms.next());
> > >
> > >
> > > On Jan 25, 2008 10:24 AM, Cam Bazz <[EMAIL PROTECTED]> wrote:
> > >
> > > > Hello,
> > > >
> > > > How do we get the TermEnum trick? I could not figure it out.
> > basically,
> > > I
> > > > have a field called category, and I like to learn what different
> > values
> > > > the
> > > > category field takes. (sort of like unique in sql)
> > > >
> > > > Best Regards,
> > > > -C.B.
> > > >
> > >
> >
>

Reply via email to