public _VisitorTemplate_55(IntersectsPrefixTreeFilter _enclosing, AtomicReaderContext baseArg1, IBits baseArg2, bool baseArg3) : base(_enclosing, baseArg1, baseArg2, baseArg3) { this._enclosing = _enclosing; }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { var arr = cache.GetDoubles(readerContext.AtomicReader, field, parser, true); var valid = cache.GetDocsWithField(readerContext.AtomicReader, field); return new DoubleDocValuesAnonymousInnerClassHelper(this, arr, valid); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { IDictionary<string, FunctionValues> valuesCache = (IDictionary<string, FunctionValues>)context["valuesCache"]; if (valuesCache == null) { valuesCache = new Dictionary<string, FunctionValues>(); context = new Hashtable(context); context["valuesCache"] = valuesCache; } FunctionValues[] externalValues = new FunctionValues[expression.variables.Length]; for (int i = 0; i < variables.Length; ++i) { string externalName = expression.variables[i]; FunctionValues values; if (!valuesCache.TryGetValue(externalName,out values)) { values = variables[i].GetValues(context, readerContext); if (values == null) { throw new SystemException("Internal error. External (" + externalName + ") does not exist."); } valuesCache[externalName] = values; } externalValues[i] = values; } return new ExpressionFunctionValues(this, expression, externalValues); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { Fields fields = readerContext.AtomicReader.Fields; Terms terms = fields.Terms(indexedField); return new IntDocValuesAnonymousInnerClassHelper(this, this, terms); }
public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs) { Bits docsWithField = FieldCache.DEFAULT.GetDocsWithField(((AtomicReader)context.Reader), Field_Renamed); if (Negate_Renamed) { if (docsWithField is Bits_MatchAllBits) { return null; } return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.AtomicReader.MaxDoc, acceptDocs, docsWithField); } else { if (docsWithField is Bits_MatchNoBits) { return null; } if (docsWithField is DocIdSet) { // UweSays: this is always the case for our current impl - but who knows // :-) return BitsFilteredDocIdSet.Wrap((DocIdSet)docsWithField, acceptDocs); } return new FieldCacheDocIdSetAnonymousInnerClassHelper2(this, context.AtomicReader.MaxDoc, acceptDocs, docsWithField); } }
public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs) { Bits docsWithField = FieldCache.DEFAULT.GetDocsWithField(((AtomicReader)context.Reader), Field_Renamed); if (Negate_Renamed) { if (docsWithField is Bits_MatchAllBits) { return(null); } return(new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.AtomicReader.MaxDoc, acceptDocs, docsWithField)); } else { if (docsWithField is Bits_MatchNoBits) { return(null); } if (docsWithField is DocIdSet) { // UweSays: this is always the case for our current impl - but who knows // :-) return(BitsFilteredDocIdSet.Wrap((DocIdSet)docsWithField, acceptDocs)); } return(new FieldCacheDocIdSetAnonymousInnerClassHelper2(this, context.AtomicReader.MaxDoc, acceptDocs, docsWithField)); } }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { FunctionValues vals = source.GetValues(context, readerContext); FunctionValues targets = target.GetValues(context, readerContext); FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.GetValues(context, readerContext); return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals, targets, defaults); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { FunctionValues ifVals = ifSource.GetValues(context, readerContext); FunctionValues trueVals = trueSource.GetValues(context, readerContext); FunctionValues falseVals = falseSource.GetValues(context, readerContext); return new FunctionValuesAnonymousInnerClassHelper(this, ifVals, trueVals, falseVals); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { var valsArr = new FunctionValues[sources.Length]; for (int i = 0; i < sources.Length; i++) { valsArr[i] = sources[i].GetValues(context, readerContext); } return new FloatDocValuesAnonymousInnerClassHelper(this, this, valsArr); }
public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs) { if (processingMode == ProcessingMode.PM_FAST_INVALIDATION) { return FastBits(context.AtomicReader, acceptDocs); } else { return CorrectBits(context.AtomicReader, acceptDocs); } }
// TODO: this is trappy? perhaps this query instead should make you pass a slow reader yourself? public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { IndexReader topReader = ReaderUtil.GetTopLevelContext(readerContext).Reader; AtomicReader r = SlowCompositeReaderWrapper.Wrap(topReader); int off = readerContext.DocBase; var sindex = FieldCache.DEFAULT.GetTermsIndex(r, field); var end = sindex.ValueCount; return new IntDocValuesAnonymousInnerClassHelper(this, this, off, sindex, end); }
protected DocTermsIndexDocValues(ValueSource vs, AtomicReaderContext context, string field) { try { termsIndex = FieldCache.DEFAULT.GetTermsIndex(context.AtomicReader, field); } catch (Exception e) { throw new DocTermsIndexException(field, e); } this.vs = vs; }
/// <summary> /// <code>context</code> must contain a key "scorer" which is a /// <see cref="Lucene.Net.Search.Scorer">Lucene.Net.Search.Scorer</see> /// . /// </summary> /// <exception cref="System.IO.IOException"></exception> public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { Scorer v = (Scorer)context["scorer"]; hashCodeObj = v; if (v == null) { throw new InvalidOperationException("Expressions referencing the score can only be used for sorting" ); } return new ScoreFunctionValues(this, v); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { var searcher = (IndexSearcher)context["searcher"]; TFIDFSimilarity sim = AsTFIDF(searcher.Similarity, field); if (sim == null) { throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)"); } int docfreq = searcher.IndexReader.DocFreq(new Term(indexedField, indexedBytes)); float idf = sim.Idf(docfreq, searcher.IndexReader.MaxDoc); return new ConstDoubleDocValues(idf, this); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { var fields = readerContext.AtomicReader.Fields; var terms = fields.Terms(indexedField); var searcher = (IndexSearcher)context["searcher"]; var similarity = IDFValueSource.AsTFIDF(searcher.Similarity, indexedField); if (similarity == null) { throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)"); } return new FloatDocValuesAnonymousInnerClassHelper(this, this, terms, similarity); }
public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs) { Terms terms = context.AtomicReader.Terms(term.Field()); if (terms == null) { return null; } TermsEnum termsEnum = terms.Iterator(null); if (!termsEnum.SeekExact(term.Bytes())) { return null; } return new DocIdSetAnonymousInnerClassHelper(this, acceptDocs, termsEnum); }
public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs) { SortedDocValues fcsi = FieldCache.GetTermsIndex((context.AtomicReader), Field); FixedBitSet bits = new FixedBitSet(fcsi.ValueCount); for (int i = 0; i < Terms.Length; i++) { int ord = fcsi.LookupTerm(Terms[i]); if (ord >= 0) { bits.Set(ord); } } return(new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader.MaxDoc, acceptDocs, fcsi, bits)); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { FieldInfo fieldInfo = readerContext.AtomicReader.FieldInfos.FieldInfo(field); // To be sorted or not to be sorted, that is the question // TODO: do it cleaner? if (fieldInfo != null && fieldInfo.DocValuesType == FieldInfo.DocValuesType_e.BINARY) { BinaryDocValues binaryValues = Search.FieldCache.DEFAULT.GetTerms(readerContext.AtomicReader, field, true); Bits docsWithField = Search.FieldCache.DEFAULT.GetDocsWithField(readerContext.AtomicReader, field); return new FunctionValuesAnonymousInnerClassHelper(this, binaryValues, docsWithField); } else { return new DocTermsIndexDocValuesAnonymousInnerClassHelper(this, this, readerContext, field); } }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { var searcher = (IndexSearcher)context["searcher"]; TFIDFSimilarity similarity = IDFValueSource.AsTFIDF(searcher.Similarity, field); if (similarity == null) { throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)"); } NumericDocValues norms = readerContext.AtomicReader.GetNormValues(field); if (norms == null) { return new ConstDoubleDocValues(0.0, this); } return new FloatDocValuesAnonymousInnerClassHelper(this, this, similarity, norms); }
public override Explanation Explain(AtomicReaderContext context, int doc) { PayloadTermSpanScorer scorer = (PayloadTermSpanScorer)Scorer(context, (context.AtomicReader).LiveDocs); if (scorer != null) { int newDoc = scorer.Advance(doc); if (newDoc == doc) { float freq = scorer.SloppyFreq(); Similarity.SimScorer docScorer = Similarity.DoSimScorer(Stats, context); Explanation expl = new Explanation(); expl.Description = "weight(" + Query + " in " + doc + ") [" + Similarity.GetType().Name + "], result of:"; Explanation scoreExplanation = docScorer.Explain(doc, new Explanation(freq, "phraseFreq=" + freq)); expl.AddDetail(scoreExplanation); expl.Value = scoreExplanation.Value; // now the payloads part // QUESTION: Is there a way to avoid this skipTo call? We need to know // whether to load the payload or not // GSI: I suppose we could toString the payload, but I don't think that // would be a good idea string field = ((SpanQuery)Query).Field; Explanation payloadExpl = OuterInstance.Function.Explain(doc, field, scorer.PayloadsSeen, scorer.PayloadScore_Renamed); payloadExpl.Value = scorer.PayloadScore; // combined ComplexExplanation result = new ComplexExplanation(); if (OuterInstance.IncludeSpanScore) { result.AddDetail(expl); result.AddDetail(payloadExpl); result.Value = expl.Value * payloadExpl.Value; result.Description = "btq, product of:"; } else { result.AddDetail(payloadExpl); result.Value = payloadExpl.Value; result.Description = "btq(includeSpanScore=false), result of:"; } result.Match = true; // LUCENE-1303 return(result); } } return(new ComplexExplanation(false, 0.0f, "no matching term")); }
public override FunctionValues GetValues(IDictionary<object, object> context, AtomicReaderContext readerContext) { return new CachedDistanceFunctionValue(readerContext.AtomicReader, this); }
public override SimScorer DoSimScorer(SimWeight weight, AtomicReaderContext context) { throw new System.NotSupportedException(); }
public override SimScorer GetSimScorer(SimWeight weight, AtomicReaderContext context) { throw new System.NotSupportedException(); }
/// <summary> /// this method is implemented for each data type </summary> public abstract override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs);
public CustomScoreProviderAnonymousInnerClassHelper(CustomMulAddQuery outerInstance, AtomicReaderContext context) : base(context) { this.outerInstance = outerInstance; }
public CustomScoreProviderAnonymousInnerClassHelper(CustomExternalQuery outerInstance, AtomicReaderContext context, FieldCache.Ints values) : base(context) { this.outerInstance = outerInstance; this.context = context; this.values = values; }
private readonly AtomicReaderContext readerContext; // LUCENENET: marked readonly /// <summary> /// Sole constructor. (For invocation by subclass /// constructors, typically implicit.) /// </summary> protected AtomicReader() : base() { readerContext = new AtomicReaderContext(this); }
public override SimScorer GetSimScorer(SimWeight weight, AtomicReaderContext context) { throw new InvalidOperationException(); }
public override Scorer Scorer(AtomicReaderContext context, Bits acceptDocs) { return(new PayloadTermSpanScorer(this, (TermSpans)query.GetSpans(context, acceptDocs, TermContexts), this, Similarity.DoSimScorer(Stats, context))); }
public override SimScorer DoSimScorer(SimWeight weight, AtomicReaderContext context) { throw new InvalidOperationException(); }
public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs) { var values = source.GetValues(null, context); return new ValueSourceFilteredDocIdSet(startingFilter.GetDocIdSet(context, acceptDocs), values, this); }
public virtual void SetNextReader(AtomicReaderContext context) { docBase = context.DocBase; }
protected override CustomScoreProvider GetCustomScoreProvider(AtomicReaderContext context) { FieldCache.Ints values = FieldCache.DEFAULT.GetInts(context.AtomicReader, INT_FIELD, false); return new CustomScoreProviderAnonymousInnerClassHelper(this, context, values); }
public override SimScorer GetSimScorer(SimWeight weight, AtomicReaderContext context) { throw UnsupportedOperationException.Create(); }
protected override CustomScoreProvider GetCustomScoreProvider(AtomicReaderContext context) { return new CustomScoreProviderAnonymousInnerClassHelper(this, context); }
public override Explanation Explain(AtomicReaderContext context, int doc) { Explanation explain = DoExplain(context, doc); return explain ?? new Explanation(0.0f, "no matching docs"); }
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { var searcher = (IndexSearcher)context["searcher"]; int docfreq = searcher.IndexReader.DocFreq(new Term(indexedField, indexedBytes)); return new ConstIntDocValues(docfreq, this); }
internal virtual Explanation DoExplain(AtomicReaderContext info, int doc) { var subQueryExpl = subQueryWeight.Explain(info, doc); if (!subQueryExpl.IsMatch) { return subQueryExpl; } // match var valSrcExpls = new Explanation[valSrcWeights.Length]; for (int i = 0; i < valSrcWeights.Length; i++) { valSrcExpls[i] = valSrcWeights[i].Explain(info, doc); } Explanation customExp = outerInstance.GetCustomScoreProvider(info) .CustomExplain(doc, subQueryExpl, valSrcExpls); float sc = outerInstance.Boost * customExp.Value; Explanation res = new ComplexExplanation(true, sc, outerInstance.ToString() + ", product of:"); res.AddDetail(customExp); res.AddDetail(new Explanation(outerInstance.Boost, "queryBoost")); // actually using the q boost as q weight (== weight value) return res; }
public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs) { SortedSetDocValues docTermOrds = FieldCache.DEFAULT.GetDocTermOrds(context.AtomicReader, Field); long lowerPoint = LowerVal == null ? -1 : docTermOrds.LookupTerm(LowerVal); long upperPoint = UpperVal == null ? -1 : docTermOrds.LookupTerm(UpperVal); long inclusiveLowerPoint, inclusiveUpperPoint; // Hints: // * binarySearchLookup returns -1, if value was null. // * the value is <0 if no exact hit was found, the returned value // is (-(insertion point) - 1) if (lowerPoint == -1 && LowerVal == null) { inclusiveLowerPoint = 0; } else if (IncludeLower && lowerPoint >= 0) { inclusiveLowerPoint = lowerPoint; } else if (lowerPoint >= 0) { inclusiveLowerPoint = lowerPoint + 1; } else { inclusiveLowerPoint = Math.Max(0, -lowerPoint - 1); } if (upperPoint == -1 && UpperVal == null) { inclusiveUpperPoint = long.MaxValue; } else if (IncludeUpper && upperPoint >= 0) { inclusiveUpperPoint = upperPoint; } else if (upperPoint >= 0) { inclusiveUpperPoint = upperPoint - 1; } else { inclusiveUpperPoint = -upperPoint - 2; } if (inclusiveUpperPoint < 0 || inclusiveLowerPoint > inclusiveUpperPoint) { return null; } Debug.Assert(inclusiveLowerPoint >= 0 && inclusiveUpperPoint >= 0); return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.AtomicReader.MaxDoc, acceptDocs, docTermOrds, inclusiveLowerPoint, inclusiveUpperPoint); }
private void InitializeInstanceFields() { readerContext = new AtomicReaderContext(this); }