SOLR-528: Better error message when defaultSearchField is bogus or not indexed

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@646135 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2008-04-08 23:35:22 +00:00
parent fd4981f444
commit b6fe0f58d0
2 changed files with 10 additions and 1 deletions

View File

@ -331,6 +331,9 @@ Bug Fixes
field using bogus fieldtype and multiple copyFields to a non-multiValue
field. (Shalin Shekhar Mangar via hossman)
23. SOLR-528: Better error message when defaultSearchField is bogus or not
indexed. (Lars Kotthoff via hossman)
Other Changes
1. SOLR-135: Moved common classes to org.apache.solr.common and altered the
build scripts to make two jars: apache-solr-1.3.jar and

View File

@ -511,7 +511,13 @@ public final class IndexSchema {
} else {
defaultSearchFieldName=node.getNodeValue().trim();
// throw exception if specified, but not found or not indexed
if (defaultSearchFieldName!=null) getIndexedField(defaultSearchFieldName);
if (defaultSearchFieldName!=null) {
SchemaField defaultSearchField = getFields().get(defaultSearchFieldName);
if ((defaultSearchField == null) || !defaultSearchField.indexed()) {
String msg = "default search field '" + defaultSearchFieldName + "' not defined or not indexed" ;
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
}
}
log.info("default search field is "+defaultSearchFieldName);
}