@Test public void addOutputToResponse() { new Expectations(){{ response.add("top_parsed_query", testParsings[0].toString()); response.add("top_parsed_phrases", testParsings[0].toStringArray()); response.add("potential_parsings", any); }}; ParseRequestHandler target = new ParseRequestHandler(); Deencapsulation.invoke(target, "addOutputToResponse", response, testParsings, new ArrayList<TreeMap<String, Object>>()); }
private void addOutputToResponse(SolrQueryResponse rsp, Parsing[] parsings, List<TreeMap<String, Object>> scoringOutput) { TreeMap<String, Object>[] output = new TreeMap[parsings.length]; for(int i = 0; i < parsings.length; ++i) { output[i] = new TreeMap<String, Object>(); output[i].put("score", parsings[i].getScore()); output[i].put("parsed_phrases", parsings[i].toStringArray()); output[i].put("parsed_query", parsings[i].toString()); } if(parsings.length > 0) { rsp.add("top_parsed_query", parsings[0].toString()); rsp.add("top_parsed_phrases", parsings[0].toStringArray()); rsp.add("potential_parsings", output); if(scoringOutput != null && scoringOutput.size()>0) rsp.add("scoring_information", scoringOutput); } else{ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No recognizable terms specified."); } }
ParseRequestHandler extends RequestHandlerBase { private void addOutputToResponse(SolrQueryResponse rsp, Parsing[] parsings, List<TreeMap<String, Object>> scoringOutput) { TreeMap<String, Object>[] output = new TreeMap[parsings.length]; for(int i = 0; i < parsings.length; ++i) { output[i] = new TreeMap<String, Object>(); output[i].put("score", parsings[i].getScore()); output[i].put("parsed_phrases", parsings[i].toStringArray()); output[i].put("parsed_query", parsings[i].toString()); } if(parsings.length > 0) { rsp.add("top_parsed_query", parsings[0].toString()); rsp.add("top_parsed_phrases", parsings[0].toStringArray()); rsp.add("potential_parsings", output); if(scoringOutput != null && scoringOutput.size()>0) rsp.add("scoring_information", scoringOutput); } else{ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No recognizable terms specified."); } } }
ParseRequestHandler extends RequestHandlerBase { private void addOutputToResponse(SolrQueryResponse rsp, Parsing[] parsings, List<TreeMap<String, Object>> scoringOutput) { TreeMap<String, Object>[] output = new TreeMap[parsings.length]; for(int i = 0; i < parsings.length; ++i) { output[i] = new TreeMap<String, Object>(); output[i].put("score", parsings[i].getScore()); output[i].put("parsed_phrases", parsings[i].toStringArray()); output[i].put("parsed_query", parsings[i].toString()); } if(parsings.length > 0) { rsp.add("top_parsed_query", parsings[0].toString()); rsp.add("top_parsed_phrases", parsings[0].toStringArray()); rsp.add("potential_parsings", output); if(scoringOutput != null && scoringOutput.size()>0) rsp.add("scoring_information", scoringOutput); } else{ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No recognizable terms specified."); } }  }
ParseRequestHandler extends RequestHandlerBase { private void addOutputToResponse(SolrQueryResponse rsp, Parsing[] parsings, List<TreeMap<String, Object>> scoringOutput) { TreeMap<String, Object>[] output = new TreeMap[parsings.length]; for(int i = 0; i < parsings.length; ++i) { output[i] = new TreeMap<String, Object>(); output[i].put("score", parsings[i].getScore()); output[i].put("parsed_phrases", parsings[i].toStringArray()); output[i].put("parsed_query", parsings[i].toString()); } if(parsings.length > 0) { rsp.add("top_parsed_query", parsings[0].toString()); rsp.add("top_parsed_phrases", parsings[0].toStringArray()); rsp.add("potential_parsings", output); if(scoringOutput != null && scoringOutput.size()>0) rsp.add("scoring_information", scoringOutput); } else{ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No recognizable terms specified."); } }  @Override void init(NamedList args); @Override void handleRequestBody(SolrQueryRequest request, SolrQueryResponse rsp); @Override String getDescription(); }
ParseRequestHandler extends RequestHandlerBase { private void addOutputToResponse(SolrQueryResponse rsp, Parsing[] parsings, List<TreeMap<String, Object>> scoringOutput) { TreeMap<String, Object>[] output = new TreeMap[parsings.length]; for(int i = 0; i < parsings.length; ++i) { output[i] = new TreeMap<String, Object>(); output[i].put("score", parsings[i].getScore()); output[i].put("parsed_phrases", parsings[i].toStringArray()); output[i].put("parsed_query", parsings[i].toString()); } if(parsings.length > 0) { rsp.add("top_parsed_query", parsings[0].toString()); rsp.add("top_parsed_phrases", parsings[0].toStringArray()); rsp.add("potential_parsings", output); if(scoringOutput != null && scoringOutput.size()>0) rsp.add("scoring_information", scoringOutput); } else{ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No recognizable terms specified."); } }  @Override void init(NamedList args); @Override void handleRequestBody(SolrQueryRequest request, SolrQueryResponse rsp); @Override String getDescription();  }