apache / apache/lucene

ParametricRangeQueryNodeProcessor uses incorrect logic at the lower bound [LUCENE-3353]

Open
#4,426 0 comments 0 reactions 0 assignees View on GitHub
affects-version:3.3 legacy-jira-priority:Major module:queryparser type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

ParametricRangeQueryNodeProcessor currently works as follows:

1. If the operator was LE or GE, set inclusive = true.
1. Set up a calendar
1. If inclusive, set the second time to 23:59:59:999
1. Convert that to a string using the DateResolution.

The problem is, this breaks for **exclusive** queries. For instance, if the user types in {20100110 TO 20100120} they would expect to get the 10th to the 20th exclusive, i.e. the 11th to the 19th. But in reality, the 10th will be **inclusive**.

To get an actually-exclusive range for the lower bound, the time should be set to 23:59:59:999, much the same as what is done for the inclusive upper bound.

I suspect the original query parser has the same issue, though possibly in different words.

---
Migrated from [LUCENE-3353](https://issues.apache.org/jira/browse/LUCENE-3353) by Trejkaz

Contributor guide

Open the contributing guide

Research direction

Locate ParametricRangeQueryNodeProcessor and trace how it handles the lower and upper bounds for date range queries. Reproduce the {20100110 TO 20100120} case and inspect the original query parser for the suspected parallel behavior. Done means exclusive lower bounds exclude the first day while inclusive upper bounds retain their expected end-of-day behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.