getFieldBoostMap();
-}
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/MultiTermRewriteMethodAttribute.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/MultiTermRewriteMethodAttribute.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/MultiTermRewriteMethodAttribute.java (working copy)
@@ -1,40 +0,0 @@
-package org.apache.lucene.queryParser.standard.config;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
-import org.apache.lucene.queryParser.standard.processors.ParametricRangeQueryNodeProcessor;
-import org.apache.lucene.search.MultiTermQuery;
-import org.apache.lucene.search.MultiTermQuery.RewriteMethod;
-import org.apache.lucene.util.Attribute;
-
-/**
- * This attribute is used by {@link ParametricRangeQueryNodeProcessor} processor
- * and should be defined in the {@link QueryConfigHandler} used by this
- * processor. It basically tells the processor which {@link RewriteMethod} to
- * use.
- *
- */
-public interface MultiTermRewriteMethodAttribute extends Attribute {
-
- public static final String TAG_ID = "MultiTermRewriteMethodAttribute";
-
- public void setMultiTermRewriteMethod(MultiTermQuery.RewriteMethod method);
-
- public MultiTermQuery.RewriteMethod getMultiTermRewriteMethod();
-}
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java (working copy)
@@ -1,83 +0,0 @@
-package org.apache.lucene.queryParser.standard.config;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
-import org.apache.lucene.queryParser.standard.processors.AnalyzerQueryNodeProcessor;
-import org.apache.lucene.util.AttributeImpl;
-
-/**
- * This attribute is used by {@link AnalyzerQueryNodeProcessor} processor and
- * must be defined in the {@link QueryConfigHandler}. This attribute tells the
- * processor if the position increment is enabled.
- *
- * @see org.apache.lucene.queryParser.standard.config.PositionIncrementsAttribute
- */
-public class PositionIncrementsAttributeImpl extends AttributeImpl
- implements PositionIncrementsAttribute {
-
- private boolean positionIncrementsEnabled = false;
-
- public PositionIncrementsAttributeImpl() {
- positionIncrementsEnabled = false; //default in 2.4
- }
-
- public void setPositionIncrementsEnabled(boolean positionIncrementsEnabled) {
- this.positionIncrementsEnabled = positionIncrementsEnabled;
- }
-
- public boolean isPositionIncrementsEnabled() {
- return this.positionIncrementsEnabled;
- }
-
- @Override
- public void clear() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void copyTo(AttributeImpl target) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean equals(Object other) {
-
- if (other instanceof PositionIncrementsAttributeImpl
- && ((PositionIncrementsAttributeImpl) other).positionIncrementsEnabled == this.positionIncrementsEnabled) {
-
- return true;
-
- }
-
- return false;
-
- }
-
- @Override
- public int hashCode() {
- return this.positionIncrementsEnabled ? -1 : Integer.MAX_VALUE;
- }
-
- @Override
- public String toString() {
- return "";
- }
-
-}
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/MultiTermRewriteMethodProcessor.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/MultiTermRewriteMethodProcessor.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/MultiTermRewriteMethodProcessor.java (working copy)
@@ -22,7 +22,7 @@
import org.apache.lucene.queryParser.core.nodes.ParametricRangeQueryNode;
import org.apache.lucene.queryParser.core.nodes.QueryNode;
import org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl;
-import org.apache.lucene.queryParser.standard.config.MultiTermRewriteMethodAttribute;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler.ConfigurationKeys;
import org.apache.lucene.queryParser.standard.nodes.RegexpQueryNode;
import org.apache.lucene.queryParser.standard.nodes.WildcardQueryNode;
import org.apache.lucene.search.MultiTermQuery;
@@ -35,6 +35,8 @@
*/
public class MultiTermRewriteMethodProcessor extends QueryNodeProcessorImpl {
+ public static final String TAG_ID = "MultiTermRewriteMethodAttribute";
+
@Override
protected QueryNode postProcessNode(QueryNode node) {
@@ -42,22 +44,19 @@
// PrefixWildcardQueryNode
if (node instanceof WildcardQueryNode
|| node instanceof ParametricRangeQueryNode || node instanceof RegexpQueryNode) {
+
+ MultiTermQuery.RewriteMethod rewriteMethod = getQueryConfigHandler().get(ConfigurationKeys.MULTI_TERM_REWRITE_METHOD);
- if (!getQueryConfigHandler().hasAttribute(
- MultiTermRewriteMethodAttribute.class)) {
+ if (rewriteMethod == null) {
// This should not happen, this attribute is created in the
// StandardQueryConfigHandler
throw new IllegalArgumentException(
- "MultiTermRewriteMethodAttribute should be set on the QueryConfigHandler");
+ "MULTI_TERM_REWRITE_METHOD should be set on the QueryConfigHandler");
}
- // read the attribute value and use a TAG to take the value to the Builder
- MultiTermQuery.RewriteMethod rewriteMethod = getQueryConfigHandler()
- .getAttribute(MultiTermRewriteMethodAttribute.class)
- .getMultiTermRewriteMethod();
+ // use a TAG to take the value to the Builder
+ node.setTag(MultiTermRewriteMethodProcessor.TAG_ID, rewriteMethod);
- node.setTag(MultiTermRewriteMethodAttribute.TAG_ID, rewriteMethod);
-
}
return node;
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/processors/BooleanModifiersQueryNodeProcessor.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/processors/BooleanModifiersQueryNodeProcessor.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/processors/BooleanModifiersQueryNodeProcessor.java (working copy)
@@ -29,8 +29,9 @@
import org.apache.lucene.queryParser.core.nodes.ModifierQueryNode.Modifier;
import org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryParser.precedence.PrecedenceQueryParser;
-import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute;
-import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute.Operator;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler.ConfigurationKeys;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler.Operator;
/**
*
@@ -59,14 +60,14 @@
@Override
public QueryNode process(QueryNode queryTree) throws QueryNodeException {
-
- if (!getQueryConfigHandler().hasAttribute(DefaultOperatorAttribute.class)) {
+ Operator op = getQueryConfigHandler().get(ConfigurationKeys.DEFAULT_OPERATOR);
+
+ if (op == null) {
throw new IllegalArgumentException(
"DefaultOperatorAttribute should be set on the QueryConfigHandler");
}
- this.usingAnd = Operator.AND == getQueryConfigHandler().getAttribute(
- DefaultOperatorAttribute.class).getOperator();
+ this.usingAnd = StandardQueryConfigHandler.Operator.AND == op;
return super.process(queryTree);
Index: contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java
===================================================================
--- contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java (revision 1134981)
+++ contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java (working copy)
@@ -19,7 +19,6 @@
import java.io.IOException;
import java.io.Reader;
-import java.text.Collator;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -52,7 +51,7 @@
import org.apache.lucene.queryParser.core.nodes.QueryNode;
import org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryParser.core.processors.QueryNodeProcessorPipeline;
-import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute.Operator;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler;
import org.apache.lucene.queryParser.standard.nodes.WildcardQueryNode;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
@@ -195,7 +194,7 @@
StandardQueryParser qp = new StandardQueryParser();
qp.setAnalyzer(a);
- qp.setDefaultOperator(Operator.OR);
+ qp.setDefaultOperator(StandardQueryConfigHandler.Operator.OR);
return qp;
@@ -284,7 +283,7 @@
a = new MockAnalyzer(random, MockTokenizer.SIMPLE, true);
StandardQueryParser qp = new StandardQueryParser();
qp.setAnalyzer(a);
- qp.setDefaultOperator(Operator.AND);
+ qp.setDefaultOperator(StandardQueryConfigHandler.Operator.AND);
return qp.parse(query, "field");
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapFCListener.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapFCListener.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapFCListener.java (working copy)
@@ -17,9 +17,13 @@
* limitations under the License.
*/
+import java.util.Map;
+
import org.apache.lucene.queryParser.core.config.FieldConfig;
import org.apache.lucene.queryParser.core.config.FieldConfigListener;
import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler.ConfigurationKeys;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler.FieldConfigurationKeys;
/**
* This listener listens for every field configuration request and assign a
@@ -40,15 +44,14 @@
this.config = config;
}
- public void buildFieldConfig(FieldConfig fieldConfig) {
- if (this.config.hasAttribute(FieldBoostMapAttribute.class)) {
- FieldBoostMapAttribute fieldBoostMapAttr = this.config.getAttribute(FieldBoostMapAttribute.class);
- BoostAttribute boostAttr = fieldConfig.addAttribute(BoostAttribute.class);
-
- Float boost = fieldBoostMapAttr.getFieldBoostMap().get(fieldConfig.getField());
+ public void buildFieldConfig(FieldConfig fieldConfig) {
+ Map fieldBoostMap = this.config.get(ConfigurationKeys.FIELD_BOOST_MAP);
+
+ if (fieldBoostMap != null) {
+ Float boost = fieldBoostMap.get(fieldConfig.getField());
if (boost != null) {
- boostAttr.setBoost(boost.floatValue());
+ fieldConfig.set(FieldConfigurationKeys.BOOST, boost);
}
}
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/PrefixWildcardQueryNodeBuilder.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/PrefixWildcardQueryNodeBuilder.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/PrefixWildcardQueryNodeBuilder.java (working copy)
@@ -20,8 +20,8 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.core.QueryNodeException;
import org.apache.lucene.queryParser.core.nodes.QueryNode;
-import org.apache.lucene.queryParser.standard.config.MultiTermRewriteMethodAttribute;
import org.apache.lucene.queryParser.standard.nodes.PrefixWildcardQueryNode;
+import org.apache.lucene.queryParser.standard.processors.MultiTermRewriteMethodProcessor;
import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.PrefixQuery;
@@ -42,7 +42,7 @@
String text = wildcardNode.getText().subSequence(0, wildcardNode.getText().length() - 1).toString();
PrefixQuery q = new PrefixQuery(new Term(wildcardNode.getFieldAsString(), text));
- MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod)queryNode.getTag(MultiTermRewriteMethodAttribute.TAG_ID);
+ MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod)queryNode.getTag(MultiTermRewriteMethodProcessor.TAG_ID);
if (method != null) {
q.setRewriteMethod(method);
}
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/MultiFieldAttributeImpl.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/MultiFieldAttributeImpl.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/MultiFieldAttributeImpl.java (working copy)
@@ -1,84 +0,0 @@
-package org.apache.lucene.queryParser.standard.config;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.Arrays;
-
-import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
-import org.apache.lucene.queryParser.standard.processors.MultiFieldQueryNodeProcessor;
-import org.apache.lucene.util.AttributeImpl;
-
-/**
- * This attribute is used by {@link MultiFieldQueryNodeProcessor} processor and
- * must be defined in the {@link QueryConfigHandler}. This attribute tells the
- * processor to which fields the terms in the query should be expanded.
- *
- * @see org.apache.lucene.queryParser.standard.config.MultiFieldAttribute
- */
-public class MultiFieldAttributeImpl extends AttributeImpl
- implements MultiFieldAttribute {
-
- private CharSequence[] fields;
-
- public MultiFieldAttributeImpl() {
- // empty constructor
- }
-
- public void setFields(CharSequence[] fields) {
- this.fields = fields;
- }
-
- public CharSequence[] getFields() {
- return this.fields;
- }
-
- @Override
- public void clear() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void copyTo(AttributeImpl target) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean equals(Object other) {
-
- if (other instanceof MultiFieldAttributeImpl) {
- MultiFieldAttributeImpl fieldsAttr = (MultiFieldAttributeImpl) other;
-
- return Arrays.equals(this.fields, fieldsAttr.fields);
-
- }
-
- return false;
-
- }
-
- @Override
- public int hashCode() {
- return Arrays.hashCode(this.fields);
- }
-
- @Override
- public String toString() {
- return "";
- }
-
-}
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java (working copy)
@@ -26,7 +26,7 @@
* @see QueryConfigHandler
* @see org.apache.lucene.util.Attribute
*/
-public class FieldConfig extends AttributeSource {
+public class FieldConfig extends AbstractQueryConfig {
private String fieldName;
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttribute.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttribute.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttribute.java (working copy)
@@ -1,36 +0,0 @@
-package org.apache.lucene.queryParser.standard.config;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
-import org.apache.lucene.queryParser.standard.processors.PhraseSlopQueryNodeProcessor;
-import org.apache.lucene.util.Attribute;
-
-/**
- * This attribute is used by {@link PhraseSlopQueryNodeProcessor} processor and
- * must be defined in the {@link QueryConfigHandler}. This attribute tells the
- * processor what is the default phrase slop when no slop is defined in a
- * phrase.
- *
- */
-public interface FuzzyAttribute extends Attribute {
- public void setPrefixLength(int prefixLength);
- public int getPrefixLength();
- public void setFuzzyMinSimilarity(float minSimilarity);
- public float getFuzzyMinSimilarity();
-}
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/LowercaseExpandedTermsAttributeImpl.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/LowercaseExpandedTermsAttributeImpl.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/LowercaseExpandedTermsAttributeImpl.java (working copy)
@@ -1,85 +0,0 @@
-package org.apache.lucene.queryParser.standard.config;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.Locale;
-
-import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
-import org.apache.lucene.queryParser.standard.processors.ParametricRangeQueryNodeProcessor;
-import org.apache.lucene.util.AttributeImpl;
-
-/**
- * This attribute is used by processor {@link ParametricRangeQueryNodeProcessor}
- * and must be defined in the {@link QueryConfigHandler}. This attribute tells
- * the processor what is the default {@link Locale} used to parse a date.
- *
- * @see org.apache.lucene.queryParser.standard.config.LowercaseExpandedTermsAttribute
- */
-public class LowercaseExpandedTermsAttributeImpl extends AttributeImpl
- implements LowercaseExpandedTermsAttribute {
-
- private boolean lowercaseExpandedTerms = true;
-
- public LowercaseExpandedTermsAttributeImpl() {
- lowercaseExpandedTerms = true; // default in 2.4
- }
-
- public void setLowercaseExpandedTerms(boolean lowercaseExpandedTerms) {
- this.lowercaseExpandedTerms = lowercaseExpandedTerms;
- }
-
- public boolean isLowercaseExpandedTerms() {
- return this.lowercaseExpandedTerms;
- }
-
- @Override
- public void clear() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void copyTo(AttributeImpl target) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean equals(Object other) {
-
- if (other instanceof LowercaseExpandedTermsAttributeImpl
- && ((LowercaseExpandedTermsAttributeImpl) other).lowercaseExpandedTerms == this.lowercaseExpandedTerms) {
-
- return true;
-
- }
-
- return false;
-
- }
-
- @Override
- public int hashCode() {
- return this.lowercaseExpandedTerms ? -1 : Integer.MAX_VALUE;
- }
-
- @Override
- public String toString() {
- return "";
- }
-
-}
Index: contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/GroupQueryNodeProcessor.java
===================================================================
--- contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/GroupQueryNodeProcessor.java (revision 1134869)
+++ contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/GroupQueryNodeProcessor.java (working copy)
@@ -31,8 +31,9 @@
import org.apache.lucene.queryParser.core.nodes.ModifierQueryNode.Modifier;
import org.apache.lucene.queryParser.core.parser.SyntaxParser;
import org.apache.lucene.queryParser.core.processors.QueryNodeProcessor;
-import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute;
-import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute.Operator;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler.ConfigurationKeys;
+import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler.Operator;
import org.apache.lucene.queryParser.standard.nodes.BooleanModifierNode;
/**
@@ -64,14 +65,14 @@
}
public QueryNode process(QueryNode queryTree) throws QueryNodeException {
-
- if (!getQueryConfigHandler().hasAttribute(DefaultOperatorAttribute.class)) {
+ Operator defaultOperator = getQueryConfigHandler().get(ConfigurationKeys.DEFAULT_OPERATOR);
+
+ if (defaultOperator == null) {
throw new IllegalArgumentException(
- "DefaultOperatorAttribute should be set on the QueryConfigHandler");
+ "DEFAULT_OPERATOR should be set on the QueryConfigHandler");
}
- this.usingAnd = Operator.AND == getQueryConfigHandler()
- .getAttribute(DefaultOperatorAttribute.class).getOperator();
+ this.usingAnd = StandardQueryConfigHandler.Operator.AND == defaultOperator;
if (queryTree instanceof GroupQueryNode) {
queryTree = ((GroupQueryNode) queryTree).getChild();