当前位置: 首页>>代码示例>>Java>>正文


Java ComplexExplanation.addDetail方法代码示例

本文整理汇总了Java中org.apache.lucene.search.ComplexExplanation.addDetail方法的典型用法代码示例。如果您正苦于以下问题:Java ComplexExplanation.addDetail方法的具体用法?Java ComplexExplanation.addDetail怎么用?Java ComplexExplanation.addDetail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.search.ComplexExplanation的用法示例。


在下文中一共展示了ComplexExplanation.addDetail方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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");
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:26,代码来源:TermQuery.java

示例2: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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");
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:25,代码来源:LearnToRankTermQuery.java

示例3: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, context.reader().getLiveDocs());
  boolean exists = scorer.advance(doc) == doc;

  ComplexExplanation result = new ComplexExplanation();

  if (exists) {
    result.setDescription(this.toString()
    + " , product of:");
    result.setValue(queryWeight);
    result.setMatch(Boolean.TRUE);
    result.addDetail(new Explanation(getBoost(), "boost"));
    result.addDetail(new Explanation(queryNorm,"queryNorm"));
  } else {
    result.setDescription(this.toString()
    + " doesn't match id " + doc);
    result.setValue(0);
    result.setMatch(Boolean.FALSE);
  }
  return result;
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:JoinQParserPlugin.java

示例4: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
	// TODO: figure out what this actually is!
	final Scorer cs = scorer(context, context.reader().getLiveDocs());
	final boolean exists = (cs != null && cs.advance(doc) == doc);
	final ComplexExplanation result = new ComplexExplanation();
	if (exists) {
		result.setDescription(GraphQuery.this.toString() + ", product of:");
		result.setValue(queryWeight);
		result.setMatch(Boolean.TRUE);
		result.addDetail(new Explanation(getBoost(), "boost"));
		result.addDetail(new Explanation(queryNorm, "queryNorm"));
	} else {
		result.setDescription(GraphQuery.this.toString() + " doesn't match id " + doc);
		result.setValue(0);
		result.setMatch(Boolean.FALSE);
	}
	return result;
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:20,代码来源:GraphQuery.java

示例5: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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();
			ExactSimScorer docScorer = sim.exactSimScorer(stats,
					context);
			ComplexExplanation result = new ComplexExplanation();
			result.setDescription("weight(" + getQuery() + " in " + doc
					+ ") [" + sim.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");
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:26,代码来源:LearnToRankTermQuery.java

示例6: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@Override
public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
  Scorer scorer = scorer(context, true, false, context.reader().getLiveDocs());
  boolean exists = scorer.advance(doc) == doc;

  ComplexExplanation result = new ComplexExplanation();

  if (exists) {
    result.setDescription(this.toString()
    + " , product of:");
    result.setValue(queryWeight);
    result.setMatch(Boolean.TRUE);
    result.addDetail(new Explanation(getBoost(), "boost"));
    result.addDetail(new Explanation(queryNorm,"queryNorm"));
  } else {
    result.setDescription(this.toString()
    + " doesn't match id " + doc);
    result.setValue(0);
    result.setMatch(Boolean.FALSE);
  }
  return result;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:23,代码来源:JoinQParserPlugin.java

示例7: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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");
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:PayloadNearQuery.java

示例8: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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");
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:PayloadTermQuery.java

示例9: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
public Explanation explain(Similarity similarity, Query query) {
  if (!isMatched())
    return null;
  ComplexExplanation result = new ComplexExplanation();
  result.setDescription("weight("+query+" 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;
}
 
开发者ID:XiaoMi,项目名称:linden,代码行数:12,代码来源:TermDocsEnum.java

示例10: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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();
      SloppySimScorer docScorer = similarity.sloppySimScorer(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");
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:29,代码来源:PayloadNearQuery.java

示例11: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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();
      SloppySimScorer docScorer = similarity.sloppySimScorer(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");
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:41,代码来源:PayloadTermQuery.java

示例12: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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");
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:29,代码来源:PayloadNearQuery.java

示例13: explain

import org.apache.lucene.search.ComplexExplanation; //导入方法依赖的package包/类
@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");
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:41,代码来源:PayloadTermQuery.java


注:本文中的org.apache.lucene.search.ComplexExplanation.addDetail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。