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 Klaus Hubert <kl...@yahoo.com> on 2006/01/03 17:21:28 UTC

boosting results with a field from the index

Hi and a Happy New Year!
 
I created a lucene index with 2 fields (text and importance). The text contains the real text and importance is a field where I manually give a number between 1 and 5 for the related document. When I search the index I find the documents with the highest revelancy weighted automatically by lucene. I'm just wondering if I can boost the results with the importance field I already have stored in the index. As I result I expect the same search results just weighted differently. Something like relevancy multiplied by importance.
 
Thank you so much,
 
  Klaus

		
---------------------------------
Yahoo! Photos
 Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

Re: boosting results with a field from the index

Posted by Yonik Seeley <ys...@gmail.com>.
Take a look at FunctionQuery
http://issues.apache.org/jira/browse/LUCENE-446

It can do relevancy+importance, but not relevancy*importance with the
provided classes.  It shouldn't be too hard to do the multiplication
though.

You could also boost the field or document at index time.  That gives
you what you want, but it's fixed at indexing time and can't be
changed per-query.

-Yonik


On 1/3/06, Klaus Hubert <kl...@yahoo.com> wrote:
> Hi and a Happy New Year!
>
> I created a lucene index with 2 fields (text and importance). The text contains the real text and importance is a field where I manually give a number between 1 and 5 for the related document. When I search the index I find the documents with the highest revelancy weighted automatically by lucene. I'm just wondering if I can boost the results with the importance field I already have stored in the index. As I result I expect the same search results just weighted differently. Something like relevancy multiplied by importance.
>
> Thank you so much,
>
>   Klaus
>
>
> ---------------------------------
> Yahoo! Photos
>  Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.
>

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


Re: boosting results with a field from the index

Posted by Grant Ingersoll <gs...@syr.edu>.
Hi Klaus,

You might want to just set the boost value of the Document using your 
importance number, then Lucene will factor that in automatically when 
scoring.  See the Document#setBoost javadoc for info.

You could also sort on the field, I think, so that the more important 
docs come to the top.

-Grant

Klaus Hubert wrote:

>Hi and a Happy New Year!
> 
>I created a lucene index with 2 fields (text and importance). The text contains the real text and importance is a field where I manually give a number between 1 and 5 for the related document. When I search the index I find the documents with the highest revelancy weighted automatically by lucene. I'm just wondering if I can boost the results with the importance field I already have stored in the index. As I result I expect the same search results just weighted differently. Something like relevancy multiplied by importance.
> 
>Thank you so much,
> 
>  Klaus
>
>		
>---------------------------------
>Yahoo! Photos
> Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.
>  
>

-- 
------------------------------------------------------------------- 
Grant Ingersoll 
Sr. Software Engineer 
Center for Natural Language Processing 
Syracuse University 
School of Information Studies 
337 Hinds Hall 
Syracuse, NY 13244 

http://www.cnlp.org 
Voice:  315-443-5484 
Fax: 315-443-6886 


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