如何在lucene查询字符串中使用聚合函数
我在我的应用程序中使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与 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 .
一种方法是使用包罗万象的字段,其中包含所有其他可搜索的文本字段(已实现
通过模式中的 copyField)
如果您希望在查询中进行聚合,则使用数据导入架构组合数据,将其放入一个字段中并在 defaultSearchField 中使用该字段
One way to do it is using catchall field, containing all other searchable text fields (implemented
via copyField in the schema)
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