开发者

How to deal with constantly changing data and SOLR indexes?

开发者 https://www.devze.com 2023-01-01 20:12 出处:网络
Afternoon guys, I\'m using a SOLR index for searching through items on my site. The search results contain an average rating of the item and an amount of comments the item has. The results can be so

Afternoon guys,

I'm using a SOLR index for searching through items on my site. The search results contain an average rating of the item and an amount of comments the item has. The results can be sorted by both rating and num of comments.

But obviously with the solr index, these numbers aren't updated until the db (2million~ rows) is reindexed (done nightly, probably).

What would you guys think is the best way开发者_如何学Python to approach this?


Well, i think you should change your db - index sync policy:

  • First approach: when commiting database changes also post changes (a batch of them) to indexes. You should write a mapper tier to map your domain objects to solr docs (remember, persists and if it goes ok then index -this works fine for us ;-)). If you want to achieve near real-time index updates you should see solutions like zoey (linkedin lucene-based searching framework)
  • Second approach: take a look around delta import (and program more frecuently index updates).
0

精彩评论

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