@@ -81,14 +81,12 @@ protected org.apache.lucene.search.Query getWildcardQuery(String field, String t
8181
8282 // For complex phrase queries, we need to ensure wildcard queries and automaton queries
8383 // use SCORING_BOOLEAN_REWRITE to avoid the new constant score wrappers in Lucene 10
84- if (q instanceof WildcardQuery ) {
85- WildcardQuery wq = (WildcardQuery ) q ;
84+ if (q instanceof WildcardQuery wq ) {
8685 return new WildcardQuery (
8786 wq .getTerm (),
8887 Operations .DEFAULT_DETERMINIZE_WORK_LIMIT ,
8988 MultiTermQuery .SCORING_BOOLEAN_REWRITE );
90- } else if (q instanceof AutomatonQuery ) {
91- AutomatonQuery aq = (AutomatonQuery ) q ;
89+ } else if (q instanceof AutomatonQuery aq ) {
9290 // For AutomatonQuery, we need to create a new one with the desired rewrite method
9391 // We can't access the term directly, but for reversed wildcard queries,
9492 // we can use a placeholder term since the automaton contains the actual matching logic
@@ -158,8 +156,7 @@ protected Query newWildcardQuery(org.apache.lucene.index.Term t) {
158156
159157 // In Lucene 10, we need to ensure wildcard queries use SCORING_BOOLEAN_REWRITE
160158 // for complex phrase queries to work properly
161- if (wildcardQuery instanceof WildcardQuery ) {
162- WildcardQuery wq = (WildcardQuery ) wildcardQuery ;
159+ if (wildcardQuery instanceof WildcardQuery wq ) {
163160 return new WildcardQuery (
164161 wq .getTerm (),
165162 Operations .DEFAULT_DETERMINIZE_WORK_LIMIT ,
0 commit comments