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 Clemens Wyss <cl...@mysign.ch> on 2011/06/02 21:51:19 UTC

boosting fields

I have a minimal unit test in which I add three documents to an index. The documents have two fields "year" and "descritpion".
doc1(year = "2007", desc = "text with 2007 and 2009")
doc2(year = "2009", desc = "text with 2007 and 2009")
doc3(year = "2008", desc = "text with 2007 and 2009")

To search I use a BooleanQuery with a TermQuery (very high boosted), a PrefixQuery (high boosted) and a WildcardQuery (normal boost).

when I search for "2007" I get 
doc1
doc2
doc3

when I search for "2009" I get
doc2
doc1
doc3

Looks like the "exact match" on year is rated higher, which is good. Now when I set the boost factor of year to 2f I get the same results. But when I set the boost factor of year to 10f the order is inversed, i.e. the matching on desc is rated higher. 

How come?


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


Re: boosting fields

Posted by Erick Erickson <er...@gmail.com>.
Have you tried using the explain method on a Searcher and examining the results?

Best
Erick

On Thu, Jun 2, 2011 at 3:51 PM, Clemens Wyss <cl...@mysign.ch> wrote:
> I have a minimal unit test in which I add three documents to an index. The documents have two fields "year" and "descritpion".
> doc1(year = "2007", desc = "text with 2007 and 2009")
> doc2(year = "2009", desc = "text with 2007 and 2009")
> doc3(year = "2008", desc = "text with 2007 and 2009")
>
> To search I use a BooleanQuery with a TermQuery (very high boosted), a PrefixQuery (high boosted) and a WildcardQuery (normal boost).
>
> when I search for "2007" I get
> doc1
> doc2
> doc3
>
> when I search for "2009" I get
> doc2
> doc1
> doc3
>
> Looks like the "exact match" on year is rated higher, which is good. Now when I set the boost factor of year to 2f I get the same results. But when I set the boost factor of year to 10f the order is inversed, i.e. the matching on desc is rated higher.
>
> How come?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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