Datastore solution for tag search

前端 未结 3 1055
不知归路
不知归路 2021-02-06 12:23

I\'ve got millions of items ordered by a precomputed score. Each item has many boolean attributes. Let says that there is about ten thousand possible attributes totally, each

3条回答
  •  情话喂你
    2021-02-06 13:07

    Redis would be a perfect candidate for

    • "the top n items" for "millions of items ordered by score"

    Redis has a built in data structure that you can start from: Sorted Set => every member of a Sorted Set is associated with score. Which for example can be ranked by score with ZRANGEBYSCORE:

    ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
    

    I encourage you to look at Sorted Set commands and get a feel for Redis, as your problem (as it is stated) asks for it. You may of course keep as many attributes as you'd like within a single Set element.


    As far as MongoDB, since you mentioned millions, unless you can bent incremental queries to work for your problem, I would not expect a sub second response.

    As @nickdos mentioned Solr Relevancy is a quite powerful feature, but the number of attributes will be a problem, since it would need to keep all this attributes in memory for each item. Although a dozen for each may not be that bad => just try and see.

提交回复
热议问题