How to boost it at indexing time?

From: Otis Gospodnetic <[EMAIL PROTECTED]>
Reply-To: java-user@lucene.apache.org
To: java-user@lucene.apache.org
Subject: Re: MultiFieldQueryParser Problems about how to give the fields weight
Date: Wed, 11 May 2005 12:44:12 -0700 (PDT)


If you think content field is more important, you could boost it at
indexing time.  If you want to boost at search time, and you are using
QueryParser, you could just use the term^float syntax.  I think what
you have down there is ok, too, but I suppose you'd need an if/else so
you boost only the content field.

Otis

--- luqun lou <[EMAIL PROTECTED]> wrote:
>     Now Suppose,There are two fields,"content","summary",but i think
> the
> query in content field may have highter weight than the summary
> field. how
> can i do it?
>    I overload the parse function,and add weights which store every
> fields
> weights.
>     public static Query parse(String query,String[] fields,float []
> weights,Analyzer analyzer)
>     throws ParseException
>    {
>            BooleanQuery bQuery  = new BooleanQuery();
>            for(int i=0;i<fields.length;i++){
>                    Query q = parse(query,fields[i],analyzer);
>                    q.setBoost(weights[i]);
>                    bQuery.add(q,false,false);
>            }
>            return bQuery;
>     }
> is it right?
>
> _________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar - get it now!
> http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to