lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Tips on building a better BooleanQuery
Date Fri, 28 Apr 2006 21:58:32 GMT
Daniel Shane wrote:
>> For example, if I have terms A, B and C and I do a simple boolean search 
> : A
> B C, I would like to have a query that behaves a bit like if I rewrote this
> query as such :
> 
> +A +B +C "A B" "B C" "A B C"
> 
> This would boost results where the exact string "A B C" or any substring
> like "A B" or "B C" are found.

You could extend ExactPhraseScorer and override phraseFreq() to first 
compute a (weighted) sum the freq() of each TermPositions in the 
PhrasePositions.  The weighting should probably be something like 
sqrt(freq)/idf(term).

Doug

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


Mime
View raw message