简体   繁体   中英

Group By in Lucene

Does Lucene support group by aggregations? Let's say I have an index with multiple employees with the fields name, job and salary. I want to get for each job the highest salary. Is there any way to get this information by using Lucene? In SQL I would get this information by SELECT job, MAX(salary) FROM employees GROUP BY job .

I'm using Lucene 7.4.0, the latest version and I know that typically people use Elasticsearch or Solr. However in my use case I have only an embedded Lucene.

you can you different collectors for this. See Grouping Javadoc documentation for more informations. I've never used it but it seems to be pretty powerful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM