//<start id="qqp.answerType"/>
String type = atc.computeAnswerType(parse);
String mt = atm.get(type);
//<end id="qqp.answerType"/>
String field = params.get(QUERY_FIELD);
SchemaField sp = req.getSchema().getFieldOrNull(field);
if (sp == null) {
throw new SolrException(ErrorCode.SERVER_ERROR,"Undefined field: "+field);
}
//<start id="qqp.query"/>
List<SpanQuery> sql = new ArrayList<SpanQuery>();
if (mt != null) {//<co id="qqp.handleAT"/>
String[] parts = mt.split("\\|");
if (parts.length == 1) {
sql.add(new SpanTermQuery(new Term(field, mt.toLowerCase())));
} else {
for (int pi = 0; pi < parts.length; pi++) {
sql.add(new SpanTermQuery(new Term(field, parts[pi])));
}
}
}
try {
Analyzer analyzer = sp.getType().getQueryAnalyzer();
TokenStream ts = analyzer.tokenStream(field,
new StringReader(qstr));
while (ts.incrementToken()) {//<co id="qqp.addTerms"/>
String term = ((CharTermAttribute)
ts.getAttribute(CharTermAttribute.class)).toString();