goller 2004/09/08 08:06:42
Modified: src/java/org/apache/lucene/queryParser QueryParser.jj
QueryParser.java
Log:
Getters for analyzer and field added.
Some unnecessary variables deleted.
Revision Changes Path
1.48 +23 -16 jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.jj
Index: QueryParser.jj
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.jj,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- QueryParser.jj 8 Sep 2004 13:31:55 -0000 1.47
+++ QueryParser.jj 8 Sep 2004 15:06:42 -0000 1.48
@@ -137,6 +137,20 @@
throw new ParseException("Too many boolean clauses");
}
}
+
+ /**
+ * @return Returns the analyzer.
+ */
+ public Analyzer getAnalyzer() {
+ return analyzer;
+ }
+
+ /**
+ * @return Returns the field.
+ */
+ public String getField() {
+ return field;
+ }
/**
* Sets the default slop for phrases. If zero, then exact phrase matches
@@ -248,9 +262,7 @@
/**
* @exception ParseException throw in overridden method to disallow
*/
- protected Query getFieldQuery(String field,
- Analyzer analyzer,
- String queryText) throws ParseException {
+ protected Query getFieldQuery(String field, String queryText) throws ParseException
{
// Use the analyzer to get all the tokens, and then build a TermQuery,
// PhraseQuery, or nothing based on the term count
@@ -292,17 +304,15 @@
}
/**
- * Base implementation delegates to {@link #getFieldQuery(String,Analyzer,String)}.
+ * Base implementation delegates to {@link #getFieldQuery(String,String)}.
* This method may be overridden, for example, to return
* a SpanNearQuery instead of a PhraseQuery.
*
* @exception ParseException throw in overridden method to disallow
*/
- protected Query getFieldQuery(String field,
- Analyzer analyzer,
- String queryText,
- int slop) throws ParseException {
- Query query = getFieldQuery(field, analyzer, queryText);
+ protected Query getFieldQuery(String field, String queryText, int slop)
+ throws ParseException {
+ Query query = getFieldQuery(field, queryText);
if (query instanceof PhraseQuery) {
((PhraseQuery) query).setSlop(slop);
@@ -315,7 +325,6 @@
* @exception ParseException throw in overridden method to disallow
*/
protected Query getRangeQuery(String field,
- Analyzer analyzer,
String part1,
String part2,
boolean inclusive) throws ParseException
@@ -660,7 +669,7 @@
} else if (fuzzy) {
q = getFuzzyQuery(field, termImage);
} else {
- q = getFieldQuery(field, analyzer, termImage);
+ q = getFieldQuery(field, termImage);
}
}
| ( <RANGEIN_START> ( goop1=<RANGEIN_GOOP>|goop1=<RANGEIN_QUOTED>
)
@@ -678,7 +687,7 @@
} else {
goop2.image = discardEscapeChar(goop2.image);
}
- q = getRangeQuery(field, analyzer, goop1.image, goop2.image, true);
+ q = getRangeQuery(field, goop1.image, goop2.image, true);
}
| ( <RANGEEX_START> ( goop1=<RANGEEX_GOOP>|goop1=<RANGEEX_QUOTED>
)
[ <RANGEEX_TO> ] ( goop2=<RANGEEX_GOOP>|goop2=<RANGEEX_QUOTED>
)
@@ -696,7 +705,7 @@
goop2.image = discardEscapeChar(goop2.image);
}
- q = getRangeQuery(field, analyzer, goop1.image, goop2.image, false);
+ q = getRangeQuery(field, goop1.image, goop2.image, false);
}
| term=<QUOTED>
[ slop=<SLOP> ]
@@ -710,9 +719,7 @@
}
catch (Exception ignored) { }
}
- q = getFieldQuery(field, analyzer,
- term.image.substring(1, term.image.length()-1),
- s);
+ q = getFieldQuery(field, term.image.substring(1, term.image.length()-1), s);
}
)
{
1.15 +23 -16 jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.java
Index: QueryParser.java
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- QueryParser.java 8 Sep 2004 13:31:55 -0000 1.14
+++ QueryParser.java 8 Sep 2004 15:06:42 -0000 1.15
@@ -115,6 +115,20 @@
}
}
+ /**
+ * @return Returns the analyzer.
+ */
+ public Analyzer getAnalyzer() {
+ return analyzer;
+ }
+
+ /**
+ * @return Returns the field.
+ */
+ public String getField() {
+ return field;
+ }
+
/**
* Sets the default slop for phrases. If zero, then exact phrase matches
* are required. Default value is zero.
@@ -225,9 +239,7 @@
/**
* @exception ParseException throw in overridden method to disallow
*/
- protected Query getFieldQuery(String field,
- Analyzer analyzer,
- String queryText) throws ParseException {
+ protected Query getFieldQuery(String field, String queryText) throws ParseException
{
// Use the analyzer to get all the tokens, and then build a TermQuery,
// PhraseQuery, or nothing based on the term count
@@ -269,17 +281,15 @@
}
/**
- * Base implementation delegates to {@link #getFieldQuery(String,Analyzer,String)}.
+ * Base implementation delegates to {@link #getFieldQuery(String,String)}.
* This method may be overridden, for example, to return
* a SpanNearQuery instead of a PhraseQuery.
*
* @exception ParseException throw in overridden method to disallow
*/
- protected Query getFieldQuery(String field,
- Analyzer analyzer,
- String queryText,
- int slop) throws ParseException {
- Query query = getFieldQuery(field, analyzer, queryText);
+ protected Query getFieldQuery(String field, String queryText, int slop)
+ throws ParseException {
+ Query query = getFieldQuery(field, queryText);
if (query instanceof PhraseQuery) {
((PhraseQuery) query).setSlop(slop);
@@ -292,7 +302,6 @@
* @exception ParseException throw in overridden method to disallow
*/
protected Query getRangeQuery(String field,
- Analyzer analyzer,
String part1,
String part2,
boolean inclusive) throws ParseException
@@ -681,7 +690,7 @@
} else if (fuzzy) {
q = getFuzzyQuery(field, termImage);
} else {
- q = getFieldQuery(field, analyzer, termImage);
+ q = getFieldQuery(field, termImage);
}
break;
case RANGEIN_START:
@@ -738,7 +747,7 @@
} else {
goop2.image = discardEscapeChar(goop2.image);
}
- q = getRangeQuery(field, analyzer, goop1.image, goop2.image, true);
+ q = getRangeQuery(field, goop1.image, goop2.image, true);
break;
case RANGEEX_START:
jj_consume_token(RANGEEX_START);
@@ -795,7 +804,7 @@
goop2.image = discardEscapeChar(goop2.image);
}
- q = getRangeQuery(field, analyzer, goop1.image, goop2.image, false);
+ q = getRangeQuery(field, goop1.image, goop2.image, false);
break;
case QUOTED:
term = jj_consume_token(QUOTED);
@@ -824,9 +833,7 @@
}
catch (Exception ignored) { }
}
- q = getFieldQuery(field, analyzer,
- term.image.substring(1, term.image.length()-1),
- s);
+ q = getFieldQuery(field, term.image.substring(1, term.image.length()-1), s);
break;
default:
jj_la1[21] = jj_gen;
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
|