SOLR-220 -- adding a nicer error message when you sort on an undefined field.

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@533560 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2007-04-29 21:02:08 +00:00
parent 25a185b7da
commit d273f54151
1 changed files with 7 additions and 1 deletions

View File

@ -199,7 +199,13 @@ public class QueryParsing {
} }
else { else {
// getField could throw an exception if the name isn't found // getField could throw an exception if the name isn't found
SchemaField f = schema.getField(part); SchemaField f = null;
try{
f = schema.getField(part);
}
catch( SolrException e ){
throw new SolrException( 400, "can not sort on undefined field: "+part, e );
}
if (f == null || !f.indexed()){ if (f == null || !f.indexed()){
throw new SolrException( 400, "can not sort on unindexed field: "+part ); throw new SolrException( 400, "can not sort on unindexed field: "+part );
} }