lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dragon Fly" <>
Subject Re: Empty fields ...
Date Wed, 19 Jul 2006 14:13:09 GMT
Thank you very much.

>From: "Erick Erickson" <>
>Subject: Re: Empty fields ...
>Date: Wed, 19 Jul 2006 09:48:04 -0400
>Try something like
>TermDocs         termDocs = reader.termDocs();
> Term("<relevant field name here>", ""));
>while ( {
>    bits.set(termDocs.doc());
>I *think* (and I'm remembering things folks wrote, haven't done this 
>that the empty string for the Term matches all terms. If not, you might 
>to wrap in in an outer loop that loops through all the elements, something
>        bits = new BitSet(reader.maxDoc());
>        TermDocs         termDocs = reader.termDocs();
>        FilteredTermEnum fEnum = new FilteredTermEnum(reader, new
>Term(field, ""));
>        for (Term term = null; (term = fEnum.term()) != null;
>   Term(
>                    field,
>                    term.text()));
>            while ( {
>                bits.set(termDocs.doc());
>            }
>        }
>That said, it may be best for you to loop through each document and add 
>doc to the relevant filters if it had the fields you're interested in. 
>only be fetching each document once, so it'd only be one loop. I don't know
>enough about relative efficiencies to make a call here, probably depends
>upon how many docs you're dealing with. I'd stop at the first solution that
>works with acceptable performance unless you expect your corpus to grow
>significantly.... And since this is done in off hours, there's not a
>pressing reason to go with the very most efficient solution unless it takes
>a too long or you expect to have orders of magnitued more documents in your
>index eventually.

Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message