You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Madhusudan, Veda (Norcross, DAV)" <Ma...@UnisourceLink.Com> on 2006/03/29 17:19:44 UTC

Boosting a token in the query

Is there a way to boost a token while querying? Example, in the
following query +(DESC:sheets DESC:sheet), can the token 'sheets' be
boosted and given higher precedence over 'sheet' so the results matching
'sheets ' appear before those for 'sheet'? I am using lucene 1.2. I
tried using the boost factor for 'sheets' so the query would read:
+(DESC:sheets^2.0 DESC:sheet), but that did not help.

 

I have read overriding getFieldQuery of QueryParser would help boost
terms/tokens, but this is not available in lucene 1.2. Nor is the
IndexSearcher's explain method. 

 

Any ideas on how this can be accomplished?

 

Thanks.

 


Re: Boosting a token in the query

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Unfortunately I'm not sure what boosting capabilities were available  
in 1.2, but that syntax is correct for the 1.4+ at least.

And I'm sure the Explanation feature is not available in 1.2, but  
with more recent versions of Lucene you'd be able to see the effect  
of the boosts on the score.

Does Query have a setBoost() in 1.2?   If so, maybe the parser didn't  
support boosts at that time?   Sorry I'm not of more help.

	Erik


On Mar 29, 2006, at 10:19 AM, Madhusudan, Veda (Norcross, DAV) wrote:

> Is there a way to boost a token while querying? Example, in the
> following query +(DESC:sheets DESC:sheet), can the token 'sheets' be
> boosted and given higher precedence over 'sheet' so the results  
> matching
> 'sheets ' appear before those for 'sheet'? I am using lucene 1.2. I
> tried using the boost factor for 'sheets' so the query would read:
> +(DESC:sheets^2.0 DESC:sheet), but that did not help.
>
>
>
> I have read overriding getFieldQuery of QueryParser would help boost
> terms/tokens, but this is not available in lucene 1.2. Nor is the
> IndexSearcher's explain method.
>
>
>
> Any ideas on how this can be accomplished?
>
>
>
> Thanks.
>
>
>


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