You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2011/09/08 18:47:51 UTC
svn commit: r1166789 - in /lucene/dev/trunk/modules/queryparser: ./
src/java/org/apache/lucene/queryparser/flexible/core/config/
src/java/org/apache/lucene/queryparser/flexible/core/nodes/
src/java/org/apache/lucene/queryparser/flexible/standard/builde...
Author: uschindler
Date: Thu Sep 8 16:47:50 2011
New Revision: 1166789
URL: http://svn.apache.org/viewvc?rev=1166789&view=rev
Log:
LUCENE-1768: Cleanup in trunk (removal of deprecated stuff, unused subclasses in between)
Added:
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/RangeQueryNode.java (with props)
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/TermRangeQueryNodeProcessor.java
- copied, changed from r1165858, lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/ParametricRangeQueryNodeProcessor.java
Modified:
lucene/dev/trunk/modules/queryparser/CHANGES.txt
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/package.html
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/ParametricQueryNode.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/ParametricRangeQueryNode.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/RangeQueryNodeBuilder.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/RangeQueryNode.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/OpenRangeQueryNodeProcessor.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/ParametricRangeQueryNodeProcessor.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.java
lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/WildcardQueryNodeProcessor.java
Modified: lucene/dev/trunk/modules/queryparser/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/CHANGES.txt?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/CHANGES.txt (original)
+++ lucene/dev/trunk/modules/queryparser/CHANGES.txt Thu Sep 8 16:47:50 2011
@@ -7,19 +7,19 @@ http://s.apache.org/luceneversions
Changes in runtime behavior
- * LUCENE-1768: StandardQueryTreeBuilder uses RangeQueryNodeBuilder for
- RangeQueryNodes, since theses two classes were removed;
- ParametricRangeQueryNodeProcessor now creates TermRangeQueryNode,
- instead of RangeQueryNode, from ParametricRangeQueryNode
+ * LUCENE-1768: StandardQueryTreeBuilder no longer uses RangeQueryNodeBuilder
+ for RangeQueryNodes, since theses two classes were removed;
+ TermRangeQueryNodeProcessor now creates TermRangeQueryNode,
+ instead of RangeQueryNode; the same applies for numeric nodes;
(Vinicius Barros via Uwe Schindler)
API Changes
- * LUCENE-1768: ParametricRangeQueryNode now implements
- RangeQueryNode<FieldQueryNode> instead of
- RangeQueryNode<ParametricQueryNode> (Vinicius Barros via Uwe Schindler)
+ * LUCENE-1768: Deprecated Parametric(Range)QueryNode, RangeQueryNode(Builder),
+ ParametricRangeQueryNodeProcessor were removed. (Vinicius Barros via Uwe Schindler)
Bug fixes
* LUCENE-2945: Fix hashCode/equals for surround query parser generated queries.
- (Paul Elschot, Simon Rosenthal, gsingers via ehatcher)
\ No newline at end of file
+ (Paul Elschot, Simon Rosenthal, gsingers via ehatcher)
+
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/package.html?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/package.html (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/package.html Thu Sep 8 16:47:50 2011
@@ -35,7 +35,7 @@ implementation.
<p>
The {@link org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler} and {@link org.apache.lucene.queryparser.flexible.core.config.FieldConfig} are used in the processors to access config
information in a flexible and independent way.
-See {@link org.apache.lucene.queryparser.flexible.standard.processors.ParametricRangeQueryNodeProcessor} for a
+See {@link org.apache.lucene.queryparser.flexible.standard.processors.TermRangeQueryNodeProcessor} for a
reference implementation.
</p>
</body>
Added: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/RangeQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/RangeQueryNode.java?rev=1166789&view=auto
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/RangeQueryNode.java (added)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/RangeQueryNode.java Thu Sep 8 16:47:50 2011
@@ -0,0 +1,36 @@
+package org.apache.lucene.queryparser.flexible.core.nodes;
+
+/**
+ * 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.
+ */
+
+ /**
+ * This interface should be implemented by a {@link QueryNode} that represents
+ * some kind of range query.
+ *
+ */
+public interface RangeQueryNode<T extends FieldValuePairQueryNode<?>> extends
+ FieldableNode {
+
+ T getLowerBound();
+
+ T getUpperBound();
+
+ boolean isLowerInclusive();
+
+ boolean isUpperInclusive();
+
+}
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html Thu Sep 8 16:47:50 2011
@@ -59,7 +59,7 @@ Grouping nodes:
<li>BoostQueryNode - used for boost operator</li>
<li>SlopQueryNode - phrase slop</li>
<li>FuzzyQueryNode - fuzzy node</li>
-<li>ParametricRangeQueryNode - used for parametric field:[low_value TO high_value]</li>
+<li>TermRangeQueryNode - used for parametric field:[low_value TO high_value]</li>
<li>ProximityQueryNode - used for proximity search</li>
<li>NumericRangeQueryNode - used for numeric range search</li>
<li>TokenizedPhraseQueryNode - used by tokenizers/lemmatizers/analyzers for phrases/autophrases</li>
@@ -72,7 +72,6 @@ Leaf Nodes:
<li>NumericQueryNode - used for numeric search</li>
<li>PathQueryNode - {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode} object used with path-like queries</li>
<li>OpaqueQueryNode - Used as for part of the query that can be parsed by other parsers. schema/value</li>
-<li>ParametricQueryNode - used for parametric field [>=|<=|=|<|>] value</li>
<li>PrefixWildcardQueryNode - non-phrase wildcard query</li>
<li>QuotedFieldQUeryNode - regular phrase node</li>
<li>WildcardQueryNode - non-phrase wildcard query</li>
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java Thu Sep 8 16:47:50 2011
@@ -23,16 +23,18 @@ import org.apache.lucene.queryparser.fle
import org.apache.lucene.queryparser.flexible.core.nodes.FieldableNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl;
+import org.apache.lucene.queryparser.flexible.core.nodes.RangeQueryNode;
import org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax;
import org.apache.lucene.queryparser.flexible.core.util.StringUtils;
/**
- * This class should be extended by nodes intending to represent range queries.
- *
- * @param <T> the type of the range query bounds (lower and upper)
+ * This class should be extended by nodes intending to represent range queries.
+ *
+ * @param <T>
+ * the type of the range query bounds (lower and upper)
*/
-public abstract class AbstractRangeQueryNode<T extends FieldValuePairQueryNode<?>>
- extends QueryNodeImpl implements FieldableNode {
+public class AbstractRangeQueryNode<T extends FieldValuePairQueryNode<?>>
+ extends QueryNodeImpl implements RangeQueryNode<FieldValuePairQueryNode<?>> {
private boolean lowerInclusive, upperInclusive;
@@ -145,8 +147,9 @@ public abstract class AbstractRangeQuery
String lowerField = StringUtils.toString(lower.getField());
String upperField = StringUtils.toString(upper.getField());
- if ((upperField == null && lowerField == null)
- || (upperField != null && !upperField.equals(lowerField))) {
+ if ((upperField != null || lowerField != null)
+ && ((upperField != null && !upperField.equals(lowerField)) || !lowerField
+ .equals(upperField))) {
throw new IllegalArgumentException(
"lower and upper bounds should have the same field name!");
}
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java Thu Sep 8 16:47:50 2011
@@ -33,13 +33,12 @@ import org.apache.lucene.queryparser.fle
import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.GroupQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode;
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.parser.SyntaxParser;
+import org.apache.lucene.queryparser.flexible.standard.nodes.TermRangeQueryNode;
public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserConstants {
@@ -309,7 +308,8 @@ public class StandardSyntaxParser implem
final public QueryNode Clause(CharSequence field) throws ParseException {
QueryNode q;
Token fieldToken=null, boost=null, operator=null, term=null;
- ParametricQueryNode qLower, qUpper;
+ FieldQueryNode qLower, qUpper;
+ boolean lowerInclusive, upperInclusive;
boolean group = false;
if (jj_2_2(3)) {
@@ -375,33 +375,46 @@ public class StandardSyntaxParser implem
}
switch (operator.kind) {
case OP_LESSTHAN:
- qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+ lowerInclusive = true;
+ upperInclusive = false;
+
+ qLower = new FieldQueryNode(field,
"*", term.beginColumn, term.endColumn);
- qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LT,
- EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+ qUpper = new FieldQueryNode(field,
+ EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+
break;
case OP_LESSTHANEQ:
- qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+ lowerInclusive = true;
+ upperInclusive = true;
+
+ qLower = new FieldQueryNode(field,
"*", term.beginColumn, term.endColumn);
- qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+ qUpper = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
break;
case OP_MORETHAN:
- qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GT,
+ lowerInclusive = false;
+ upperInclusive = true;
+
+ qLower = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
- qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+ qUpper = new FieldQueryNode(field,
"*", term.beginColumn, term.endColumn);
break;
case OP_MORETHANEQ:
- qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+ lowerInclusive = true;
+ upperInclusive = true;
+
+ qLower = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
- qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+ qUpper = new FieldQueryNode(field,
"*", term.beginColumn, term.endColumn);
break;
default:
{if (true) throw new Error("Unhandled case: operator="+operator.toString());}
}
- q = new ParametricRangeQueryNode(qLower, qUpper);
+ q = new TermRangeQueryNode(qLower, qUpper, lowerInclusive, upperInclusive);
break;
default:
jj_la1[10] = jj_gen;
@@ -497,7 +510,7 @@ public class StandardSyntaxParser implem
boolean startInc=false;
boolean endInc=false;
QueryNode q =null;
- ParametricQueryNode qLower, qUpper;
+ FieldQueryNode qLower, qUpper;
float defaultMinSimilarity = org.apache.lucene.search.FuzzyQuery.defaultMinSimilarity;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case TERM:
@@ -638,11 +651,11 @@ public class StandardSyntaxParser implem
goop2.image = goop2.image.substring(1, goop2.image.length()-1);
}
- qLower = new ParametricQueryNode(field, startInc ? ParametricQueryNode.CompareOperator.GE : ParametricQueryNode.CompareOperator.GT,
+ qLower = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(goop1.image), goop1.beginColumn, goop1.endColumn);
- qUpper = new ParametricQueryNode(field, endInc ? ParametricQueryNode.CompareOperator.LE : ParametricQueryNode.CompareOperator.LT,
+ qUpper = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(goop2.image), goop2.beginColumn, goop2.endColumn);
- q = new ParametricRangeQueryNode(qLower, qUpper);
+ q = new TermRangeQueryNode(qLower, qUpper, startInc ? true : false, endInc ? true : false);
break;
case QUOTED:
term = jj_consume_token(QUOTED);
@@ -726,8 +739,16 @@ public class StandardSyntaxParser implem
return false;
}
- private boolean jj_3R_10() {
- if (jj_scan_token(TERM)) return true;
+ private boolean jj_3R_6() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_7()) {
+ jj_scanpos = xsp;
+ if (jj_3R_8()) {
+ jj_scanpos = xsp;
+ if (jj_3R_9()) return true;
+ }
+ }
return false;
}
@@ -742,6 +763,11 @@ public class StandardSyntaxParser implem
return false;
}
+ private boolean jj_3R_10() {
+ if (jj_scan_token(TERM)) return true;
+ return false;
+ }
+
private boolean jj_3R_12() {
if (jj_scan_token(RANGEIN_START)) return true;
return false;
@@ -786,24 +812,6 @@ public class StandardSyntaxParser implem
return false;
}
- private boolean jj_3R_9() {
- if (jj_scan_token(QUOTED)) return true;
- return false;
- }
-
- private boolean jj_3R_6() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_7()) {
- jj_scanpos = xsp;
- if (jj_3R_8()) {
- jj_scanpos = xsp;
- if (jj_3R_9()) return true;
- }
- }
- return false;
- }
-
private boolean jj_3R_5() {
Token xsp;
xsp = jj_scanpos;
@@ -828,6 +836,11 @@ public class StandardSyntaxParser implem
return false;
}
+ private boolean jj_3R_9() {
+ if (jj_scan_token(QUOTED)) return true;
+ return false;
+ }
+
/** Generated Token Manager. */
public StandardSyntaxParserTokenManager token_source;
JavaCharStream jj_input_stream;
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj Thu Sep 8 16:47:50 2011
@@ -45,13 +45,12 @@ import org.apache.lucene.queryparser.fle
import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.GroupQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode;
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.parser.SyntaxParser;
+import org.apache.lucene.queryparser.flexible.standard.nodes.TermRangeQueryNode;
public class StandardSyntaxParser implements SyntaxParser {
@@ -328,7 +327,8 @@ QueryNode ModClause(CharSequence field)
QueryNode Clause(CharSequence field) : {
QueryNode q;
Token fieldToken=null, boost=null, operator=null, term=null;
- ParametricQueryNode qLower, qUpper;
+ FieldQueryNode qLower, qUpper;
+ boolean lowerInclusive, upperInclusive;
boolean group = false;
}
@@ -344,33 +344,46 @@ QueryNode Clause(CharSequence field) : {
}
switch (operator.kind) {
case OP_LESSTHAN:
- qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+ lowerInclusive = true;
+ upperInclusive = false;
+
+ qLower = new FieldQueryNode(field,
"*", term.beginColumn, term.endColumn);
- qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LT,
- EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+ qUpper = new FieldQueryNode(field,
+ EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+
break;
case OP_LESSTHANEQ:
- qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+ lowerInclusive = true;
+ upperInclusive = true;
+
+ qLower = new FieldQueryNode(field,
"*", term.beginColumn, term.endColumn);
- qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+ qUpper = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
break;
case OP_MORETHAN:
- qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GT,
+ lowerInclusive = false;
+ upperInclusive = true;
+
+ qLower = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
- qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+ qUpper = new FieldQueryNode(field,
"*", term.beginColumn, term.endColumn);
break;
case OP_MORETHANEQ:
- qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+ lowerInclusive = true;
+ upperInclusive = true;
+
+ qLower = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
- qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+ qUpper = new FieldQueryNode(field,
"*", term.beginColumn, term.endColumn);
break;
default:
throw new Error("Unhandled case: operator="+operator.toString());
}
- q = new ParametricRangeQueryNode(qLower, qUpper);
+ q = new TermRangeQueryNode(qLower, qUpper, lowerInclusive, upperInclusive);
}
)
| [
@@ -411,7 +424,7 @@ QueryNode Term(CharSequence field) : {
boolean startInc=false;
boolean endInc=false;
QueryNode q =null;
- ParametricQueryNode qLower, qUpper;
+ FieldQueryNode qLower, qUpper;
float defaultMinSimilarity = org.apache.lucene.search.FuzzyQuery.defaultMinSimilarity;
}
{
@@ -453,11 +466,11 @@ QueryNode Term(CharSequence field) : {
goop2.image = goop2.image.substring(1, goop2.image.length()-1);
}
- qLower = new ParametricQueryNode(field, startInc ? ParametricQueryNode.CompareOperator.GE : ParametricQueryNode.CompareOperator.GT,
+ qLower = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(goop1.image), goop1.beginColumn, goop1.endColumn);
- qUpper = new ParametricQueryNode(field, endInc ? ParametricQueryNode.CompareOperator.LE : ParametricQueryNode.CompareOperator.LT,
+ qUpper = new FieldQueryNode(field,
EscapeQuerySyntaxImpl.discardEscapeChar(goop2.image), goop2.beginColumn, goop2.endColumn);
- q = new ParametricRangeQueryNode(qLower, qUpper);
+ q = new TermRangeQueryNode(qLower, qUpper, startInc ? true : false, endInc ? true : false);
}
| term=<QUOTED> {q = new QuotedFieldQueryNode(field, EscapeQuerySyntaxImpl.discardEscapeChar(term.image.substring(1, term.image.length()-1)), term.beginColumn + 1, term.endColumn - 1);}
[ fuzzySlop=<FUZZY_SLOP> ]
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java Thu Sep 8 16:47:50 2011
@@ -31,13 +31,12 @@ import org.apache.lucene.queryparser.fle
import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.GroupQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode;
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.parser.SyntaxParser;
+import org.apache.lucene.queryparser.flexible.standard.nodes.TermRangeQueryNode;
/** Token Manager. */
public class StandardSyntaxParserTokenManager implements StandardSyntaxParserConstants
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java Thu Sep 8 16:47:50 2011
@@ -34,9 +34,9 @@ import org.apache.lucene.queryparser.fle
import org.apache.lucene.queryparser.flexible.core.nodes.FuzzyQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.GroupQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.NoTokenFoundQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
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;
@@ -50,7 +50,7 @@ import org.apache.lucene.queryparser.fle
* is defined in the {@link QueryConfigHandler}. If it is and the analyzer is
* not <code>null</code>, it looks for every {@link FieldQueryNode} that is not
* {@link WildcardQueryNode}, {@link FuzzyQueryNode} or
- * {@link ParametricQueryNode} contained in the query node tree, then it applies
+ * {@link RangeQueryNode} contained in the query node tree, then it applies
* the analyzer to that {@link FieldQueryNode} object. <br/>
* <br/>
* If the analyzer return only one term, the returned term is set to the
@@ -106,7 +106,7 @@ public class AnalyzerQueryNodeProcessor
if (node instanceof TextableQueryNode
&& !(node instanceof WildcardQueryNode)
&& !(node instanceof FuzzyQueryNode)
- && !(node instanceof ParametricQueryNode)) {
+ && !(node.getParent() instanceof RangeQueryNode)) {
FieldQueryNode fieldNode = ((FieldQueryNode) node);
String text = fieldNode.getTextAsString();
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java Thu Sep 8 16:47:50 2011
@@ -21,9 +21,10 @@ import java.util.List;
import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler;
+import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.FuzzyQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
+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.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryparser.flexible.core.util.UnescapedCharSequence;
@@ -36,7 +37,7 @@ import org.apache.lucene.queryparser.fle
* {@link ConfigurationKeys#LOWERCASE_EXPANDED_TERMS} is defined in the
* {@link QueryConfigHandler}. If it is and the expanded terms should be
* lower-cased, it looks for every {@link WildcardQueryNode},
- * {@link FuzzyQueryNode} and {@link ParametricQueryNode} and lower-case its
+ * {@link FuzzyQueryNode} and children of a {@link RangeQueryNode} and lower-case its
* term. <br/>
*
* @see ConfigurationKeys#LOWERCASE_EXPANDED_TERMS
@@ -63,8 +64,10 @@ public class LowercaseExpandedTermsQuery
@Override
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
- if (node instanceof WildcardQueryNode || node instanceof FuzzyQueryNode
- || node instanceof ParametricQueryNode || node instanceof RegexpQueryNode) {
+ if (node instanceof WildcardQueryNode
+ || node instanceof FuzzyQueryNode
+ || (node instanceof FieldQueryNode && node.getParent() instanceof RangeQueryNode)
+ || node instanceof RegexpQueryNode) {
TextableQueryNode txtNode = (TextableQueryNode) node;
CharSequence text = txtNode.getText();
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java Thu Sep 8 16:47:50 2011
@@ -28,9 +28,8 @@ import org.apache.lucene.queryparser.fle
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler;
import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
+import org.apache.lucene.queryparser.flexible.core.nodes.RangeQueryNode;
import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryparser.flexible.standard.config.NumericConfig;
import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler.ConfigurationKeys;
@@ -46,11 +45,11 @@ import org.apache.lucene.queryparser.fle
* {@link FieldQueryNode} to be a numeric query and convert it to
* {@link NumericRangeQueryNode} with upper and lower inclusive and lower and
* upper equals to the value represented by the {@link FieldQueryNode} converted
- * to {@link Number}. It means that <b>field:1</b> is converted to <b>field:[1 TO
- * 1]</b>. <br/>
+ * to {@link Number}. It means that <b>field:1</b> is converted to <b>field:[1
+ * TO 1]</b>. <br/>
* <br/>
- * Note that {@link ParametricQueryNode}s are ignored, even being a
- * {@link FieldQueryNode}.
+ * Note that {@link FieldQueryNode}s children of a
+ * {@link RangeQueryNode} are ignored.
*
* @see ConfigurationKeys#NUMERIC_CONFIG
* @see FieldQueryNode
@@ -70,7 +69,7 @@ public class NumericQueryNodeProcessor e
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
if (node instanceof FieldQueryNode
- && !(node.getParent() instanceof ParametricRangeQueryNode)) {
+ && !(node.getParent() instanceof RangeQueryNode)) {
QueryConfigHandler config = getQueryConfigHandler();
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java Thu Sep 8 16:47:50 2011
@@ -27,28 +27,27 @@ import org.apache.lucene.queryparser.fle
import org.apache.lucene.queryparser.flexible.core.config.FieldConfig;
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler;
import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
+import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode.CompareOperator;
import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryparser.flexible.core.util.StringUtils;
import org.apache.lucene.queryparser.flexible.standard.config.NumericConfig;
import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler.ConfigurationKeys;
import org.apache.lucene.queryparser.flexible.standard.nodes.NumericQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.NumericRangeQueryNode;
+import org.apache.lucene.queryparser.flexible.standard.nodes.TermRangeQueryNode;
/**
- * This processor is used to convert {@link ParametricRangeQueryNode}s to
+ * This processor is used to convert {@link TermRangeQueryNode}s to
* {@link NumericRangeQueryNode}s. It looks for
* {@link ConfigurationKeys#NUMERIC_CONFIG} set in the {@link FieldConfig} of
- * every {@link ParametricRangeQueryNode} found. If
+ * every {@link TermRangeQueryNode} found. If
* {@link ConfigurationKeys#NUMERIC_CONFIG} is found, it considers that
- * {@link ParametricRangeQueryNode} to be a numeric range query and convert it to
+ * {@link TermRangeQueryNode} to be a numeric range query and convert it to
* {@link NumericRangeQueryNode}.
*
* @see ConfigurationKeys#NUMERIC_CONFIG
- * @see ParametricRangeQueryNode
+ * @see TermRangeQueryNode
* @see NumericConfig
* @see NumericRangeQueryNode
*/
@@ -64,13 +63,13 @@ public class NumericRangeQueryNodeProces
@Override
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
- if (node instanceof ParametricRangeQueryNode) {
+ if (node instanceof TermRangeQueryNode) {
QueryConfigHandler config = getQueryConfigHandler();
if (config != null) {
- ParametricRangeQueryNode parametricRangeNode = (ParametricRangeQueryNode) node;
+ TermRangeQueryNode termRangeNode = (TermRangeQueryNode) node;
FieldConfig fieldConfig = config.getFieldConfig(StringUtils
- .toString(parametricRangeNode.getField()));
+ .toString(termRangeNode.getField()));
if (fieldConfig != null) {
@@ -79,8 +78,8 @@ public class NumericRangeQueryNodeProces
if (numericConfig != null) {
- ParametricQueryNode lower = parametricRangeNode.getLowerBound();
- ParametricQueryNode upper = parametricRangeNode.getUpperBound();
+ FieldQueryNode lower = termRangeNode.getLowerBound();
+ FieldQueryNode upper = termRangeNode.getUpperBound();
String lowerText = lower.getTextAsString();
String upperText = upper.getTextAsString();
@@ -134,14 +133,12 @@ public class NumericRangeQueryNodeProces
}
NumericQueryNode lowerNode = new NumericQueryNode(
- parametricRangeNode.getField(), lowerNumber, numberFormat);
+ termRangeNode.getField(), lowerNumber, numberFormat);
NumericQueryNode upperNode = new NumericQueryNode(
- parametricRangeNode.getField(), upperNumber, numberFormat);
+ termRangeNode.getField(), upperNumber, numberFormat);
- boolean upperInclusive = upper == null
- | upper.getOperator() == CompareOperator.LE;
- boolean lowerInclusive = lower == null
- | lower.getOperator() == CompareOperator.GE;
+ boolean lowerInclusive = termRangeNode.isLowerInclusive();
+ boolean upperInclusive = termRangeNode.isUpperInclusive();
return new NumericRangeQueryNode(lowerNode, upperNode,
lowerInclusive, upperInclusive, numericConfig);
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/OpenRangeQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/OpenRangeQueryNodeProcessor.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/OpenRangeQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/OpenRangeQueryNodeProcessor.java Thu Sep 8 16:47:50 2011
@@ -3,11 +3,11 @@ package org.apache.lucene.queryparser.fl
import java.util.List;
import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
+import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryparser.flexible.core.util.UnescapedCharSequence;
+import org.apache.lucene.queryparser.flexible.standard.nodes.TermRangeQueryNode;
public class OpenRangeQueryNodeProcessor extends QueryNodeProcessorImpl {
@@ -18,10 +18,10 @@ public class OpenRangeQueryNodeProcessor
@Override
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
- if (node instanceof ParametricRangeQueryNode) {
- ParametricRangeQueryNode rangeNode = (ParametricRangeQueryNode) node;
- ParametricQueryNode lowerNode = (ParametricQueryNode) rangeNode.getLowerBound();
- ParametricQueryNode upperNode = (ParametricQueryNode) rangeNode.getUpperBound();
+ if (node instanceof TermRangeQueryNode) {
+ TermRangeQueryNode rangeNode = (TermRangeQueryNode) node;
+ FieldQueryNode lowerNode = (FieldQueryNode) rangeNode.getLowerBound();
+ FieldQueryNode upperNode = (FieldQueryNode) rangeNode.getUpperBound();
CharSequence lowerText = lowerNode.getText();
CharSequence upperText = upperNode.getText();
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.java Thu Sep 8 16:47:50 2011
@@ -56,7 +56,7 @@ public class StandardQueryNodeProcessorP
add(new NumericQueryNodeProcessor());
add(new NumericRangeQueryNodeProcessor());
add(new LowercaseExpandedTermsQueryNodeProcessor());
- add(new ParametricRangeQueryNodeProcessor());
+ add(new TermRangeQueryNodeProcessor());
add(new AllowLeadingWildcardProcessor());
add(new AnalyzerQueryNodeProcessor());
add(new PhraseSlopQueryNodeProcessor());
Copied: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/TermRangeQueryNodeProcessor.java (from r1165858, lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/ParametricRangeQueryNodeProcessor.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/TermRangeQueryNodeProcessor.java?p2=lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/TermRangeQueryNodeProcessor.java&p1=lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/ParametricRangeQueryNodeProcessor.java&r1=1165858&r2=1166789&rev=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/ParametricRangeQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/TermRangeQueryNodeProcessor.java Thu Sep 8 16:47:50 2011
@@ -28,21 +28,18 @@ import org.apache.lucene.document.DateTo
import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
import org.apache.lucene.queryparser.flexible.core.config.FieldConfig;
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
+import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode.CompareOperator;
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.nodes.TermRangeQueryNode;
/**
- * This processor converts {@link ParametricRangeQueryNode} objects to
- * {@link TermRangeQueryNode} objects. It reads the lower and upper bounds value
- * from the {@link ParametricRangeQueryNode} object and try to parse their
- * values using a {@link DateFormat}. If the values cannot be parsed to a date
- * value, it will only create the {@link TermRangeQueryNode} using the
- * non-parsed values. <br/>
+ * This processors process {@link TermRangeQueryNode}s. It reads the lower and
+ * upper bounds value from the {@link TermRangeQueryNode} object and try
+ * to parse their values using a {@link DateFormat}. If the values cannot be
+ * parsed to a date value, it will only create the {@link TermRangeQueryNode}
+ * using the non-parsed values. <br/>
* <br/>
* If a {@link ConfigurationKeys#LOCALE} is defined in the
* {@link QueryConfigHandler} it will be used to parse the date, otherwise
@@ -56,21 +53,20 @@ import org.apache.lucene.queryparser.fle
* @see ConfigurationKeys#DATE_RESOLUTION
* @see ConfigurationKeys#LOCALE
* @see TermRangeQueryNode
- * @see ParametricRangeQueryNode
*/
-public class ParametricRangeQueryNodeProcessor extends QueryNodeProcessorImpl {
+public class TermRangeQueryNodeProcessor extends QueryNodeProcessorImpl {
- public ParametricRangeQueryNodeProcessor() {
+ public TermRangeQueryNodeProcessor() {
// empty constructor
}
@Override
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
- if (node instanceof ParametricRangeQueryNode) {
- ParametricRangeQueryNode parametricRangeNode = (ParametricRangeQueryNode) node;
- ParametricQueryNode upper = parametricRangeNode.getUpperBound();
- ParametricQueryNode lower = parametricRangeNode.getLowerBound();
+ if (node instanceof TermRangeQueryNode) {
+ TermRangeQueryNode termRangeNode = (TermRangeQueryNode) node;
+ FieldQueryNode upper = termRangeNode.getUpperBound();
+ FieldQueryNode lower = termRangeNode.getLowerBound();
DateTools.Resolution dateRes = null;
boolean inclusive = false;
@@ -80,7 +76,7 @@ public class ParametricRangeQueryNodePro
locale = Locale.getDefault();
}
- CharSequence field = parametricRangeNode.getField();
+ CharSequence field = termRangeNode.getField();
String fieldStr = null;
if (field != null) {
@@ -94,7 +90,7 @@ public class ParametricRangeQueryNodePro
dateRes = fieldConfig.get(ConfigurationKeys.DATE_RESOLUTION);
}
- if (upper.getOperator() == CompareOperator.LE) {
+ if (termRangeNode.isUpperInclusive()) {
inclusive = true;
}
@@ -136,10 +132,6 @@ public class ParametricRangeQueryNodePro
// do nothing
}
- return new TermRangeQueryNode(lower, upper, part1.length() == 0
- | lower.getOperator() == CompareOperator.GE, part2.length() == 0
- | upper.getOperator() == CompareOperator.LE);
-
}
return node;
Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/WildcardQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/WildcardQueryNodeProcessor.java?rev=1166789&r1=1166788&r2=1166789&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/WildcardQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/WildcardQueryNodeProcessor.java Thu Sep 8 16:47:50 2011
@@ -22,12 +22,12 @@ import java.util.List;
import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.FuzzyQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
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.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryparser.flexible.core.util.UnescapedCharSequence;
import org.apache.lucene.queryparser.flexible.standard.nodes.PrefixWildcardQueryNode;
+import org.apache.lucene.queryparser.flexible.standard.nodes.TermRangeQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.WildcardQueryNode;
import org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser;
import org.apache.lucene.search.PrefixQuery;
@@ -57,9 +57,9 @@ public class WildcardQueryNodeProcessor
FieldQueryNode fqn = (FieldQueryNode) node;
CharSequence text = fqn.getText();
- // do not process wildcards for ParametricQueryNode and
+ // do not process wildcards for TermRangeQueryNode children and
// QuotedFieldQueryNode to reproduce the old parser behavior
- if (fqn instanceof ParametricQueryNode
+ if (fqn.getParent() instanceof TermRangeQueryNode
|| fqn instanceof QuotedFieldQueryNode
|| text.length() <= 0){
// Ignore empty terms