lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "luqun lou" <loulu...@hotmail.com>
Subject Re: MultiFieldQueryParser Problems about how to give the fields weight
Date Mon, 16 May 2005 01:35:08 GMT
How to boost it at indexing time?

>From: Otis Gospodnetic <otis_gospodnetic@yahoo.com>
>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 <louluqun@hotmail.com> 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: 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
>

_________________________________________________________________
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message