當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。