}
NamedList<Object> fieldTokens = new SimpleOrderedMap<Object>();
theTokens.add(name, fieldTokens);
FieldType fieldType = schema.getFieldType(name);
final String queryValue = request.getQuery();
Set<String> termsToMatch;
try {
termsToMatch = (queryValue != null && request.isShowMatch())
? getQueryTokenSet(queryValue, fieldType.getQueryAnalyzer())
: Collections.<String>emptySet();
} catch (Exception e) {
// ignore analysis exceptions since we are applying arbitrary text to all fields
termsToMatch = Collections.<String>emptySet();
}
if (request.getQuery() != null) {
try {
AnalysisContext analysisContext = new AnalysisContext(fieldType, fieldType.getQueryAnalyzer(), Collections.<String>emptySet());
NamedList<List<NamedList>> tokens = analyzeValue(request.getQuery(), analysisContext);
fieldTokens.add("query", tokens);
} catch (Exception e) {
// ignore analysis exceptions since we are applying arbitrary text to all fields
}
}
Analyzer analyzer = fieldType.getAnalyzer();
AnalysisContext analysisContext = new AnalysisContext(fieldType, analyzer, termsToMatch);
Collection<Object> fieldValues = document.getFieldValues(name);
NamedList<NamedList<List<NamedList>>> indexTokens = new SimpleOrderedMap<NamedList<List<NamedList>>>();
for (Object fieldValue : fieldValues) {
NamedList<List<NamedList>> tokens = analyzeValue(fieldValue.toString(), analysisContext);