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: Q: how to parse query and add boost a term
Date Tue, 15 Jun 2004 09:41:10 GMT

On Jun 15, 2004, at 5:04 AM, Zilverline wrote:

> Hi,
>
> How can I use Lucene's API best to parse a query and then boost the
> query with the 'title' given the relevant parts of the query (the
> default Field)? To give you an example:
>
> I want to change:
>
>     'java "method invocation" +type:HTML'
> into
>
>          '+contents:java +contents:"method invocation" +type:HTML
> +title:java^2 +title:"method invocation"^2'
>
> Of course without having to parse the query myself, so using 
> QueryParser
> and friends.

Subclass QueryParser and override getFieldQuery, and boost the queries 
you create.  You could simply delegate to super to create the query, 
and boost it if the field is "title".  Note that the QueryParser will 
override your boost if the user specified the boost factor manually.

	Erik


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


Mime
View raw message