Datastore solution for tag search

前端 未结 3 1167
不知归路
不知归路 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:17

    This is exactly what Mongo can deal with. The fact that your attributes are boolean type helps here. A possible schema is listed below:

    [
        {
            true_tags:[attr1, attr2, attr3, ...],
            false_tags: [attr4, attr5, attr6, ...]
        },
    ]
    

    Then we can index on true_tags and false_tags. And it should be efficient to search with $in, $all, ... query operators.

提交回复
热议问题