2012-10-24 4 views

답변

1

이 방법은 SolrPluginUtils 클래스에서 제거됩니다. 하지만 직접 작성할 수 있습니다. 코드는 매우 직선입니다.

public static void addOrReplaceResults(SolrQueryResponse rsp, SolrDocumentList docs) 
    { 
    NamedList vals = rsp.getValues(); 
    int idx = vals.indexOf("response", 0); 
    if(idx >= 0) { 
     log.debug("Replacing DocList with SolrDocumentList " + docs.size()); 
     vals.setVal(idx, docs); 
    } 
    else { 
     log.debug("Adding SolrDocumentList response" + docs.size()); 
     vals.add("response", docs); 
    } 
    }