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 Marc Harding <in...@marcharding.de> on 2010/08/22 15:06:06 UTC

Scoring of documents, boost partial and exact hits in one field

Hello,

i need some help adjusting the scoring of documents.

Assume i have two documents with only one field "title", fieldtype is
text (nothing changed), index and stored are true. Doc1's title is
"work", doc2's title is "work and workload". A search for "work" will
now return the following order: doc1, doc2.

I need the reverse order, because the term "work" is in "work" and
"workload", so doc2 has two matches (one partial) and should have a
higher score than doc1.

Can someone point me in the right direction to achieve that?

Thanks in advance,
Marc

Re: Scoring of documents, boost partial and exact hits in one field

Posted by Marc Harding <in...@marcharding.de>.
Hi,

thanks for your suggestion (so simple, why didn't i think of that).

When using AND i didn't get the desired result, probably because
"work" matches work* and work.

I changed the query to something like q=title:work OR title:work?* which works.

I'll have to try that with real documents/examples, but i think it
could work out.

Marc

Re: Scoring of documents, boost partial and exact hits in one field

Posted by Jan Høydahl / Cominvent <ja...@cominvent.com>.
Hi,

Try a wildcard term with lower score:

q=title:work AND title:work*&debugQuery=true

You will now see from the debug printout that you get an extra boost for workload.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Training in Europe - www.solrtraining.com

On 22. aug. 2010, at 15.06, Marc Harding wrote:

> Hello,
> 
> i need some help adjusting the scoring of documents.
> 
> Assume i have two documents with only one field "title", fieldtype is
> text (nothing changed), index and stored are true. Doc1's title is
> "work", doc2's title is "work and workload". A search for "work" will
> now return the following order: doc1, doc2.
> 
> I need the reverse order, because the term "work" is in "work" and
> "workload", so doc2 has two matches (one partial) and should have a
> higher score than doc1.
> 
> Can someone point me in the right direction to achieve that?
> 
> Thanks in advance,
> Marc