private static ValueSource buildSourceTree(IndexSchema schema,String expression,int sourceType){
  int expressionType=getSourceType(expression);
  if (sourceType != FIELD_TYPE && expressionType != FIELD_TYPE && expressionType != FILTER_TYPE && expressionType != sourceType) {
    return null;
  }
switch (expressionType) {
case NUMBER_TYPE:
    return buildNumericSource(schema,expression);
case DATE_TYPE:
  return buildDateSource(schema,expression);
case STRING_TYPE:
return buildStringSource(schema,expression);
case FIELD_TYPE:
return buildFieldSource(schema,expression,sourceType);
case FILTER_TYPE:
return buildFilterSource(schema,expression.substring(expression.indexOf('(') + 1,expression.lastIndexOf(')')),sourceType);
default :
throw new SolrException(ErrorCode.BAD_REQUEST,expression + " is not a valid operation.");
}
}

private static ValueSource buildSourceTree ( IndexSchema schema , String expression , int sourceType ) { int expressionType = getSourceType ( expression ) ; if ( sourceType != FIELD_TYPE && expressionType != FIELD_TYPE && expressionType != FILTER_TYPE && expressionType != sourceType ) { return null ; } switch ( expressionType ) { case NUMBER_TYPE : return buildNumericSource ( schema , expression ) ; case DATE_TYPE : return buildDateSource ( schema , expression ) ; case STRING_TYPE : return buildStringSource ( schema , expression ) ; case FIELD_TYPE : return buildFieldSource ( schema , expression , sourceType ) ; case FILTER_TYPE : return buildFilterSource ( schema , expression . substring ( expression . indexOf ( '(' ) + 1 , expression . lastIndexOf ( ')' ) ) , sourceType ) ; default : throw new SolrException ( ErrorCode . BAD_REQUEST , expression + " is not a valid operation." ) ; } }
builds a value source from a given string and a given source type
