Java 类org.apache.lucene.search.similarities.Similarity.SimScorer 实例源码

项目:lams    文件:PhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:lams    文件:TermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "termFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }
  return new ComplexExplanation(false, 0.0f, "no matching term");      
}
项目:lams    文件:SpanWeight.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  SpanScorer scorer = (SpanScorer) scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:lams    文件:MultiPhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:ir-generalized-translation-models    文件:AugmentedTermQuery.java   
@Override
public Explanation explain(LeafReaderContext context, int doc) throws IOException {
    Scorer scorer = scorer(context);
    if (scorer != null) {
        int newDoc = scorer.iterator().advance(doc);
        if (newDoc == doc) {
            float freq = scorer.freq();
            SimScorer docScorer = similarity.simScorer(stats, context);
            Explanation freqExplanation = Explanation.match(freq, "termFreq=" + freq);
            Explanation scoreExplanation = docScorer.explain(doc, freqExplanation);
            return Explanation.match(
                    scoreExplanation.getValue(),
                    "weight(" + getQuery() + " in " + doc + ") ["
                            + similarity.getClass().getSimpleName() + "], result of:",
                    scoreExplanation);
        }
    }
    return Explanation.noMatch("no matching mainTerm");
}
项目:DoSeR-Disambiguation    文件:TermQuery.java   
@Override
public Explanation explain(final AtomicReaderContext context,
        final int doc) throws IOException {
    final Scorer scorer = scorer(context, context.reader()
            .getLiveDocs());
    if (scorer != null) {
        final int newDoc = scorer.advance(doc);
        if (newDoc == doc) {
            final float freq = scorer.freq();
            final SimScorer docScorer = similarity.simScorer(stats,
                    context);
            final ComplexExplanation result = new ComplexExplanation();
            result.setDescription("weight(" + getQuery() + " in " + doc
                    + ") [" + similarity.getClass().getSimpleName()
                    + "], result of:");
            final Explanation scoreExplanation = docScorer.explain(doc,
                    new Explanation(freq, "termFreq=" + freq));
            result.addDetail(scoreExplanation);
            result.setValue(scoreExplanation.getValue());
            result.setMatch(true);
            return result;
        }
    }
    return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:DoSeR-Disambiguation    文件:LearnToRankTermQuery.java   
@Override
public Explanation explain(final AtomicReaderContext context,
        final int doc) throws IOException {
    final Scorer scorer = scorer(context, context.reader()
            .getLiveDocs());
    if (scorer != null) {
        final int newDoc = scorer.advance(doc);
        if (newDoc == doc) {
            final float freq = scorer.freq();
            final SimScorer docScorer = sim.simScorer(stats, context);
            final ComplexExplanation result = new ComplexExplanation();
            result.setDescription("weight(" + getQuery() + " in " + doc
                    + ") [" + sim.getClass().getSimpleName()
                    + "], result of:");
            final Explanation scoreExplanation = docScorer.explain(doc,
                    new Explanation(freq, "termFreq=" + freq));
            result.addDetail(scoreExplanation);
            result.setValue(scoreExplanation.getValue());
            result.setMatch(true);
            return result;
        }
    }
    return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:search    文件:PhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:search    文件:TermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "termFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }
  return new ComplexExplanation(false, 0.0f, "no matching term");      
}
项目:search    文件:SpanWeight.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  SpanScorer scorer = (SpanScorer) scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:search    文件:MultiPhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:DoSeR    文件:TermQuery.java   
@Override
public Explanation explain(final AtomicReaderContext context,
        final int doc) throws IOException {
    final Scorer scorer = scorer(context, context.reader()
            .getLiveDocs());
    if (scorer != null) {
        final int newDoc = scorer.advance(doc);
        if (newDoc == doc) {
            final float freq = scorer.freq();
            final SimScorer docScorer = similarity.simScorer(stats,
                    context);
            final ComplexExplanation result = new ComplexExplanation();
            result.setDescription("weight(" + getQuery() + " in " + doc
                    + ") [" + similarity.getClass().getSimpleName()
                    + "], result of:");
            final Explanation scoreExplanation = docScorer.explain(doc,
                    new Explanation(freq, "termFreq=" + freq));
            result.addDetail(scoreExplanation);
            result.setValue(scoreExplanation.getValue());
            result.setMatch(true);
            return result;
        }
    }
    return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:DoSeR    文件:LearnToRankTermQuery.java   
@Override
public Explanation explain(final AtomicReaderContext context,
        final int doc) throws IOException {
    final Scorer scorer = scorer(context, context.reader()
            .getLiveDocs());
    if (scorer != null) {
        final int newDoc = scorer.advance(doc);
        if (newDoc == doc) {
            final float freq = scorer.freq();
            final SimScorer docScorer = sim.simScorer(stats, context);
            final ComplexExplanation result = new ComplexExplanation();
            result.setDescription("weight(" + getQuery() + " in " + doc
                    + ") [" + sim.getClass().getSimpleName()
                    + "], result of:");
            final Explanation scoreExplanation = docScorer.explain(doc,
                    new Explanation(freq, "termFreq=" + freq));
            result.addDetail(scoreExplanation);
            result.setValue(scoreExplanation.getValue());
            result.setMatch(true);
            return result;
        }
    }
    return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:querqy    文件:DependentTermQuery.java   
@Override
public Explanation explain(LeafReaderContext context, int doc) throws IOException {
    Scorer scorer = scorer(context);
    if (scorer != null) {
      int newDoc = scorer.iterator().advance(doc);
      if (newDoc == doc) {
        float freq = scorer.freq();
        SimScorer docScorer = similarity.simScorer(stats, context);
        Explanation freqExplanation = Explanation.match(freq, "termFreq=" + freq);
        Explanation scoreExplanation = docScorer.explain(doc, freqExplanation);
        return Explanation.match(
            scoreExplanation.getValue(),
            "weight(" + getQuery() + " in " + doc + ") ["
                + similarity.getClass().getSimpleName() + ", " + fieldBoost.getClass().getSimpleName() + "], result of:",
            scoreExplanation );
      }
    }
    return Explanation.noMatch("no matching term");
}
项目:read-open-source-code    文件:PhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:TermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "termFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }
  return new ComplexExplanation(false, 0.0f, "no matching term");      
}
项目:read-open-source-code    文件:SpanWeight.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  SpanScorer scorer = (SpanScorer) scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:MultiPhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:PhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:TermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "termFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }
  return new ComplexExplanation(false, 0.0f, "no matching term");      
}
项目:read-open-source-code    文件:SpanWeight.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  SpanScorer scorer = (SpanScorer) scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:MultiPhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:PhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:TermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "termFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }
  return new ComplexExplanation(false, 0.0f, "no matching term");      
}
项目:read-open-source-code    文件:SpanWeight.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  SpanScorer scorer = (SpanScorer) scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:MultiPhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:Maskana-Gestor-de-Conocimiento    文件:PhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:Maskana-Gestor-de-Conocimiento    文件:TermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "termFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);
      return result;
    }
  }
  return new ComplexExplanation(false, 0.0f, "no matching term");      
}
项目:Maskana-Gestor-de-Conocimiento    文件:SpanWeight.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  SpanScorer scorer = (SpanScorer) scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:Maskana-Gestor-de-Conocimiento    文件:MultiPhraseQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = slop == 0 ? scorer.freq() : ((SloppyPhraseScorer)scorer).sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      ComplexExplanation result = new ComplexExplanation();
      result.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      result.addDetail(scoreExplanation);
      result.setValue(scoreExplanation.getValue());
      result.setMatch(true);          
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:lams    文件:PayloadNearQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadNearSpanScorer scorer = (PayloadNearSpanScorer) scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      String field = ((SpanQuery)getQuery()).getField();
      // now the payloads part
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      // combined
      ComplexExplanation result = new ComplexExplanation();
      result.addDetail(expl);
      result.addDetail(payloadExpl);
      result.setValue(expl.getValue() * payloadExpl.getValue());
      result.setDescription("PayloadNearQuery, product of:");
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:lams    文件:PayloadTermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadTermSpanScorer scorer = (PayloadTermSpanScorer) scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      // now the payloads part
      // QUESTION: Is there a way to avoid this skipTo call? We need to know
      // whether to load the payload or not
      // GSI: I suppose we could toString the payload, but I don't think that
      // would be a good idea
      String field = ((SpanQuery)getQuery()).getField();
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      payloadExpl.setValue(scorer.getPayloadScore());
      // combined
      ComplexExplanation result = new ComplexExplanation();
      if (includeSpanScore) {
        result.addDetail(expl);
        result.addDetail(payloadExpl);
        result.setValue(expl.getValue() * payloadExpl.getValue());
        result.setDescription("btq, product of:");
      } else {
        result.addDetail(payloadExpl);
        result.setValue(payloadExpl.getValue());
        result.setDescription("btq(includeSpanScore=false), result of:");
      }
      result.setMatch(true); // LUCENE-1303
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:search    文件:PayloadNearQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadNearSpanScorer scorer = (PayloadNearSpanScorer) scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      String field = ((SpanQuery)getQuery()).getField();
      // now the payloads part
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      // combined
      ComplexExplanation result = new ComplexExplanation();
      result.addDetail(expl);
      result.addDetail(payloadExpl);
      result.setValue(expl.getValue() * payloadExpl.getValue());
      result.setDescription("PayloadNearQuery, product of:");
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:search    文件:PayloadTermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadTermSpanScorer scorer = (PayloadTermSpanScorer) scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      // now the payloads part
      // QUESTION: Is there a way to avoid this skipTo call? We need to know
      // whether to load the payload or not
      // GSI: I suppose we could toString the payload, but I don't think that
      // would be a good idea
      String field = ((SpanQuery)getQuery()).getField();
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      payloadExpl.setValue(scorer.getPayloadScore());
      // combined
      ComplexExplanation result = new ComplexExplanation();
      if (includeSpanScore) {
        result.addDetail(expl);
        result.addDetail(payloadExpl);
        result.setValue(expl.getValue() * payloadExpl.getValue());
        result.setDescription("btq, product of:");
      } else {
        result.addDetail(payloadExpl);
        result.setValue(payloadExpl.getValue());
        result.setDescription("btq(includeSpanScore=false), result of:");
      }
      result.setMatch(true); // LUCENE-1303
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:pyramid    文件:CustomSpanWeight.java   
@Override
public PhraseCountScorer scorer(LeafReaderContext context) throws IOException {
  final Spans spans = getSpans(context, Postings.POSITIONS);
  if (spans == null) {
    return null;
  }
  final SimScorer docScorer = getSimScorer(context);
  return new PhraseCountScorer(this, spans, docScorer, weightedCount);
}
项目:read-open-source-code    文件:PayloadNearQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadNearSpanScorer scorer = (PayloadNearSpanScorer) scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      String field = ((SpanQuery)getQuery()).getField();
      // now the payloads part
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      // combined
      ComplexExplanation result = new ComplexExplanation();
      result.addDetail(expl);
      result.addDetail(payloadExpl);
      result.setValue(expl.getValue() * payloadExpl.getValue());
      result.setDescription("PayloadNearQuery, product of:");
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:PayloadTermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadTermSpanScorer scorer = (PayloadTermSpanScorer) scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      // now the payloads part
      // QUESTION: Is there a way to avoid this skipTo call? We need to know
      // whether to load the payload or not
      // GSI: I suppose we could toString the payload, but I don't think that
      // would be a good idea
      String field = ((SpanQuery)getQuery()).getField();
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      payloadExpl.setValue(scorer.getPayloadScore());
      // combined
      ComplexExplanation result = new ComplexExplanation();
      if (includeSpanScore) {
        result.addDetail(expl);
        result.addDetail(payloadExpl);
        result.setValue(expl.getValue() * payloadExpl.getValue());
        result.setDescription("btq, product of:");
      } else {
        result.addDetail(payloadExpl);
        result.setValue(payloadExpl.getValue());
        result.setDescription("btq(includeSpanScore=false), result of:");
      }
      result.setMatch(true); // LUCENE-1303
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:PayloadNearQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadNearSpanScorer scorer = (PayloadNearSpanScorer) scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      String field = ((SpanQuery)getQuery()).getField();
      // now the payloads part
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      // combined
      ComplexExplanation result = new ComplexExplanation();
      result.addDetail(expl);
      result.addDetail(payloadExpl);
      result.setValue(expl.getValue() * payloadExpl.getValue());
      result.setDescription("PayloadNearQuery, product of:");
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:PayloadTermQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadTermSpanScorer scorer = (PayloadTermSpanScorer) scorer(context, true, false, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.sloppyFreq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      // now the payloads part
      // QUESTION: Is there a way to avoid this skipTo call? We need to know
      // whether to load the payload or not
      // GSI: I suppose we could toString the payload, but I don't think that
      // would be a good idea
      String field = ((SpanQuery)getQuery()).getField();
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      payloadExpl.setValue(scorer.getPayloadScore());
      // combined
      ComplexExplanation result = new ComplexExplanation();
      if (includeSpanScore) {
        result.addDetail(expl);
        result.addDetail(payloadExpl);
        result.setValue(expl.getValue() * payloadExpl.getValue());
        result.setDescription("btq, product of:");
      } else {
        result.addDetail(payloadExpl);
        result.setValue(payloadExpl.getValue());
        result.setDescription("btq(includeSpanScore=false), result of:");
      }
      result.setMatch(true); // LUCENE-1303
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}
项目:read-open-source-code    文件:PayloadNearQuery.java   
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  PayloadNearSpanScorer scorer = (PayloadNearSpanScorer) scorer(context, context.reader().getLiveDocs());
  if (scorer != null) {
    int newDoc = scorer.advance(doc);
    if (newDoc == doc) {
      float freq = scorer.freq();
      SimScorer docScorer = similarity.simScorer(stats, context);
      Explanation expl = new Explanation();
      expl.setDescription("weight("+getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
      Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "phraseFreq=" + freq));
      expl.addDetail(scoreExplanation);
      expl.setValue(scoreExplanation.getValue());
      String field = ((SpanQuery)getQuery()).getField();
      // now the payloads part
      Explanation payloadExpl = function.explain(doc, field, scorer.payloadsSeen, scorer.payloadScore);
      // combined
      ComplexExplanation result = new ComplexExplanation();
      result.addDetail(expl);
      result.addDetail(payloadExpl);
      result.setValue(expl.getValue() * payloadExpl.getValue());
      result.setDescription("PayloadNearQuery, product of:");
      return result;
    }
  }

  return new ComplexExplanation(false, 0.0f, "no matching term");
}