Reputation: 127
I am implementing search engine using Apache Solr. I want to improve results on the basis of most frequent searches.
For example: Consider my index has 5 words
Down 99
Drawn 46
Dark 86
Dull 75
Dirty 63
The numbers shows that how many times users searcded a particular word.
I want if a next user comes it and type D the response should be in descending order of previously searched and should be in order
Down
Dark
Dull
Dirty
Drawn
The results will change from time to time as word searched frequency will change after every search.. How can I implement this in Solr... Any help in this will help me a lot.
Thanking you in anticipation
Regards A.S.Danyal
Upvotes: 0
Views: 149
Reputation: 52792
As vinod writes, you'll have to keep track of actual searches yourself - there is nothing built-in to Solr to handle this for you. However, when you DO have the search statistics available, you can implement the feature by having a separate collection / core with searches and their popularity that you search against. Each document would be a search term and the frequency of how often that document is searched, i.e. document: search, search_count.
You can also use a logarithmic function to use the score of a search_count to affect the score of the search terms, for example if you have more than just the search as a field to influence the score (such as active category, etc.).
Depending on search volume, you probably don't need to update these values after each single search - just updating it once a day or every other hour will usually be good enough. Keep track of the terms that have changed in search volume since the last update, and update those documents in a batch job in certain intervals.
Upvotes: 1
Reputation: 1953
Solr doesn't provide this kind of feature.
One way to achieve this is by using logs, you will need to have an index of search terms entered. This can be built by mining your search logs.
Upvotes: 0