You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Matt Magoffin <ap...@msqr.us> on 2005/11/11 01:30:08 UTC

Re: efficiently finding all terms used on a particular field withinDocuments matching a query

> : I'm wondering if there a more efficient way to accomplish this?
>
> I believe there is -- provided the terms are index.
>
> 1) Get yourself a BitSet representing the Documents you are interested in
> (you mentioned having a a date range, you can either use a RangeFilter nad
> call the bits method directly, or you can do a search using a
> HitCollector)
>
> 2) Look at the code that acctually makes RangeFilter work.  It iterates
> over a TermEnum between a low and high value.  for each term it finds, it
> uses a TermDocs to record the docid.  You could do something very similar,
> looping over all terms in the field you want.  but instead of recording
> the docid, add the term to your Set object -- if and only if one of the
> docids from the TermDocs is in your BitSet from step #1 above.
>
>
> ...that should be faster then the appraoch you have now.

Thank you, I had thought a BitSet was appropriate here somehow, I'll work
on this approach.

-- m@


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: efficiently finding all terms used on a particular field withinDocuments matching a query

Posted by Chris Hostetter <ho...@fucit.org>.
: Thank you, I had thought a BitSet was appropriate here somehow, I'll work
: on this approach.

Paul's suggestion is acctually a lot simpler, and I suspect it might be
faster -- but it does require that you index with TermVectors.  If that's
soemthing you're already doing, then you should definitely try that
appraoch first, if not ... i don't know which one would be best.  adding
TermVectors would definitely increase the size of your index, which would
probably affect the performance of your application in other ways.


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org