apache / apache/lucene

Make dynamic range facets value collection and sorting faster

Open
#13,760 11 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

`DynamicRangeUtil` [collects](https://github.com/apache/lucene/blob/02b37670e481679363e8ae5c245e5ed3cb0f10b6/lucene/facet/src/java/org/apache/lucene/facet/range/DynamicRangeUtil.java#L145) values from each segment and then [sorts](https://github.com/apache/lucene/blob/02b37670e481679363e8ae5c245e5ed3cb0f10b6/lucene/facet/src/java/org/apache/lucene/facet/range/DynamicRangeUtil.java#L213) all the values in the main thread. I wonder if we could get a speed-up from collecting values in each segment, sorting them (maybe doing insertion sort), and then merging the sorted values from all segments, effectively moving more of the work to the executor and doing less in the main thread.

Contributor guide

Open the contributing guide

Research direction

Start in lucene/facet/src/java/org/apache/lucene/facet/range/DynamicRangeUtil.java at the collection point around line 145 and sorting point around line 213. Trace how segment work is submitted to the executor, then evaluate segment-level sorting and merging of the results. Done means value collection and sorting are moved out of the main-thread bottleneck without changing dynamic range facet behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.