Efficient implementation of faceted search in relational databases

后端 未结 4 2045
盖世英雄少女心
盖世英雄少女心 2020-12-23 17:51

I am trying to implement a Faceted search or tagging with multiple-tag filtering. In the faceted navigation, only not-empty categories are displayed and the number of items

4条回答
  •  时光取名叫无心
    2020-12-23 18:32

    Regarding the counts, why pull them via SQL? You'll have to iterate through the result set in your code anyway, so why not make your count there?

    I'm currently using this approach in a faceted search app I'm developing and it's working fine. The only tricky part is to setup your code to not output the facet until it reaches a new facet. At that time, output the facet and the number of rows you found for it.

    This approach assumes you're pulling back a list of all matching items, and thus, multiple rows with the same facet. When you order this result by facet it's easy to get the count in your code instead.

提交回复
热议问题