コード例 #1
0
 @Override
 public List<RescoreSearchContext> rescore() {
   if (rescore == null) {
     return Collections.emptyList();
   }
   return rescore;
 }
コード例 #2
0
 private TopDocs rerank(TopDocs docs, LireFeature feature, IndexReader reader)
     throws IOException, IllegalAccessException, InstantiationException {
   LireFeature tmp = new CEDD();
   ArrayList<ScoreDoc> res = new ArrayList<ScoreDoc>(docs.scoreDocs.length);
   float maxScore = 0f;
   for (int i = 0; i < docs.scoreDocs.length; i++) {
     tmp.setByteArrayRepresentation(
         reader
             .document(docs.scoreDocs[i].doc)
             .getField(DocumentBuilder.FIELD_NAME_CEDD)
             .binaryValue()
             .bytes,
         reader
             .document(docs.scoreDocs[i].doc)
             .getField(DocumentBuilder.FIELD_NAME_CEDD)
             .binaryValue()
             .offset,
         reader
             .document(docs.scoreDocs[i].doc)
             .getField(DocumentBuilder.FIELD_NAME_CEDD)
             .binaryValue()
             .length);
     maxScore = Math.max(1 / tmp.getDistance(feature), maxScore);
     res.add(new ScoreDoc(docs.scoreDocs[i].doc, 1 / tmp.getDistance(feature)));
   }
   // sorting res ...
   Collections.sort(
       res,
       new Comparator<ScoreDoc>() {
         @Override
         public int compare(ScoreDoc o1, ScoreDoc o2) {
           return (int) Math.signum(o2.score - o1.score);
         }
       });
   return new TopDocs(numImagesEval, (ScoreDoc[]) res.toArray(new ScoreDoc[res.size()]), maxScore);
 }
コード例 #3
0
 @Override
 public void emptyFieldNames() {
   this.fieldNames = Collections.emptyList();
 }