Solr:所有类别中的每一个

发布于 2024-11-30 00:13:44 字数 62 浏览 7 评论 0原文

我在 solr 有产品索引,产品有类别字段,我需要从每个类别中选择一个产品(最好是随机的),查询会是什么样子?

I have product index at solr, product has category field and I need to select one product (better would be random) from each category, how query would look like?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沒落の蓅哖 2024-12-07 00:13:44

如果您正在寻找 sql group by 功能,
从 solr 3.3 开始,
它具有类似的功能,称为 FieldCollapsing

字段折叠将一组具有相同字段值的结果折叠为单个(或固定数量)的条目。例如,大多数搜索引擎(例如 Google)会在网站上崩溃,因此仅显示一两个条目,以及单击以查看该网站的更多结果的链接。字段折叠还可用于抑制重复文档。

if you are looking for sql group by feature,
with solr 3.3 on-wards,
it has the similar feature called FieldCollapsing

Field Collapsing collapses a group of results with the same field value down to a single (or fixed number) of entries. For example, most search engines such as Google collapse on site so only one or two entries are shown, along with a link to click to see more results from that site. Field collapsing can also be used to suppress duplicate documents.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文