Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-746: Fix error message in AnalyzingQueryParser.getPrefixQuery.

Michael Busch75473edb02ad
diff --git a/CHANGES.txt b/CHANGES.txt
index 8c4d73d5ace..5c9ef9c4fae 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -344,6 +344,9 @@ Documentation
classes, as well as an unified view. Also add an appropriate menu
structure to the website. (Michael Busch)
+ 2. LUCENE-746: Fix error message in AnalyzingQueryParser.getPrefixQuery.
+ (Ronnie Kolehmainen via Michael Busch)
+
Build
1. LUCENE-908: Improvements and simplifications for how the MANIFEST
diff --git a/contrib/miscellaneous/src/java/org/apache/lucene/queryParser/analyzing/AnalyzingQueryParser.java b/contrib/miscellaneous/src/java/org/apache/lucene/queryParser/analyzing/AnalyzingQueryParser.java
index 4518eaa0cc5..7d4cbd872dc 100644
--- a/contrib/miscellaneous/src/java/org/apache/lucene/queryParser/analyzing/AnalyzingQueryParser.java
+++ b/contrib/miscellaneous/src/java/org/apache/lucene/queryParser/analyzing/AnalyzingQueryParser.java
@@ -212,10 +212,11 @@ public class AnalyzingQueryParser extends org.apache.lucene.queryParser.QueryPar
if (tlist.size() == 1) {
return super.getPrefixQuery(field, (String) tlist.get(0));
} else {
- /* this means that the analyzer used consumed the only token we had,
- * and we can't build a PrefixQuery */
+ /* this means that the analyzer used either added or consumed
+ * (common for a stemmer) tokens, and we can't build a PrefixQuery */
throw new ParseException("Cannot build PrefixQuery with analyzer "
- + getAnalyzer().getClass() + " - token was consumed");
+ + getAnalyzer().getClass()
+ + (tlist.size() > 1 ? " - token(s) added" : " - token consumed"));
}
}