lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Question about Boosting Fields in a Query
Date Wed, 27 Apr 2005 15:36:00 GMT

On Apr 27, 2005, at 11:02 AM, Sven wrote:
> Hi folks,
>
> I have a question about boosting fields in a Query.
> Suppose we have documents like this in the index:
>
> fieldA:String fieldB:String fieldC:Date fieldD:Number
>
> And the query is like that:
>
> fieldA: wordA1 wordA2 wordA3 wordA4
> fieldB: wordB1 wordB2 wordB3 wordB4
> fieldC:[date1 to date2]
> fieldD:[number1 to number2]
>
>
> Now what I want to do is to boost certain fields, for example the 
> fieldA
> of the query should be boosted by a factor of 2.
> What is the most elegant way to do that?

This depends on how you're constructing the query.  If you're doing it 
through the API, then call query.setBoost(2.0f) on the fieldA clause.  
If this an expression you're parsing, use "expression"^2.0 syntax.

	Erik


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


Mime
View raw message