lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Suggesting refine searches with Lucene
Date Tue, 14 Feb 2006 01:08:20 GMT

Take a look at the HighFreqTerms sample class in contrib... doesn't meet your goal, because it returns a list of terms that
appear frequently in the whol index, not just in the results of a query.

But if you use a HitCollector (or a Filter) to generate a BitSet of all
your results, and if you modified HighFreqTerms to only count Terms where
the TermDocs contains a result in your BitSet ... then you'll be really
close to what you want.

(I say really close because it's only going to suggest individual Terms,
not "phrases" in the sense of something that would match a PhraseQuery
containing multiple Terms ... but you could allways index word ngrams of
various sizes so they would count as individual Terms)

Depending on the number of Terms in your idnex, and the number of results
in a typical search, you may be better of storing the term vectors for
each doc, iterating over the matches and using the
TermFreqVector.getTerms(), Acctually, that's probably faster in all cases.

: Date: Mon, 13 Feb 2006 17:34:58 +0800
: From: Chun Wei Ho <>
: Reply-To:
: To:
: Subject: Suggesting refine searches with Lucene
: Hi,
: I am trying to suggest refine searches for my Lucene search. For
: example, if a search turned out too many searches, it would list a
: number of document title subsequences that occurred frequently in the
: results of the previous search, as possible candidates for refining
: the search.
: Does anyone know the right/any approach to implementing this in a
: Lucene-based search app?
: Thanks.
: CW
: ---------------------------------------------------------------------
: To unsubscribe, e-mail:
: For additional commands, e-mail:


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

View raw message