mirror of https://github.com/apache/lucene.git
SOLR-1771: Improved error message when StringIndex cannot be initialized for a function query
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@909746 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5bfe85082e
commit
87b0e274e1
|
@ -234,6 +234,9 @@ Other Changes
|
||||||
|
|
||||||
* SOLR-1727: SolrEventListener should extend NamedListInitializedPlugin (noble)
|
* SOLR-1727: SolrEventListener should extend NamedListInitializedPlugin (noble)
|
||||||
|
|
||||||
|
* SOLR-1771: Improved error message when StringIndex cannot be initialized
|
||||||
|
for a function query (hossman)
|
||||||
|
|
||||||
Build
|
Build
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,11 @@ public abstract class StringIndexDocValues extends DocValues {
|
||||||
protected final ValueSource vs;
|
protected final ValueSource vs;
|
||||||
|
|
||||||
public StringIndexDocValues(ValueSource vs, IndexReader reader, String field) throws IOException {
|
public StringIndexDocValues(ValueSource vs, IndexReader reader, String field) throws IOException {
|
||||||
|
try {
|
||||||
index = FieldCache.DEFAULT.getStringIndex(reader, field);
|
index = FieldCache.DEFAULT.getStringIndex(reader, field);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
throw new StringIndexException(field, e);
|
||||||
|
}
|
||||||
order = index.order;
|
order = index.order;
|
||||||
lookup = index.lookup;
|
lookup = index.lookup;
|
||||||
this.vs = vs;
|
this.vs = vs;
|
||||||
|
@ -82,4 +86,12 @@ public abstract class StringIndexDocValues extends DocValues {
|
||||||
return vs.description() + '=' + strVal(doc);
|
return vs.description() + '=' + strVal(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class StringIndexException extends RuntimeException {
|
||||||
|
public StringIndexException(final String fieldName,
|
||||||
|
final RuntimeException cause) {
|
||||||
|
super("Can't initialize StringIndex to generate (function) " +
|
||||||
|
"DocValues for field: " + fieldName, cause);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue