Sort by term position, ignoring term freqs

Hello everyone! I want to do a search that allows me to sort the results depending on wether the terms that I am looking for are closer to the beggining of the text field, and ignore term frequency altogether.

So for example, if I have three documents:

GET /products/doc/1
{ 
"title" : "Laptop Lenovo" 
}

GET /products/doc/2
{ 
"title" : "HP Laptop" 
}

GET /products/doc/3
{ 
"title" : "Desk Stand Laptop"
 }

And I search "laptop", I want the order of the results to be: 1 , 2 , 3 , and this is ordered depending on the "position" of the word "laptop".

Now, reading the index_options documentations, it seems like I cannot ignore term_freqs without disabling term_position too, so what I tried to do is , I set up a "unique" filter on the "title" text field, so that when indexing, it doesnt matter how many times any word is, but this is still not giving me correct results.

How do I accomplish this?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.