mirror of https://github.com/apache/lucene.git
SOLR-4318 NPE when doing a wildcard query on a TextField with the default analysis chain
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1457032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
62fd532bae
commit
05c544ec19
|
@ -122,6 +122,9 @@ Bug Fixes
|
|||
* SOLR-4570: Even if an explicit shard id is used, ZkController#preRegister
|
||||
should still wait to see the shard id in it's current ClusterState.
|
||||
(Mark Miller)
|
||||
|
||||
* SOLR-4318: NPE encountered with querying with wildcards on a field that uses
|
||||
the DefaultAnalyzer (i.e. no analysis chain defined). (Erick Erickson)
|
||||
|
||||
* SOLR-4585: The Collections API validates numShards with < 0 but should use
|
||||
<= 0. (Mark Miller)
|
||||
|
|
|
@ -922,7 +922,8 @@ public abstract class SolrQueryParserBase {
|
|||
}
|
||||
|
||||
protected String analyzeIfMultitermTermText(String field, String part, FieldType fieldType) {
|
||||
if (part == null) return part;
|
||||
|
||||
if (part == null || ! (fieldType instanceof TextField) || ((TextField)fieldType).getMultiTermAnalyzer() == null) return part;
|
||||
|
||||
SchemaField sf = schema.getFieldOrNull((field));
|
||||
if (sf == null || ! (fieldType instanceof TextField)) return part;
|
||||
|
|
|
@ -137,7 +137,7 @@ public class TextField extends FieldType {
|
|||
}
|
||||
|
||||
public static BytesRef analyzeMultiTerm(String field, String part, Analyzer analyzerIn) {
|
||||
if (part == null) return null;
|
||||
if (part == null || analyzerIn == null) return null;
|
||||
|
||||
TokenStream source;
|
||||
try {
|
||||
|
|
|
@ -286,6 +286,7 @@ valued. -->
|
|||
stored="false" indexed="true"
|
||||
class="solr.ExternalFileField"/>
|
||||
|
||||
<fieldType name="text_no_analyzer" stored="false" indexed="true" class="solr.TextField" />
|
||||
</types>
|
||||
|
||||
|
||||
|
@ -322,6 +323,8 @@ valued. -->
|
|||
|
||||
<field name="eff_trie" type="eff_tfloat" />
|
||||
|
||||
<field name="text_no_analyzer" type="text_no_analyzer" indexed="true" />
|
||||
|
||||
<!-- Dynamic field definitions. If a field name is not found, dynamicFields
|
||||
will be used if the name matches any of the patterns.
|
||||
RESTRICTION: the glob-like pattern in the name attribute must have
|
||||
|
|
|
@ -56,6 +56,7 @@ public class TestQueryTypes extends AbstractSolrTestCase {
|
|||
assertU(adoc("id","7", "v_f","1.5"));
|
||||
assertU(adoc("id","8", "v_ti","5"));
|
||||
assertU(adoc("id","9", "v_s","internal\"quote"));
|
||||
assertU(adoc("id","10","text_no_analyzer","should just work"));
|
||||
|
||||
Object[] arr = new Object[] {
|
||||
"id",999.0
|
||||
|
@ -423,6 +424,8 @@ public class TestQueryTypes extends AbstractSolrTestCase {
|
|||
req("q","_query_:\"{!query defType=query v=$q1}\"", "q1","{!v=$q2}","q2","{!prefix f=v_t v=$qqq}","qqq","hel")
|
||||
,"//result[@numFound='2']"
|
||||
);
|
||||
assertQ("Test text field with no analysis doesn't NPE with wildcards (SOLR-4318)",
|
||||
req("q", "text_no_analyzer:should*"), "//result[@numFound='1']");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue