Hi Sebastien,

I think you want to boost product names that start with query term, right? Or 
in other words, boost if query term occurs within the first N words of a 
document.

SpanFirstQuery seems an elegant way to do it. 
https://issues.apache.org/jira/browse/SOLR-3925

Alternatively one can add an artificial token at the beginning of text. 

someArtificialToken TEST BLAHBLAH 


and use a phrase query to boost : "someArtificialToken queryTerm"~N

Ahmet
On Tuesday, January 14, 2014 7:13 PM, Sébastien LAMAISON <y...@hotmail.fr> 
wrote:
Hi all,
I'm almost new to SolR, and I have to make a improvment on a existing project, 
but despite some hours of searching, I'm stuck.
We have an index containing products, which the user can search by reference, 
or name.By now, when the user make a search by product name, the score is the 
same for all products containing the search string in the name.
For example, if the search string is "TEST", the following products have the 
same score : - BLAHBLAH TEST BLAH- TEST BLAHBLAH- BLAHBLAHBLAHBLAHBLAHBLAH TEST
My question is : how can I make TEST BLAHBLAH have a better score than BLAHBLAH 
TEST BLAH have a better score than BLAHBLAHBLAHBLAHBLAHBLAH TEST if the user 
search "TEST" ?
Thanks in advance.
Seb                          

Reply via email to