apache / apache/lucene

Improve LongRange execution for ranges that have min value as Long.MIN_VALUE and max value as Long.MAX_VALUE or min as 0, and max as 2^64-1

Open
#13,375 7 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

At Amazon Search, we came across a lot of client queries that were specifying the min value as 0, and the max value as Long.MAX_VALUE.

We don't use the associated ValueSourceQuery query internally, but use a custom logic for filtering.
An improvement here would be to rewrite ValueSourceQuery to a MatchAllDocsQuery if we detect that the min and max value are the same as the min and max value of Long.

I think we will have to check for something like (`minVal==0` and `maxVal==2^64-1`) or (`minVal==Long.MIN_VALUE` and `maxVal==Long.MAX_VALUE`) since we will have to cover both signed and unsigned cases.

We can implement similar logic for DoubleRange as well.

Contributor guide

Open the contributing guide

Research direction

Start by tracing LongRange and ValueSourceQuery handling for full signed and unsigned bounds. Check how the analogous DoubleRange logic is structured and identify the relevant tests or entry points. Done means full-range cases rewrite to MatchAllDocsQuery for both numeric range variants without changing narrower-range behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, search
Issue type
Feature
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.