From 91002d04d322f3ea6eebe31976da97e841b5999d Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 20 Dec 2023 14:24:54 +0100 Subject: [PATCH] Fix CheckIndex to correctly flag the automaton as binary. --- .../core/src/java/org/apache/lucene/index/CheckIndex.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java index a555ce40001c..f899b331b924 100644 --- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java +++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java @@ -2318,7 +2318,7 @@ private static Status.TermIndexStatus checkFields( startTerm = new BytesRef(); checkTermsIntersect(terms, automaton, startTerm); - automaton = Automata.makeAnyBinary(); + automaton = Automata.makeNonEmptyBinary(); startTerm = new BytesRef(new byte[] {'l'}); checkTermsIntersect(terms, automaton, startTerm); @@ -2369,8 +2369,8 @@ private static void checkTermsIntersect(Terms terms, Automaton automaton, BytesR throws IOException { TermsEnum allTerms = terms.iterator(); automaton = Operations.determinize(automaton, Operations.DEFAULT_DETERMINIZE_WORK_LIMIT); - CompiledAutomaton compiledAutomaton = new CompiledAutomaton(automaton); - ByteRunAutomaton runAutomaton = new ByteRunAutomaton(automaton); + CompiledAutomaton compiledAutomaton = new CompiledAutomaton(automaton, false, true, true); + ByteRunAutomaton runAutomaton = new ByteRunAutomaton(automaton, true); TermsEnum filteredTerms = terms.intersect(compiledAutomaton, startTerm); BytesRef term; if (startTerm != null) {