Skip to content

SOLR-18313: Prep for Lucene 11: switch two call sites to the newer Lucene API forms - #4651

Open
serhiy-bzhezytskyy wants to merge 1 commit into
apache:mainfrom
serhiy-bzhezytskyy:lucene11-prep-on-10x
Open

SOLR-18313: Prep for Lucene 11: switch two call sites to the newer Lucene API forms#4651
serhiy-bzhezytskyy wants to merge 1 commit into
apache:mainfrom
serhiy-bzhezytskyy:lucene11-prep-on-10x

Conversation

@serhiy-bzhezytskyy

@serhiy-bzhezytskyy serhiy-bzhezytskyy commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18313

Description

Lucene 11 removes two old API forms that Solr currently uses. Both have a replacement that already exists in the Lucene we're on today (10.4), so we can switch now with no behavior change, which shrinks the eventual Lucene 11 upgrade. Discussed on dev@ ("[EXPERIMENT] Upgrading Solr against Lucene main (the future 11.0)").

  1. Sort "missing value" (where docs without a value in the sort field are placed). Lucene 11 removes SortField.setMissingValue(...); the value must be passed to the SortField constructor instead. FieldType and EnumFieldType now compute the missing value and pass it into the constructor rather than setting it after construction. Missing values sort in the same place as before.
  2. Automaton concatenation in the reverse-wildcard query path. Lucene 11 removes Operations.concatenate(a, b) in favor of Operations.concatenate(List.of(a, b)). SolrQueryParserBase now uses the List form.

No functional change and nothing to reindex. The broader Lucene 11 port and the Java 25 baseline bump are deferred until Lucene 11 is released.

Solution

Replaced the two call sites with the Lucene 10.4 equivalents:

  • FieldType: extracted the missing-value computation into a small missingValue(...) helper and passed its result into the SortField / SortedSetSortField / SortedNumericSortField constructors (was: construct, then setMissingValue). EnumFieldType.getSortField rebuilds via the constructor when it needs its Integer.MIN_VALUE default.
  • SolrQueryParserBase: Operations.concatenate(a, b)Operations.concatenate(List.of(a, b)).

AI assistant disclosure: I used an AI coding assistant to help scope which Lucene 11 changes are already adoptable on 10.4 and to draft this change; I reviewed and verified all of it.

Tests

No new tests — this is a no-behavior-change refactor covered by existing tests. Ran ./gradlew check on current main (Lucene 10.4), plus the affected suites: TestFieldCacheSort, TestSort, EnumFieldTest, TestReversedWildcardFilterFactory, SolrIndexConfigTest — all green.

…cene API forms

Lucene 11 removes two old API forms Solr uses; both have a replacement that already
exists in Lucene 10.4 (what we're on). Switching now is a no-behavior-change cleanup
that shrinks the eventual Lucene 11 upgrade.

1. Sort missing value: Lucene 11 removes SortField.setMissingValue(...); the value must
   go to the constructor. FieldType/EnumFieldType now compute the missing value and pass
   it into the SortField constructor instead of setting it after construction. Missing
   values still sort in the same place.
2. Automaton concatenation: Lucene 11 removes Operations.concatenate(a, b) in favor of
   concatenate(List.of(a, b)). SolrQueryParserBase (reverse-wildcard handling) uses the List form.

No functional change, nothing to reindex. Discussed on dev@ ("[EXPERIMENT] Upgrading Solr
against Lucene main (the future 11.0)"). The broader Lucene 11 port and the Java 25 baseline
bump are deferred until Lucene 11 is released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants