如何在lucene查询字符串中使用聚合函数

发布于 2024-12-29 03:16:36 字数 218 浏览 4 评论 0原文

我在我的应用程序中使用 apache lucene 进行索引和搜索。一切工作正常,现在我必须集成报告,为此我需要汇总值。我一直被困住,找不到在 lucene 搜索字符串 中使用聚合函数的方法,就像我们可以在 HQL 中非常轻松地使用它们一样!

在 lucene 搜索字符串中使用聚合函数的任何提示或方法?

I'm using apache lucene for indexing and searching in my application. Everything is working fine and now i've to integrate reporting and for that i need aggregate values. I've been stuck and couldn't find a way to use aggregate function in lucene search string like we can use them in HQL very easily!

Any hints or way around to use aggregate function in lucene search string?

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

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

发布评论

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

评论(2

王权女流氓 2025-01-05 03:16:36

与 HQL(和 SQL)不同,Lucene 查询语法不允许您检索聚合。但是,您可能对名为 faceting 的类似功能感兴趣,它可以让您检索您的类别计数询问 。

Unlike HQL (and SQL), Lucene query syntax does not let you retrieve aggregates. However, you might be interested in a somewhat similar feature called faceting which lets you retrieve category counts for your query .

忘你却要生生世世 2025-01-05 03:16:36

一种方法是使用包罗万象的字段,其中包含所有其他可搜索的文本字段(已实现
通过模式中的 copyField)

defaultSearchField 在不同聚合字段中搜索

如果您希望在查询中进行聚合,则使用数据导入架构组合数据,将其放入一个字段中并在 defaultSearchField 中使用该字段

One way to do it is using catchall field, containing all other searchable text fields (implemented
via copyField in the schema)

defaultSearchField to search within different aggregate fields

If you want aggregation in query then combine your data using the data-import schema ,put it in a field and use that field in the defaultSearchField

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