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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Marc Harding
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
Reply | Threaded
Open this post in threaded view
|

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

Jan Høydahl / Cominvent
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

Reply | Threaded
Open this post in threaded view
|

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

Marc Harding
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