如何使用pysolr使用子面和骨料函数进行方面

发布于 2025-02-12 04:59:52 字数 449 浏览 1 评论 0原文

我有一个方面查询,但我想在facet.field已分组的数据上进行一笔求章。我有JSON Facet查询在浏览器中工作,但Pysolr没有运气。

import pysolr
import pprint

conn = pysolr.Solr('http://localhost:8080/solr/corename')
result = conn.search('*:*', **{
    'facet': 'true',
    'facet.type': 'terms',
    'facet.limit': 5,
    'facet.field': 'field_name',
    'f.results.facet.sum': '{!func}sum(daily_amount)'
})   

pprint.pprint(result.facets)

我想在pysolr中在一个特定的字段上进行总和吗?

I have a facet query working with count but I would like to do a sum on a field on the data already grouped by the facet.field. I have the json facet query working in the browser but no luck with PySolr.

import pysolr
import pprint

conn = pysolr.Solr('http://localhost:8080/solr/corename')
result = conn.search('*:*', **{
    'facet': 'true',
    'facet.type': 'terms',
    'facet.limit': 5,
    'facet.field': 'field_name',
    'f.results.facet.sum': '{!func}sum(daily_amount)'
})   

pprint.pprint(result.facets)

I would like to do a sum on a particualr field, is that possible in PySolr?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文