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:
Chris M. Hostetter 2010-02-13 05:02:56 +00:00
parent 5bfe85082e
commit 87b0e274e1
2 changed files with 18 additions and 3 deletions

View File

@ -234,6 +234,9 @@ Other Changes
* SOLR-1727: SolrEventListener should extend NamedListInitializedPlugin (noble)
* SOLR-1771: Improved error message when StringIndex cannot be initialized
for a function query (hossman)
Build
----------------------

View File

@ -32,7 +32,11 @@ public abstract class StringIndexDocValues extends DocValues {
protected final ValueSource vs;
public StringIndexDocValues(ValueSource vs, IndexReader reader, String field) throws IOException {
try {
index = FieldCache.DEFAULT.getStringIndex(reader, field);
} catch (RuntimeException e) {
throw new StringIndexException(field, e);
}
order = index.order;
lookup = index.lookup;
this.vs = vs;
@ -82,4 +86,12 @@ public abstract class StringIndexDocValues extends DocValues {
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);
}
}
}