开发者

Searching with Solr, Sphinx or Lucene - ranking search results by clicks

I 开发者_C百科want to implement a search that will rank results higher, if previous, similar searches have led users to click on a result.

Is that possible with either Solr (Lucene) or Sphinx?


I think, tracking of user clicks is necessary. (if the higher ranking depends on user clicks)

For "ranking higher" the results, maybe the solr-elevator function could be helpful for your needs: http://wiki.apache.org/solr/QueryElevationComponent

Probably the elevation-function is more helpful than the lucene boost function (in your case). http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Boosting%20a%20Term Finlay it depends of the kind of implementation, i think.


It's certainly possible with Solr (Lucene), but not really feasible. What you'd have to do is:

  1. Track the clicks of users
  2. Normalize the search query to group similar queries and store them
  3. Reindex that into Solr

If you ask me, that sounds like a lot of work with a lot of pitfalls.


With Sphinx you could use additional attribute clicks_count and use such query to rank clicked documents higher

SELECT *, clicks_count*1000 AS cc 
FROM your_index 
WHERE MATCH ("words to match") ORDER BY cc DESC;

to get only clicks wight into account

or

SELECT *, weght() + clicks_count*10000 AS cc 
FROM your_index 
WHERE MATCH ("words to match") ORDER BY cc DESC;

to get match weight with clicks weight into account

Of course you have update your counter 'clicks_count'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜