本文整理汇总了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;
}
示例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);
}
}
示例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();
}
示例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
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}