Skip to content

Apache Lucene open-source search software

several small documentation fixes -- no functional change except a "Usage" message in the main() method

Daniel Naber9daff285c96e
diff --git a/src/java/org/apache/lucene/queryParser/QueryParser.java b/src/java/org/apache/lucene/queryParser/QueryParser.java
index 6ebc32b23ab..aa627c6eb6d 100644
--- a/src/java/org/apache/lucene/queryParser/QueryParser.java
+++ b/src/java/org/apache/lucene/queryParser/QueryParser.java
@@ -12,7 +12,7 @@ import org.apache.lucene.search.*;
/**
* This class is generated by JavaCC. The only method that clients should need
- * to call is <a href="#parse">parse()</a>.
+ * to call is {@link #parse(String)} or {@link #parse(String, String, Analyzer)}.
*
* The syntax for query strings is as follows:
* A Query is a series of clauses.
@@ -40,7 +40,8 @@ import org.apache.lucene.search.*;
*
* <p>
* Examples of appropriately formatted queries can be found in the <a
- * href="http://jakarta.apache.org/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java">test cases</a>.
+ * href="http://jakarta.apache.org/lucene/docs/queryparsersyntax.html">query syntax
+ * documentation</a>.
* </p>
*
* @author Brian Goetz
@@ -64,10 +65,6 @@ public class QueryParser implements QueryParserConstants {
/** The actual operator that parser uses to combine query terms */
private int operator = DEFAULT_OPERATOR_OR;
- /**
- * Whether terms of wildcard and prefix queries are to be automatically
- * lower-cased or not. Default is <code>true</code>.
- */
boolean lowercaseWildcardTerms = true;
Analyzer analyzer;
@@ -99,8 +96,7 @@ public class QueryParser implements QueryParserConstants {
field = f;
}
- /** Parses a query string, returning a
- * <a href="lucene.search.Query.html">Query</a>.
+ /** Parses a query string, returning a {@link org.apache.lucene.search.Query}.
* @param query the query string to be parsed.
* @throws ParseException if the parsing fails
*/
@@ -155,7 +151,7 @@ public class QueryParser implements QueryParserConstants {
}
/**
- * Set the prefix length for fuzzy queries. Default is 2.
+ * Set the prefix length for fuzzy queries. Default is 0.
* @param fuzzyPrefixLength The fuzzyPrefixLength to set.
*/
public void setFuzzyPrefixLength(int fuzzyPrefixLength) {
@@ -179,7 +175,7 @@ public class QueryParser implements QueryParserConstants {
/**
* Sets the boolean operator of the QueryParser.
- * In classic mode (<code>DEFAULT_OPERATOR_OR</code>) terms without any modifiers
+ * In default mode (<code>DEFAULT_OPERATOR_OR</code>) terms without any modifiers
* are considered optional: for example <code>capital of Hungary</code> is equal to
* <code>capital OR of OR Hungary</code>.<br/>
* In <code>DEFAULT_OPERATOR_AND</code> terms are considered to be in conjuction: the
@@ -197,10 +193,17 @@ public class QueryParser implements QueryParserConstants {
return operator;
}
+ /**
+ * Whether terms of wildcard and prefix queries are to be automatically
+ * lower-cased or not. Default is <code>true</code>.
+ */
public void setLowercaseWildcardTerms(boolean lowercaseWildcardTerms) {
this.lowercaseWildcardTerms = lowercaseWildcardTerms;
}
+ /**
+ * @see #setLowercaseWildcardTerms(boolean)
+ */
public boolean getLowercaseWildcardTerms() {
return lowercaseWildcardTerms;
}
@@ -450,7 +453,7 @@ public class QueryParser implements QueryParserConstants {
/**
* Factory method for generating a query (similar to
- * ({@link #getWildcardQuery}). Called when parser parses an input term
+ * {@link #getWildcardQuery}). Called when parser parses an input term
* token that uses prefix notation; that is, contains a single '*' wildcard
* character as its last character. Since this is a special case
* of generic wildcard term, and such a query can be optimized easily,
@@ -489,7 +492,7 @@ public class QueryParser implements QueryParserConstants {
/**
* Factory method for generating a query (similar to
- * ({@link #getWildcardQuery}). Called when parser parses
+ * {@link #getWildcardQuery}). Called when parser parses
* an input term token that has the fuzzy suffix (~) appended.
*
* @param field Name of the field query will use.
@@ -539,7 +542,16 @@ public class QueryParser implements QueryParserConstants {
return sb.toString();
}
+ /**
+ * Command line tool to test QueryParser, using {@link org.apache.lucene.analysis.SimpleAnalyzer}.
+ * Usage:<br>
+ * <code>java org.apache.lucene.queryParser.QueryParser &lt;input&gt;</code>
+ */
public static void main(String[] args) throws Exception {
+ if (args.length == 0) {
+ System.out.println("Usage: java org.apache.lucene.queryParser.QueryParser <input>");
+ System.exit(0);
+ }
QueryParser qp = new QueryParser("field",
new org.apache.lucene.analysis.SimpleAnalyzer());
Query q = qp.parse(args[0]);
diff --git a/src/java/org/apache/lucene/queryParser/QueryParser.jj b/src/java/org/apache/lucene/queryParser/QueryParser.jj
index 7a8e4a2ec02..0b57915299d 100644
--- a/src/java/org/apache/lucene/queryParser/QueryParser.jj
+++ b/src/java/org/apache/lucene/queryParser/QueryParser.jj
@@ -35,7 +35,7 @@ import org.apache.lucene.search.*;
/**
* This class is generated by JavaCC. The only method that clients should need
- * to call is <a href="#parse">parse()</a>.
+ * to call is {@link #parse(String)} or {@link #parse(String, String, Analyzer)}.
*
* The syntax for query strings is as follows:
* A Query is a series of clauses.
@@ -63,7 +63,8 @@ import org.apache.lucene.search.*;
*
* <p>
* Examples of appropriately formatted queries can be found in the <a
- * href="http://jakarta.apache.org/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java">test cases</a>.
+ * href="http://jakarta.apache.org/lucene/docs/queryparsersyntax.html">query syntax
+ * documentation</a>.
* </p>
*
* @author Brian Goetz
@@ -87,10 +88,6 @@ public class QueryParser {
/** The actual operator that parser uses to combine query terms */
private int operator = DEFAULT_OPERATOR_OR;
- /**
- * Whether terms of wildcard and prefix queries are to be automatically
- * lower-cased or not. Default is <code>true</code>.
- */
boolean lowercaseWildcardTerms = true;
Analyzer analyzer;
@@ -122,8 +119,7 @@ public class QueryParser {
field = f;
}
- /** Parses a query string, returning a
- * <a href="lucene.search.Query.html">Query</a>.
+ /** Parses a query string, returning a {@link org.apache.lucene.search.Query}.
* @param query the query string to be parsed.
* @throws ParseException if the parsing fails
*/
@@ -178,7 +174,7 @@ public class QueryParser {
}
/**
- * Set the prefix length for fuzzy queries. Default is 2.
+ * Set the prefix length for fuzzy queries. Default is 0.
* @param fuzzyPrefixLength The fuzzyPrefixLength to set.
*/
public void setFuzzyPrefixLength(int fuzzyPrefixLength) {
@@ -202,7 +198,7 @@ public class QueryParser {
/**
* Sets the boolean operator of the QueryParser.
- * In classic mode (<code>DEFAULT_OPERATOR_OR</code>) terms without any modifiers
+ * In default mode (<code>DEFAULT_OPERATOR_OR</code>) terms without any modifiers
* are considered optional: for example <code>capital of Hungary</code> is equal to
* <code>capital OR of OR Hungary</code>.<br/>
* In <code>DEFAULT_OPERATOR_AND</code> terms are considered to be in conjuction: the
@@ -220,10 +216,17 @@ public class QueryParser {
return operator;
}
+ /**
+ * Whether terms of wildcard and prefix queries are to be automatically
+ * lower-cased or not. Default is <code>true</code>.
+ */
public void setLowercaseWildcardTerms(boolean lowercaseWildcardTerms) {
this.lowercaseWildcardTerms = lowercaseWildcardTerms;
}
+ /**
+ * @see #setLowercaseWildcardTerms(boolean)
+ */
public boolean getLowercaseWildcardTerms() {
return lowercaseWildcardTerms;
}
@@ -473,7 +476,7 @@ public class QueryParser {
/**
* Factory method for generating a query (similar to
- * ({@link #getWildcardQuery}). Called when parser parses an input term
+ * {@link #getWildcardQuery}). Called when parser parses an input term
* token that uses prefix notation; that is, contains a single '*' wildcard
* character as its last character. Since this is a special case
* of generic wildcard term, and such a query can be optimized easily,
@@ -512,7 +515,7 @@ public class QueryParser {
/**
* Factory method for generating a query (similar to
- * ({@link #getWildcardQuery}). Called when parser parses
+ * {@link #getWildcardQuery}). Called when parser parses
* an input term token that has the fuzzy suffix (~) appended.
*
* @param field Name of the field query will use.
@@ -562,7 +565,16 @@ public class QueryParser {
return sb.toString();
}
+ /**
+ * Command line tool to test QueryParser, using {@link org.apache.lucene.analysis.SimpleAnalyzer}.
+ * Usage:<br>
+ * <code>java org.apache.lucene.queryParser.QueryParser &lt;input&gt;</code>
+ */
public static void main(String[] args) throws Exception {
+ if (args.length == 0) {
+ System.out.println("Usage: java org.apache.lucene.queryParser.QueryParser <input>");
+ System.exit(0);
+ }
QueryParser qp = new QueryParser("field",
new org.apache.lucene.analysis.SimpleAnalyzer());
Query q = qp.parse(args[0]);