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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
