apache / apache/lucene

Docvalues sorting treats empty values as the default [LUCENE-7548]

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

Description

I found this working on Solr, Mike suggested I raise it as a Lucene issue.

This was for int fields, I'll assume the same holds for other types.

The sort order is as though the null field was explicitly set to zero, the whole idea of sorting missing first is lost.

doc1
int_dv = 0
int_sort = 1

doc2
int_sort=2

doc3
int_dv = 0
int_sort=3

sort by int_dv asc,int_sort asc gives
doc1
doc2
doc3

when it should give
doc2
doc1
doc3

---
Migrated from [LUCENE-7548](https://issues.apache.org/jira/browse/LUCENE-7548) by Erick Erickson (@ErickErickson)
Linked issues:
- [SOLR-9166](https://issues.apache.org/jira/browse/SOLR-9166)

Contributor guide

Open the contributing guide

Research direction

No source file or test is identified in the issue. Start by reproducing the documented int_dv and int_sort example with ascending sorting, then trace the docvalues sorting path responsible for missing values. Done means missing values sort first, producing doc2, doc1, doc3, with equivalent behavior checked for the other types.

Written by the indexing model from the issue text.

Assessment

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