SOLR-10778: eliminate local variables in (PageTool,AnalyzeEvaluator,ClassifyStream)

This commit is contained in:
Christine Poerschke 2017-06-23 11:12:29 +01:00
parent 55b0227d8c
commit 3a017e4cf2
3 changed files with 4 additions and 7 deletions

View File

@ -44,9 +44,8 @@ public class PageTool {
Object docs = response.getResponse();
if (docs != null) {
if (docs instanceof DocSlice) {
DocSlice doc_slice = (DocSlice) docs;
results_found = doc_slice.matches();
start = doc_slice.offset();
results_found = ((DocSlice) docs).matches();
start = ((DocSlice) docs).offset();
} else if(docs instanceof ResultContext) {
DocList dl = ((ResultContext) docs).getDocList();
results_found = dl.matches();

View File

@ -59,9 +59,8 @@ public class AnalyzeEvaluator extends SimpleEvaluator {
if (solrCoreObj == null || !(solrCoreObj instanceof SolrCore) ) {
throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "StreamContext must have SolrCore in solr-core key");
}
SolrCore solrCore = (SolrCore) solrCoreObj;
analyzer = solrCore.getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer();
analyzer = ((SolrCore) solrCoreObj).getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer();
}
private void init(String fieldName, String analyzerField) {

View File

@ -85,8 +85,7 @@ public class ClassifyStream extends TupleStream implements Expressible {
if (solrCoreObj == null || !(solrCoreObj instanceof SolrCore) ) {
throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "StreamContext must have SolrCore in solr-core key");
}
SolrCore solrCore = (SolrCore) solrCoreObj;
analyzer = solrCore.getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer();
analyzer = ((SolrCore) solrCoreObj).getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer();
this.docStream.setStreamContext(context);
this.modelStream.setStreamContext(context);