Exemple #1
0
func (ts *TFIDFSimilarity) simScorer(stats SimWeight, ctx index.AtomicReaderContext) (ss SimScorer, err error) {
	idfstats := stats.(*idfStats)
	ndv, err := ctx.Reader().(index.AtomicReader).NormValues(idfstats.field)
	if err != nil {
		return nil, err
	}
	return newTFIDSimScorer(ts, idfstats, ndv), nil
}
Exemple #2
0
func (tw TermWeight) termsEnum(ctx index.AtomicReaderContext) (te index.TermsEnum, err error) {
	state := tw.termStates.State(ctx.Ord)
	if state == nil { // term is not present in that reader
		// assert termNotInReader(ctx.Reader(), tw.Term)
		// : "no termstate found but term exists in reader term=" + term;
		return index.EMPTY_TERMS_ENUM, nil
	}
	te = ctx.Reader().(index.AtomicReader).Terms(tw.term.Field).Iterator(index.EMPTY_TERMS_ENUM)
	err = te.SeekExactFromLast(tw.term.Bytes, *state)
	return
}