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


Java Similarity.SimScorer方法代码示例

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


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

示例1: SeqSpanScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
SeqSpanScorer(SeqSpanWeight weight, PostingsAndFreq[] postings,
                  Similarity.SimScorer docScorer, boolean needsScores,
                  float matchCost) throws IOException {
  super(weight);
  this.selfWeight = weight;
  this.docScorer = docScorer;
  this.needsScores = needsScores;

  List<DocIdSetIterator> iterators = new ArrayList<>();
  List<PostingsAndPosition> postingsAndPositions = new ArrayList<>();
  for(PostingsAndFreq posting : postings) {
    iterators.add(posting.postings);
    postingsAndPositions.add(new PostingsAndPosition(posting.postings, posting.position));
  }
  conjunction = ConjunctionDISI.intersectIterators(iterators);
  this.postings = postingsAndPositions.toArray(new PostingsAndPosition[postingsAndPositions.size()]);
  this.matchCost = matchCost;
}
 
开发者ID:sing1ee,项目名称:lucene-custom-query,代码行数:19,代码来源:SeqSpanScorer.java

示例2: ExactPhraseScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
ExactPhraseScorer(Weight weight, PhraseQuery.PostingsAndFreq[] postings,
                  Similarity.SimScorer docScorer) throws IOException {
  super(weight);
  this.docScorer = docScorer;

  chunkStates = new ChunkState[postings.length];

  endMinus1 = postings.length-1;
  
  lead = postings[0].postings;
  // min(cost)
  cost = lead.cost();

  for(int i=0;i<postings.length;i++) {
    chunkStates[i] = new ChunkState(postings[i].postings, -postings[i].position);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:ExactPhraseScorer.java

示例3: SpanScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
protected SpanScorer(Spans spans, Weight weight, Similarity.SimScorer docScorer)
throws IOException {
  super(weight);
  this.docScorer = docScorer;
  this.spans = spans;

  doc = -1;
  more = spans.next();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:SpanScorer.java

示例4: SloppyPhraseScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
SloppyPhraseScorer(Weight weight, PhraseQuery.PostingsAndFreq[] postings,
    int slop, Similarity.SimScorer docScorer) {
  super(weight);
  this.docScorer = docScorer;
  this.slop = slop;
  this.numPostings = postings==null ? 0 : postings.length;
  pq = new PhraseQueue(postings.length);
  // min(cost)
  cost = postings[0].postings.cost();
  // convert tps to a list of phrase positions.
  // note: phrase-position differs from term-position in that its position
  // reflects the phrase offset: pp.pos = tp.pos - offset.
  // this allows to easily identify a matching (exact) phrase 
  // when all PhrasePositions have exactly the same position.
  if (postings.length > 0) {
    min = new PhrasePositions(postings[0].postings, postings[0].position, 0, postings[0].terms);
    max = min;
    max.doc = -1;
    for (int i = 1; i < postings.length; i++) {
      PhrasePositions pp = new PhrasePositions(postings[i].postings, postings[i].position, i, postings[i].terms);
      max.next = pp;
      max = pp;
      max.doc = -1;
    }
    max.next = min; // make it cyclic for easier manipulation
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:SloppyPhraseScorer.java

示例5: AugmentedTermScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
/**
 * Construct an <code>query.{@link AugmentedTermScorer}</code>.
 *
 * @param weight
 *          The weight of the <code>Term</code> in the query.
 * @param mainTerm
 *          An iterator over the documents matching the main <code>Term</code>.
 * @param similarPostings
 *          A list of <code>PostingsEnumWeightTuple</code>: term iterator, weight pairs
 * @param docScorer
 *          The <code>Similarity.SimScorer</code> implementation
 *          to be used for score computations.
 */
public AugmentedTermScorer(Weight weight, PostingsEnum mainTerm, List<PostingsEnumWeightTuple> similarPostings, Similarity.SimScorer docScorer) {
    super(weight);

    this.postings = new PostingsEnumWeightTuple[similarPostings.size() + 1];
    this.postings[0] = new PostingsEnumWeightTuple(mainTerm,1f);
    for (int i = 0; i < similarPostings.size(); i++) {
        this.postings[i + 1] = similarPostings.get(i);
    }

    this.iterator = new MultiDocIdSetIterator(this.postings);

    this.docScorer = docScorer;
}
 
开发者ID:sebastian-hofstaetter,项目名称:ir-generalized-translation-models,代码行数:27,代码来源:AugmentedTermScorer.java

示例6: TermDocsEnum

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
public TermDocsEnum(FlexibleQuery.FlexibleTerm term, int docFreq, DocsAndPositionsEnum postings, Similarity.SimScorer docScorer, int termPos) throws IOException {
  this.term = term;
  this.postings = postings;
  this.docFreq = docFreq;
  this.docScorer = docScorer;
  this.termPos = termPos;
}
 
开发者ID:XiaoMi,项目名称:linden,代码行数:8,代码来源:TermDocsEnum.java

示例7: TermAutomatonScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
public TermAutomatonScorer(TermAutomatonWeight weight, EnumAndScorer[] subs, int anyTermID, Map<Integer,BytesRef> idToTerm, Similarity.SimScorer docScorer) throws IOException {
  super(weight);
  //System.out.println("  automaton:\n" + weight.automaton.toDot());
  this.runAutomaton = new TermRunAutomaton(weight.automaton, subs.length);
  this.docScorer = docScorer;
  this.idToTerm = idToTerm;
  this.subs = subs;
  this.docIDQueue = new DocIDQueue(subs.length);
  this.posQueue = new PositionQueue(subs.length);
  this.anyTermID = anyTermID;
  this.subsOnDoc = new EnumAndScorer[subs.length];
  this.positions = new PosState[4];
  for(int i=0;i<this.positions.length;i++) {
    this.positions[i] = new PosState();
  }
  long cost = 0;

  // Init docIDQueue:
  for(EnumAndScorer sub : subs) {
    if (sub != null) {
      cost += sub.posEnum.cost();

      if (sub.posEnum.nextDoc() != NO_MORE_DOCS) {
        sub.posLeft = sub.posEnum.freq()-1;
        sub.pos = sub.posEnum.nextPosition();
      }
        
      docIDQueue.add(sub);
    }
  }
  this.cost = cost;
}
 
开发者ID:europeana,项目名称:search,代码行数:33,代码来源:TermAutomatonScorer.java

示例8: AllTermScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
AllTermScorer(Weight weight, PostingsEnum postings, Similarity.SimScorer docScorer) {
    super(weight);
    this.postings = postings;
    this.docScorer = docScorer;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:AllTermQuery.java

示例9: PayloadNearSpanScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
protected PayloadNearSpanScorer(Spans spans, Weight weight,
    Similarity similarity, Similarity.SimScorer docScorer) throws IOException {
  super(spans, weight, docScorer);
  this.spans = spans;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:PayloadNearQuery.java

示例10: PayloadTermSpanScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
public PayloadTermSpanScorer(TermSpans spans, Weight weight, Similarity.SimScorer docScorer) throws IOException {
  super(spans, weight, docScorer);
  termSpans = spans;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:PayloadTermQuery.java

示例11: JustCompileSpanScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
protected JustCompileSpanScorer(Spans spans, Weight weight,
    Similarity.SimScorer docScorer) throws IOException {
  super(spans, weight, docScorer);
}
 
开发者ID:europeana,项目名称:search,代码行数:5,代码来源:JustCompileSearchSpans.java

示例12: TermScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
/**
 * Construct a <code>TermScorer</code>.
 * 
 * @param weight
 *            The weight of the <code>Term</code> in the query.
 * @param docsEnum
 *            An iterator over the documents matching the <code>Term</code>.
 * @param docScorer
 *            The </code>Similarity.SimScorer</code> implementation to be
 *            used for score computations.
 */
TermScorer(final Weight weight, final DocsEnum docsEnum,
		final Similarity.SimScorer docScorer) {
	super(weight);
	this.docScorer = docScorer;
	this.docsEnum = docsEnum;
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:18,代码来源:TermScorer.java

示例13: LearnToRankTermScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
/**
 * Construct a <code>TermScorer</code>.
 * 
 * @param weight
 *            The weight of the <code>Term</code> in the query.
 * @param docsEnum
 *            An iterator over the documents matching the <code>Term</code>.
 * @param docScorer
 *            The </code>Similarity.ExactSimScorer</code> implementation to
 *            be used for score computations.
 * @param docFreq
 *            per-segment docFreq of this term
 */
LearnToRankTermScorer(final Weight weight, final DocsEnum docsEnum,
		final Similarity.SimScorer docScorer) {
	super(weight);
	this.docScorer = docScorer;
	this.docsEnum = docsEnum;
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:20,代码来源:LearnToRankTermScorer.java

示例14: TermScorer

import org.apache.lucene.search.similarities.Similarity; //导入方法依赖的package包/类
/**
 * Construct a <code>TermScorer</code>.
 * 
 * @param weight
 *          The weight of the <code>Term</code> in the query.
 * @param td
 *          An iterator over the documents matching the <code>Term</code>.
 * @param docScorer
 *          The </code>Similarity.SimScorer</code> implementation 
 *          to be used for score computations.
 */
TermScorer(Weight weight, DocsEnum td, Similarity.SimScorer docScorer) {
  super(weight);
  this.docScorer = docScorer;
  this.docsEnum = td;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:TermScorer.java


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