Skip to content

Apache Lucene open-source search software

LUCENE-1768: Javadocs (week-8)

Uwe Schindlerb6c1db99d3b0
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/FieldValuePairQueryNode.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/FieldValuePairQueryNode.java
index 87adff458d3..6188af3fed2 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/FieldValuePairQueryNode.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/FieldValuePairQueryNode.java
@@ -17,6 +17,14 @@ package org.apache.lucene.queryparser.flexible.core.nodes;
* limitations under the License.
*/
-public interface FieldValuePairQueryNode<T extends Object> extends FieldableNode, ValueQueryNode<T> {
+/**
+ * This interface should be implemented by {@link QueryNode} that holds a field
+ * and an arbitrary value.
+ *
+ * @see FieldableNode
+ * @see ValueQueryNode
+ */
+public interface FieldValuePairQueryNode<T extends Object> extends
+ FieldableNode, ValueQueryNode<T> {
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/NumberQueryNode.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/NumberQueryNode.java
deleted file mode 100644
index ce94f158fe8..00000000000
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/NumberQueryNode.java
+++ /dev/null
@@ -1,26 +0,0 @@
-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.
- */
-
-public interface NumberQueryNode {
-
- void setNumber(Number number);
-
- Number getNumber();
-
-}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/ValueQueryNode.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/ValueQueryNode.java
index c2324245d00..f97ab3e0d17 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/ValueQueryNode.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/ValueQueryNode.java
@@ -17,6 +17,10 @@ package org.apache.lucene.queryparser.flexible.core.nodes;
* the License.
*/
+/**
+ * This interface should be implemented by {@link QueryNode} that holds an
+ * arbitrary value.
+ */
public interface ValueQueryNode<T extends Object> extends QueryNode {
public void setValue(T value);
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html
index 501e848fc63..e781271c0c5 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/package.html
@@ -61,6 +61,7 @@ Grouping nodes:
<li>FuzzyQueryNode - fuzzy node</li>
<li>ParametricRangeQueryNode - 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>
</ul>
</p>
@@ -68,6 +69,7 @@ Grouping nodes:
Leaf Nodes:
<ul>
<li>FieldQueryNode - field/value node</li>
+<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>
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/DummyQueryNodeBuilder.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/DummyQueryNodeBuilder.java
index 5ec5f369a69..1fc7f351f92 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/DummyQueryNodeBuilder.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/DummyQueryNodeBuilder.java
@@ -18,19 +18,32 @@ package org.apache.lucene.queryparser.flexible.standard.builders;
*/
import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
+import org.apache.lucene.queryparser.flexible.core.builders.QueryTreeBuilder;
import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
import org.apache.lucene.search.TermQuery;
/**
- * Builds a {@link TermQuery} object from a {@link FieldQueryNode} object.
+ * This builder does nothing. Commonly used for {@link QueryNode} objects that
+ * are built by its parent's builder.
+ *
+ * @see StandardQueryBuilder
+ * @see QueryTreeBuilder
*/
public class DummyQueryNodeBuilder implements StandardQueryBuilder {
+ /**
+ * Constructs a {@link DummyQueryNodeBuilder} object.
+ */
public DummyQueryNodeBuilder() {
// empty constructor
}
+ /**
+ * Always return <code>null</code>.
+ *
+ * return <code>null</code>
+ */
public TermQuery build(QueryNode queryNode) throws QueryNodeException {
return null;
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java
index 6779c02f3e0..3958ab2f396 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java
@@ -28,8 +28,17 @@ import org.apache.lucene.queryparser.flexible.standard.nodes.NumericQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.NumericRangeQueryNode;
import org.apache.lucene.search.NumericRangeQuery;
+/**
+ * Builds {@link NumericRangeQuery}s out of {@link NumericRangeQueryNode}s.
+ *
+ * @see NumericRangeQuery
+ * @see NumericRangeQueryNode
+ */
public class NumericRangeQueryNodeBuilder implements StandardQueryBuilder {
+ /**
+ * Constructs a {@link NumericRangeQueryNodeBuilder} object.
+ */
public NumericRangeQueryNodeBuilder() {
// empty constructor
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumberDateFormat.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumberDateFormat.java
index 3c55859ac6a..345876bf975 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumberDateFormat.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumberDateFormat.java
@@ -19,16 +19,27 @@ package org.apache.lucene.queryparser.flexible.standard.config;
import java.text.DateFormat;
import java.text.FieldPosition;
+import java.text.Format;
import java.text.NumberFormat;
import java.text.ParsePosition;
import java.util.Date;
+/**
+ * This {@link Format} parses {@link Long} into date strings and vice-versa. It
+ * uses the given {@link DateFormat} to parse and format dates, but before, it
+ * converts {@link Long} to {@link Date} objects or vice-versa.
+ */
public class NumberDateFormat extends NumberFormat {
private static final long serialVersionUID = 964823936071308283L;
final private DateFormat dateFormat;
+ /**
+ * Constructs a {@link NumberDateFormat} object using the given {@link DateFormat}.
+ *
+ * @param dateFormat {@link DateFormat} used to parse and format dates
+ */
public NumberDateFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat;
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericConfig.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericConfig.java
index 234f290b7cc..1258e3b23ea 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericConfig.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericConfig.java
@@ -20,7 +20,15 @@ package org.apache.lucene.queryparser.flexible.standard.config;
import java.text.NumberFormat;
import org.apache.lucene.document.NumericField;
+import org.apache.lucene.search.NumericRangeQuery;
+/**
+ * This class holds the configuration used to parse numeric queries and create
+ * {@link NumericRangeQuery}s.
+ *
+ * @see NumericRangeQuery
+ * @see NumberFormat
+ */
public class NumericConfig {
private int precisionStep;
@@ -28,30 +36,78 @@ public class NumericConfig {
private NumberFormat format;
private NumericField.DataType type;
-
- public NumericConfig(int precisionStep, NumberFormat format, NumericField.DataType type) {
+
+ /**
+ * Constructs a {@link NumericConfig} object.
+ *
+ * @param precisionStep
+ * the precision used to index the numeric values
+ * @param format
+ * the {@link NumberFormat} used to parse a {@link String} to
+ * {@link Number}
+ * @param type
+ * the numeric type used to index the numeric values
+ *
+ * @see NumericConfig#setPrecisionStep(int)
+ * @see NumericConfig#setNumberFormat(NumberFormat)
+ * @see #setType(org.apache.lucene.document.NumericField.DataType)
+ */
+ public NumericConfig(int precisionStep, NumberFormat format,
+ NumericField.DataType type) {
setPrecisionStep(precisionStep);
setNumberFormat(format);
setType(type);
}
+ /**
+ * Returns the precision used to index the numeric values
+ *
+ * @return the precision used to index the numeric values
+ *
+ * @see NumericRangeQuery#getPrecisionStep()
+ */
public int getPrecisionStep() {
return precisionStep;
}
+ /**
+ * Sets the precision used to index the numeric values
+ *
+ * @param precisionStep
+ * the precision used to index the numeric values
+ *
+ * @see NumericRangeQuery#getPrecisionStep()
+ */
public void setPrecisionStep(int precisionStep) {
this.precisionStep = precisionStep;
}
+ /**
+ * Returns the {@link NumberFormat} used to parse a {@link String} to
+ * {@link Number}
+ *
+ * @return the {@link NumberFormat} used to parse a {@link String} to
+ * {@link Number}
+ */
public NumberFormat getNumberFormat() {
return format;
}
+ /**
+ * Returns the numeric type used to index the numeric values
+ *
+ * @return the numeric type used to index the numeric values
+ */
public NumericField.DataType getType() {
return type;
}
-
+
+ /**
+ * Sets the numeric type used to index the numeric values
+ *
+ * @param type the numeric type used to index the numeric values
+ */
public void setType(NumericField.DataType type) {
if (type == null) {
@@ -61,7 +117,15 @@ public class NumericConfig {
this.type = type;
}
-
+
+ /**
+ * Sets the {@link NumberFormat} used to parse a {@link String} to
+ * {@link Number}
+ *
+ * @param format
+ * the {@link NumberFormat} used to parse a {@link String} to
+ * {@link Number}, cannot be <code>null</code>
+ */
public void setNumberFormat(NumberFormat format) {
if (format == null) {
@@ -81,7 +145,8 @@ public class NumericConfig {
NumericConfig other = (NumericConfig) obj;
if (this.precisionStep == other.precisionStep
- && this.format == other.format) {
+ && this.type == other.type
+ && (this.format == other.format || (this.format.equals(other.format)))) {
return true;
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericFieldConfigListener.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericFieldConfigListener.java
index 45703b67cc5..e3092b37a1b 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericFieldConfigListener.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericFieldConfigListener.java
@@ -24,10 +24,26 @@ import org.apache.lucene.queryparser.flexible.core.config.FieldConfigListener;
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler;
import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler.ConfigurationKeys;
+/**
+ * This listener is used to listen to {@link FieldConfig} requests in
+ * {@link QueryConfigHandler} and add {@link ConfigurationKeys#NUMERIC_CONFIG}
+ * based on the {@link ConfigurationKeys#NUMERIC_CONFIG_MAP} set in the
+ * {@link QueryConfigHandler}.
+ *
+ * @see NumericConfig
+ * @see QueryConfigHandler
+ * @see ConfigurationKeys#NUMERIC_CONFIG
+ * @see ConfigurationKeys#NUMERIC_CONFIG_MAP
+ */
public class NumericFieldConfigListener implements FieldConfigListener {
final private QueryConfigHandler config;
+ /**
+ * Construcs a {@link NumericFieldConfigListener} object using the given {@link QueryConfigHandler}.
+ *
+ * @param config the {@link QueryConfigHandler} it will listen too
+ */
public NumericFieldConfigListener(QueryConfigHandler config) {
if (config == null) {
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java
index 0dfcda213a5..d8da0d10917 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java
@@ -26,16 +26,32 @@ import org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl;
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)
+ */
public abstract class AbstractRangeQueryNode<T extends FieldValuePairQueryNode<?>>
extends QueryNodeImpl implements FieldableNode {
private boolean lowerInclusive, upperInclusive;
+ /**
+ * Constructs an {@link AbstractRangeQueryNode}, it should be invoked only by
+ * its extenders.
+ */
protected AbstractRangeQueryNode() {
setLeaf(false);
allocate();
}
+ /**
+ * Returns the field associated with this node.
+ *
+ * @return the field associated with this node
+ *
+ * @see FieldableNode
+ */
public CharSequence getField() {
CharSequence field = null;
T lower = getLowerBound();
@@ -52,6 +68,11 @@ public abstract class AbstractRangeQueryNode<T extends FieldValuePairQueryNode<?
}
+ /**
+ * Sets the field associated with this node.
+ *
+ * @param fieldName the field associated with this node
+ */
public void setField(CharSequence fieldName) {
T lower = getLowerBound();
T upper = getUpperBound();
@@ -66,24 +87,57 @@ public abstract class AbstractRangeQueryNode<T extends FieldValuePairQueryNode<?
}
+ /**
+ * Returns the lower bound node.
+ *
+ * @return the lower bound node.
+ */
@SuppressWarnings("unchecked")
public T getLowerBound() {
return (T) getChildren().get(0);
}
+ /**
+ * Returns the upper bound node.
+ *
+ * @return the upper bound node.
+ */
@SuppressWarnings("unchecked")
public T getUpperBound() {
return (T) getChildren().get(1);
}
+ /**
+ * Returns whether the lower bound is inclusive or exclusive.
+ *
+ * @return <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code>
+ */
public boolean isLowerInclusive() {
return lowerInclusive;
}
+ /**
+ * Returns whether the upper bound is inclusive or exclusive.
+ *
+ * @return <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code>
+ */
public boolean isUpperInclusive() {
return upperInclusive;
}
+ /**
+ * Sets the lower and upper bounds.
+ *
+ * @param lower the lower bound, <code>null</code> if lower bound is open
+ * @param upper the upper bound, <code>null</code> if upper bound is open
+ * @param lowerInclusive <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code>
+ * @param upperInclusive <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code>
+ *
+ * @see #getLowerBound()
+ * @see #getUpperBound()
+ * @see #isLowerInclusive()
+ * @see #isUpperInclusive()
+ */
public void setBounds(T lower, T upper, boolean lowerInclusive,
boolean upperInclusive) {
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericQueryNode.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericQueryNode.java
index adef571d583..90ce408a88c 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericQueryNode.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericQueryNode.java
@@ -20,11 +20,20 @@ package org.apache.lucene.queryparser.flexible.standard.nodes;
import java.text.NumberFormat;
import java.util.Locale;
+import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.FieldValuePairQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl;
import org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax;
import org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax.Type;
+import org.apache.lucene.queryparser.flexible.standard.config.NumericConfig;
+/**
+ * This query node represents a field query that holds a numeric value. It is
+ * similar to {@link FieldQueryNode}, however the {@link #getValue()} returns a
+ * {@link Number}.
+ *
+ * @see NumericConfig
+ */
public class NumericQueryNode extends QueryNodeImpl implements
FieldValuePairQueryNode<Number> {
@@ -34,6 +43,15 @@ public class NumericQueryNode extends QueryNodeImpl implements
private Number value;
+ /**
+ * Creates a {@link NumericQueryNode} object using the given field,
+ * {@link Number} value and {@link NumberFormat} used to convert the value to
+ * {@link String}.
+ *
+ * @param field the field associated with this query node
+ * @param value the value hold by this node
+ * @param numberFormat the {@link NumberFormat} used to convert the value to {@link String}
+ */
public NumericQueryNode(CharSequence field, Number value,
NumberFormat numberFormat) {
@@ -45,14 +63,32 @@ public class NumericQueryNode extends QueryNodeImpl implements
}
+ /**
+ * Returns the field associated with this node.
+ *
+ * @return the field associated with this node
+ */
public CharSequence getField() {
return this.field;
}
+ /**
+ * Sets the field associated with this node.
+ *
+ * @param fieldName the field associated with this node
+ */
public void setField(CharSequence fieldName) {
this.field = fieldName;
}
+ /**
+ * This method is used to get the value converted to {@link String} and
+ * escaped using the given {@link EscapeQuerySyntax}.
+ *
+ * @param escaper the {@link EscapeQuerySyntax} used to escape the value {@link String}
+ *
+ * @return the value converte to {@link String} and escaped
+ */
protected CharSequence getTermEscaped(EscapeQuerySyntax escaper) {
return escaper.escape(NumberFormat.getNumberInstance().format(this.value),
Locale.ENGLISH, Type.NORMAL);
@@ -66,18 +102,38 @@ public class NumericQueryNode extends QueryNodeImpl implements
}
}
+ /**
+ * Sets the {@link NumberFormat} used to convert the value to {@link String}.
+ *
+ * @param format the {@link NumberFormat} used to convert the value to {@link String}
+ */
public void setNumberFormat(NumberFormat format) {
this.numberFormat = format;
}
+ /**
+ * Returns the {@link NumberFormat} used to convert the value to {@link String}.
+ *
+ * @return the {@link NumberFormat} used to convert the value to {@link String}
+ */
public NumberFormat getNumberFormat() {
return this.numberFormat;
}
+ /**
+ * Returns the numeric value as {@link Number}.
+ *
+ * @return the numeric value
+ */
public Number getValue() {
return value;
}
+ /**
+ * Sets the numeric value.
+ *
+ * @param value the numeric value
+ */
public void setValue(Number value) {
this.value = value;
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericRangeQueryNode.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericRangeQueryNode.java
index 3b0a85bd5d5..9910ad3626e 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericRangeQueryNode.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericRangeQueryNode.java
@@ -4,6 +4,7 @@ import org.apache.lucene.document.NumericField;
import org.apache.lucene.messages.MessageImpl;
import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
+import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
import org.apache.lucene.queryparser.flexible.standard.config.NumericConfig;
/**
@@ -23,11 +24,30 @@ import org.apache.lucene.queryparser.flexible.standard.config.NumericConfig;
* the License.
*/
+/**
+ * This query node represents a range query composed by {@link NumericQueryNode}
+ * bounds, which means the bound values are {@link Number}s.
+ *
+ * @see NumericQueryNode
+ * @see AbstractRangeQueryNode
+ */
public class NumericRangeQueryNode extends
AbstractRangeQueryNode<NumericQueryNode> {
public NumericConfig numericConfig;
+ /**
+ * Constructs a {@link NumericRangeQueryNode} object using the given
+ * {@link NumericQueryNode} as its bounds and {@link NumericConfig}.
+ *
+ * @param lower the lower bound
+ * @param upper the upper bound
+ * @param lowerInclusive <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code>
+ * @param upperInclusive <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code>
+ * @param numericConfig the {@link NumericConfig} that represents associated with the upper and lower bounds
+ *
+ * @see #setBounds(NumericQueryNode, NumericQueryNode, boolean, boolean, NumericConfig)
+ */
public NumericRangeQueryNode(NumericQueryNode lower, NumericQueryNode upper,
boolean lowerInclusive, boolean upperInclusive, NumericConfig numericConfig) throws QueryNodeException {
setBounds(lower, upper, lowerInclusive, upperInclusive, numericConfig);
@@ -52,6 +72,17 @@ public class NumericRangeQueryNode extends
}
+ /**
+ * Sets the upper and lower bounds of this range query node and the
+ * {@link NumericConfig} associated with these bounds.
+ *
+ * @param lower the lower bound
+ * @param upper the upper bound
+ * @param lowerInclusive <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code>
+ * @param upperInclusive <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code>
+ * @param numericConfig the {@link NumericConfig} that represents associated with the upper and lower bounds
+ *
+ */
public void setBounds(NumericQueryNode lower, NumericQueryNode upper,
boolean lowerInclusive, boolean upperInclusive, NumericConfig numericConfig) throws QueryNodeException {
@@ -92,6 +123,11 @@ public class NumericRangeQueryNode extends
}
+ /**
+ * Returns the {@link NumericConfig} associated with the lower and upper bounds.
+ *
+ * @return the {@link NumericConfig} associated with the lower and upper bounds
+ */
public NumericConfig getNumericConfig() {
return this.numericConfig;
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/TermRangeQueryNode.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/TermRangeQueryNode.java
index bec3ba6474d..b96e059cde5 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/TermRangeQueryNode.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/TermRangeQueryNode.java
@@ -20,13 +20,23 @@ package org.apache.lucene.queryparser.flexible.standard.nodes;
import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
/**
- * This query node represents a range query.
+ * This query node represents a range query composed by {@link FieldQueryNode}
+ * bounds, which means the bound values are strings.
*
- * @see org.apache.lucene.queryparser.flexible.standard.processors.ParametricRangeQueryNodeProcessor
- * @see org.apache.lucene.search.TermRangeQuery
+ * @see FieldQueryNode
+ * @see AbstractRangeQueryNode
*/
public class TermRangeQueryNode extends AbstractRangeQueryNode<FieldQueryNode> {
+ /**
+ * Constructs a {@link TermRangeQueryNode} object using the given
+ * {@link FieldQueryNode} as its bounds.
+ *
+ * @param lower the lower bound
+ * @param upper the upper bound
+ * @param lowerInclusive <code>true</code> if the lower bound is inclusive, otherwise, <code>false</code>
+ * @param upperInclusive <code>true</code> if the upper bound is inclusive, otherwise, <code>false</code>
+ */
public TermRangeQueryNode(FieldQueryNode lower, FieldQueryNode upper,
boolean lowerInclusive, boolean upperInclusive) {
setBounds(lower, upper, lowerInclusive, upperInclusive);
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java
index 3bbe7fc74b5..42f651513d2 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java
@@ -36,8 +36,31 @@ import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfi
import org.apache.lucene.queryparser.flexible.standard.nodes.NumericQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.NumericRangeQueryNode;
+/**
+ * This processor is used to convert {@link FieldQueryNode}s to
+ * {@link NumericRangeQueryNode}s. It looks for
+ * {@link ConfigurationKeys#NUMERIC_CONFIG} set in the {@link FieldConfig} of
+ * every {@link FieldQueryNode} found. If
+ * {@link ConfigurationKeys#NUMERIC_CONFIG} is found, it considers that
+ * {@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/>
+ * <br/>
+ * Note that {@link ParametricQueryNode}s are ignored, even being a
+ * {@link FieldQueryNode}.
+ *
+ * @see ConfigurationKeys#NUMERIC_CONFIG
+ * @see FieldQueryNode
+ * @see NumericConfig
+ * @see NumericQueryNode
+ */
public class NumericQueryNodeProcessor extends QueryNodeProcessorImpl {
+ /**
+ * Constructs a {@link NumericQueryNodeProcessor} object.
+ */
public NumericQueryNodeProcessor() {
// empty constructor
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java
index 2f2f76c89f6..77932918e25 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java
@@ -27,6 +27,7 @@ import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException;
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.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;
@@ -38,8 +39,25 @@ import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfi
import org.apache.lucene.queryparser.flexible.standard.nodes.NumericQueryNode;
import org.apache.lucene.queryparser.flexible.standard.nodes.NumericRangeQueryNode;
+/**
+ * This processor is used to convert {@link ParametricRangeQueryNode}s to
+ * {@link NumericRangeQueryNode}s. It looks for
+ * {@link ConfigurationKeys#NUMERIC_CONFIG} set in the {@link FieldConfig} of
+ * every {@link ParametricRangeQueryNode} found. If
+ * {@link ConfigurationKeys#NUMERIC_CONFIG} is found, it considers that
+ * {@link ParametricRangeQueryNode} to be a numeric range query and convert it to
+ * {@link NumericRangeQueryNode}.
+ *
+ * @see ConfigurationKeys#NUMERIC_CONFIG
+ * @see ParametricRangeQueryNode
+ * @see NumericConfig
+ * @see NumericRangeQueryNode
+ */
public class NumericRangeQueryNodeProcessor extends QueryNodeProcessorImpl {
+ /**
+ * Constructs an empty {@link NumericRangeQueryNode} object.
+ */
public NumericRangeQueryNodeProcessor() {
// empty constructor
}
diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/package.html b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/package.html
index c65a24c4ab9..0aff9155f8e 100644
--- a/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/package.html
+++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/package.html
@@ -27,7 +27,7 @@ The package org.apache.lucene.queryparser.flexible.standard.processors contains
that modifies the query node tree according to the actual Lucene queries.
</p>
<p>
-This processors are already assembled correctly in the StandardQueryNodeProcessorPipeline.
+These processors are already assembled correctly in the StandardQueryNodeProcessorPipeline.
</p>
</body>
</html>