apache / apache/lucene

Range faceting fails on SortedNumericDocValuesField [LUCENE-7044]

Open
#8,100 0 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

Hi,

Context: https://hibernate.atlassian.net/browse/HSEARCH-1927

By using `SortedNumericDocValuesField`, we can index several numeric values for the same field.

But we can't execute a range query on it using `LongRangeFacetCounts`.

Lucene fails with the following stacktrace:

```Java
java.lang.IllegalStateException: unexpected docvalues type SORTED_NUMERIC for field 'ingredients.price' (expected=NUMERIC). Use UninvertingReader or index with docvalues.
at org.apache.lucene.index.DocValues.checkField(DocValues.java:208)
at org.apache.lucene.index.DocValues.getNumeric(DocValues.java:227)
at org.apache.lucene.queries.function.valuesource.LongFieldSource.getValues(LongFieldSource.java:67)
at org.apache.lucene.facet.range.LongRangeFacetCounts.count(LongRangeFacetCounts.java:80)
at org.apache.lucene.facet.range.LongRangeFacetCounts.(LongRangeFacetCounts.java:69)
```

Either `LongRangeFacetCounts` needs some tweaking to accept `SORTED_NUMERIC` or we need another implementation to deal with `SortedNumericDocValuesField` (and probably an implementation of both for Doubles).


Guillaume

---
Migrated from [LUCENE-7044](https://issues.apache.org/jira/browse/LUCENE-7044) by Guillaume Smet (@gsmet), 1 vote

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with SortedNumericDocValuesField and read LongRangeFacetCounts, LongFieldSource, and the DocValues type check shown in the stack trace. The work is complete when range facet counting handles fields with multiple numeric values without the SORTED_NUMERIC versus NUMERIC failure.

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.