Let's try again ;)

If I understand you correctly, you want the returned results to include
all documents matching some query, also documents that not satisfy the
specified range ("like 20 to 30"), but results that satisfy this range
should appear higher in the list.

If so, first you have to find out how you can build a range query.
Enough documentation on that. This results in a RangeQuery, let's call
it R.
I assume that the user can enter its search query (words) in another
field. For this you create another query (for example by using the
QueryParser), let's call this one Q. 
Now you have 2 queries (Q and R) which needs to be combined in a Boolean
query, so you get a boolean query: Q OR R
This can be done by specifying Q as boolean 'should' clause and R as
boolean 'should' clause. The BooleanQuery is the one to be used, and
documents matching the entered range will appear higher, because it
matches both clauses, and docs matching Q, but are outside that range
only match the first clause.

Br,
Elmer


On Thu, 2011-06-09 at 17:10 +0200, Sowmya V.B. wrote:
> Hi All
> 
> I have joined the group only today..and began working with lucene only
> recently.
> 
> My problem: I want to boost the ranking of certain documents, based on the
> values of certain fields.
> 
> For example, if the field has  a range of values from 0 to 100 and the user
> chooses something like 20 to 30, as an option, along with the query; I want
> the documents which satisfy that condition (The field value being between 20
> and 30) to get a boost during ranking.
> 
> Is there a way to do that in Lucene? I could not find an understandable
> explanation in the past mails about this. Hence, starting a fresh thread.
> 
> Sowmya.
> 



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

Reply via email to