lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frode Bjerkholt ...@mtouch.no>
Subject Different boost values for different terms in a field.
Date Thu, 05 Oct 2006 08:10:43 GMT
Hi

My intention is to give different terms in a field different boost values.

The queries from a use perspective, will be one fulltext input field.

The following code illustrates this:

Field f1 = new Field("name", "John", Field.Store.NO, Field.Index.TOKENIZED);
Field f2 = new Field("name", "Doe", Field.Store.NO, Field.Index.TOKENIZED);

f1.setBoost(1.0f);
f2.setBoost(2.0f);

doc.add(f1);
doc.add(f2);

In the current version of Lucene, as far as I now, this does not work - 
Allthough it would have been a very powerful feature. 

The current solution is to make a firstname field and a lastname field, and 
then make a complex query like this:

Input: Eric Doe

(firstname:Eric OR lastname:Eric^2) AND (firstname:Doe OR lastname:Doe^2)

The performance of such a query is quite slow, and it becomes even worse when 
you have more than two fields and/or more words in the input string.

My questions:

1. Is there a better/faster solution to accomplish such a query?

2. Would it be possible to implement the described feature in a future version 
of Lucene?

-- 
Best Regards,

Frode

---------------------------------------------------------------------
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