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 "Kevin L. Cobb" <ke...@emergint.com> on 2003/06/17 13:43:10 UTC

Weighted Search by Field using MultiFieldQueryParser

I have an index that has three fields in it. When I do a search using
MultiFieldQueryParser, the search applies the same importance (weight)
to each of the fields. BUT, what if I want to apply a different weight
to each field, i.e. I want to consider found terms from certain fields
as less "important" than others. I have applied an algorithm to help me
do this, which involves searching each field separately and then
recombining the results into a single collection, but hate to reinvent
the wheel if I don't have to.

 

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kevin L Cobb, MT(ASCP), SCJP2

Senior Software Engineer

Emergint, Inc.

501 E Broadway, Suite 250

Louisville, KY 40202

Kevin.Cobb@emergint.com

502.852.1423

502.852.1589 fax

 

 

The preceding e-mail message and attachments, if any, contains
information that is confidential and qualifies as such under the
Definition of Confidential Information in the Non-Disclosure Agreement,
and may constitute non-public information and trade secrets. It is
intended to be conveyed only to the designated recipient(s). If you are
not an intended recipient of this message, please notify the sender at
502-852-1605. 

 


Re: Weighted Search by Field using MultiFieldQueryParser

Posted by Tatu Saloranta <ta...@hypermall.net>.
On Tuesday 17 June 2003 05:43, Kevin L. Cobb wrote:
> I have an index that has three fields in it. When I do a search using
> MultiFieldQueryParser, the search applies the same importance (weight)
> to each of the fields. BUT, what if I want to apply a different weight
> to each field, i.e. I want to consider found terms from certain fields
> as less "important" than others. I have applied an algorithm to help me
> do this, which involves searching each field separately and then
> recombining the results into a single collection, but hate to reinvent
> the wheel if I don't have to.

Have you looked at MultiFieldQueryParser source? It's a very simple class, and
modifying it (making a new class) should be easy; pass in not only field names 
but also weights to apply?
(as a sidenote, MultiFieldQueryParser does some unnecessary work as is... it 
seems to re-parse same query once for each field, could just clone it)

-+ Tatu +-



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


Re: Weighted Search by Field using MultiFieldQueryParser

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Didn't I reply to this yesterday?

--- "Kevin L. Cobb" <ke...@emergint.com> wrote:
> I have an index that has three fields in it. When I do a search using
> MultiFieldQueryParser, the search applies the same importance
> (weight)
> to each of the fields. BUT, what if I want to apply a different
> weight
> to each field, i.e. I want to consider found terms from certain
> fields
> as less "important" than others. I have applied an algorithm to help
> me
> do this, which involves searching each field separately and then
> recombining the results into a single collection, but hate to
> reinvent
> the wheel if I don't have to.
> 
>  
> 
>  
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Kevin L Cobb, MT(ASCP), SCJP2
> 
> Senior Software Engineer
> 
> Emergint, Inc.
> 
> 501 E Broadway, Suite 250
> 
> Louisville, KY 40202
> 
> Kevin.Cobb@emergint.com
> 
> 502.852.1423
> 
> 502.852.1589 fax
> 
>  
> 
>  
> 
> The preceding e-mail message and attachments, if any, contains
> information that is confidential and qualifies as such under the
> Definition of Confidential Information in the Non-Disclosure
> Agreement,
> and may constitute non-public information and trade secrets. It is
> intended to be conveyed only to the designated recipient(s). If you
> are
> not an intended recipient of this message, please notify the sender
> at
> 502-852-1605. 
> 
>  
> 
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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