Align instanceof check with type cast (#13039)

This commit is contained in:
Dmitry Cherniachenko 2024-01-30 11:47:00 +01:00 committed by GitHub
parent 39c10a2929
commit 13ea880508
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 5 deletions

View File

@ -62,7 +62,7 @@ public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttrib
return true;
}
if (other instanceof PayloadAttribute) {
if (other instanceof PayloadAttributeImpl) {
PayloadAttributeImpl o = (PayloadAttributeImpl) other;
if (o.payload == null || payload == null) {
return o.payload == null && payload == null;

View File

@ -38,13 +38,11 @@ import org.apache.lucene.queryparser.flexible.core.nodes.NoTokenFoundQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QuotedFieldQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.RangeQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.TextableQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.TokenizedPhraseQueryNode;
import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler.ConfigurationKeys;
import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler.Operator;
import org.apache.lucene.queryparser.flexible.standard.nodes.MultiPhraseQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.SynonymQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.WildcardQueryNode;
@ -107,10 +105,9 @@ public class AnalyzerQueryNodeProcessor extends QueryNodeProcessorImpl {
@Override
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
if (node instanceof TextableQueryNode
if (node instanceof FieldQueryNode
&& !(node instanceof WildcardQueryNode)
&& !(node instanceof FuzzyQueryNode)
&& !(node instanceof RegexpQueryNode)
&& !(node.getParent() instanceof RangeQueryNode)) {
FieldQueryNode fieldNode = ((FieldQueryNode) node);