lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Query Term Questions
Date Wed, 21 Jan 2004 15:46:09 GMT
Terry Steichen wrote:
> 1) Is there a way to set the query boost factor depending not on the presence of a term,
but on the presence of two specific terms?  For example, I may want to boost the relevance
of a document that contains both "iraq" and "clerics", but not boost the relevance of documents
that contain only one or the other terms. (The idea is better discrimination than if I simply
boosted both terms.)

Erik already mentioned Similarity.coord().

Another approach might be something like "iraq clerics (iraq AND 
clerics)^10".  In other words, add a clause to the query which requires 
both of the terms, and boost that clause.

> 2) Is it possible to apply (or simulate) a negative query boost factor?  For example,
I may have a complex query with lots of terms but want to reduce the relevance of a matching
document that also included the term "iowa". ( The idea is for an easier and more discriminating
way than simply increasing the relevance of all other terms besides "iowa").  

Erik already mentioned this.  Negative boosts work as you'd expect.

> 3) Is there a way to handle variants of a phrase without OR'ing together the variants?
 For example, I may want to find documents dealing with North Korea; the terms might be "north
korea" or "north korean" or "north koreans" - is there a way to handle this with a single
term using wildcards?

Check out (the poorly named) PhrasePrefixQuery.


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

View raw message