0

I am now using solr autocomplete and search functions, I want to use the popularity of searched terms in ranking the autocomplete suggestions.

For example, if 'usb' was searched 10 times last week, and 'user' was searched 100 time last week, when typing 'us', user should be ranked higher than usb.

Is there any way to fulfill this requirement? Thanks

1 Answers1

0

In short, you need to use a Index time boosting to boost the value of a 'search queries index' - and periodically refresh it.

Lets you there is an index of all searched queries. That index can be created with an index time boost for each doc as a function of number of times searched. The boost factor could just be the number of times searched. https://wiki.apache.org/solr/SolrRelevancyFAQ#index-time_boosts

Eg. search queries - 'foo', 'foo', 'bar' , 'bar', 'bar' , 'abcd' will be added to a new index with 'foo' having a boost of 2,'bar' with 3, 'abcd' with 1.

You can do dynamic search on this index (starting with :) - and adding typed ahead characters to the query. The document score reflects the index time boost.

Eg. : will return docs with highest score first. After user types an 'f' - the term 'f*' returns 'foo' above others because of its higher index time boost.

I don't know 'terms component' behaves here. Its score is based on term frequency - not based on index time boost.

As you accumulate more search requests, you have to re-index with updated boost values that reflect the newer search counts.

Eg. if there is a new search for 'bar' - then you reindex 'bar' document with a boost of 4.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user1452132
  • 1,758
  • 11
  • 21