コード例 #1
0
 private List<RetrievalResult> retrieveDocuments(String query) {
   List<RetrievalResult> result = new ArrayList<RetrievalResult>();
   try {
     SolrDocumentList docs = wrapper.runQuery(query, hitListSize);
     for (SolrDocument doc : docs) {
       RetrievalResult r =
           new RetrievalResult(
               (String) doc.getFieldValue("id"), (Float) doc.getFieldValue("score"), query);
       result.add(r);
       System.out.println(doc.getFieldValue("id"));
     }
   } catch (Exception e) {
     System.err.println("Error retrieving documents from Solr: " + e);
   }
   return result;
 }
コード例 #2
0
 @Override
 public void collectionProcessComplete() throws AnalysisEngineProcessException {
   super.collectionProcessComplete();
   wrapper.close();
 }