You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by fei dong <do...@gmail.com> on 2009/01/20 09:55:57 UTC

How to modify the revelance sorting in solr?

Hi guys:

I am going to build up a audio search based on solr. I worked out a
prototype like :

schema.xml:
   <field name="id" type="string" indexed="true" stored="true"
required="true" />
   <field name="artist" type="text" indexed="true" stored="true"/>
   <field name="album" type="text" indexed="true" stored="true"/>
   <field name="mp3_name" type="text" indexed="true" stored="true"/>
   <field name="links" type="sint" indexed="true" stored="true"/>

then import the data from mysql and add it to the index in XML format.

My problems are :
1 support a query language, "songname + artist " or "artist + album" or "
artist + album + songname", some guys would like to query like "because of
you ne-yo". So I need to cut words in the proper way. How to modify the way
of cutting words in solr ( recognize the song name or album or artist)

2 Revelance Sorting, in the matching result, the records whose album or
artist is the same as the query should be put ahead.  I find solr remove the
stop words and cut words into "because", "you", then the results like
"because I love you" , "because you loved me" are in the front. Another bad
case is some songs that lack artist information wghile get the riht song
name are sorting in the front. like
Results:1.id:602821artist:
album:
mp3:because of youlinks:1
2.id:612525artist:
album:
mp3:because of youlinks:1

 The principle is to match the total information as completely as possible
and the records which have more information should put ahead.  So how can I
add more weigh on term of album or artist and modify the strategy of
sorting. I am new in solr and really need help.

Regards,
Fei

Re: How to modify the revelance sorting in solr?

Posted by Chris Hostetter <ho...@fucit.org>.
: 1 support a query language, "songname + artist " or "artist + album" or "
: artist + album + songname", some guys would like to query like "because of
: you ne-yo". So I need to cut words in the proper way. How to modify the way
: of cutting words in solr ( recognize the song name or album or artist)

take a look at the dismax queryparser ... it will let you search for all 
of the words across various fields, and will let you specify in your 
configs how "significant" various fields should be in the score 
calculation.

as for spefici recognition of song name or album or artist -- that's a 
slightly harder problem.  if you can describe in words how you think a 
parser should go about figuring out which part of the query string 
corrisponds to which field, then you can express it in code as well, but 
there's no magic in any of hte existing solr query parsers to figure it 
out.

: stop words and cut words into "because", "you", then the results like
: "because I love you" , "because you loved me" are in the front. Another bad

stop words are a function of your analyzer -- customizer the analyzer you 
use in your field type and you can prevent this from happening





-Hoss