lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <iori...@yahoo.com>
Subject Re: Different weights to different fields
Date Tue, 02 Mar 2010 21:11:41 GMT

>     I'm new to Solr and just getting it set up
> and testing it out.  I'd like to know if there's a way
> to give a different weight to different data fields.
> 
> For an example, I'm going to be storing song
> information.  I have the fields: Artist, Title,
> Description, and Tags.  I'd like occurrences of the
> search term in Artist and Title to count more than the ones
> found in Description and Tags.  For instance, a search
> for Bruce Springsteen against all the fields should return
> the ones where artist=Bruce Springsteen higher than ones
> that just have that within the description.  Is this
> possible either in the indexing or with a query option?

You can do it in either query time or index time. In query time you can assign different boost
values with carat operator. 
e.g. Artist:(Bruce Springsteen)^10 Title:(Bruce Springsteen)^5

Also dismax[1] request handler might useful to you.

[1]http://wiki.apache.org/solr/DisMaxRequestHandler

At index time you can give different boost values to different fields. [2]
e.g. <field name="Artist" boost="10.0">

[2]http://wiki.apache.org/solr/UpdateXmlMessages#Optional_attributes_for_.22field.22


      

Mime
View raw message