Sunspot - recreates records where matches occur at the beginning of the text

For example, let's say there is an entry in my database that contains the text "Hormel Corporation" , and my search term is "Hormel Corned Beef 16 Ounces" . Since my current configuration is worth it, the top results will be other entries, although "Hormel Corporation" is the one I am looking for. I think that the solution to my problem will be to give priority to reports where a match occurs at the beginning of the search. I read all the documents, but it's hard for me to understand how this can work.

I have only one field name. This is the name field for the entry I want read by Hormel Corporation, however when I look at Hornel Corned Beef 16 Ounces, the best result is that the ISNT Hormel Corporation is, but something seems to be random, and The entry I search is the third or fourth in the results.

Thanks a lot!

+4
source share
2 answers

I had a similar problem. Therefore, I saved my data in many fields:

 title keywords (upto 10 words) abstract (a paragraph) text (as long as you like) 

For queries, I used a parser query analyzer for fields with different weights:

 title^20 keywords^20 abstract^12 text^1 

So if you

  • well define data schema
  • use recycling
  • determine the weight of each field for your queries.

when you search for "Hornel Corned Beef 16 Ounces", the result, whose title "Hormel Corp" will work better, a document whose body contains "... For the dish we recommend a 16 oz bitter beef dish ..."


Change comments to OP.

OP fact: a heading of n words is given, the first n words are more important than the rest.

I propose a data model in which there are two fields: title_first_words and title . The client application (sorry, you cannot use DIH directly) must extract the first n words from the title to save in title_first_words , and the full title will be saved in title .

For search you can pass the entire request to the parser. Request parser - theb is shifted to title_first_words , like title_first_words^4 title^1 . Thus, the first n words will have a greater impact on this search.

+5
source

You tried to increase the meaning of each word in search terms, for example:

 Hormel^100 Corned^20 Beef^5 16^2 Ounces^1 
0
source

Source: https://habr.com/ru/post/1394247/


All Articles