public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { var fields = readerContext.AtomicReader.Fields; var terms = fields.GetTerms(m_indexedField); var searcher = (IndexSearcher)context["searcher"]; var similarity = IDFValueSource.AsTFIDF(searcher.Similarity, m_indexedField); if (similarity == null) { throw new NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)"); } return(new SingleDocValuesAnonymousInnerClassHelper(this, this, terms, similarity)); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { var searcher = (IndexSearcher)context["searcher"]; TFIDFSimilarity similarity = IDFValueSource.AsTFIDF(searcher.Similarity, m_field); if (similarity == null) { throw new NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)"); } NumericDocValues norms = readerContext.AtomicReader.GetNormValues(m_field); if (norms == null) { return(new ConstDoubleDocValues(0.0, this)); } return(new SingleDocValuesAnonymousInnerClassHelper(this, this, similarity, norms)); }