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 ValueSourceScorerAnonymousInnerClassHelper4(FunctionValues outerInstance, IndexReader reader, FunctionValues @this, float l, float u) : base(reader, @this) { this.outerInstance = outerInstance; this.l = l; this.u = u; }
protected internal ValueSourceScorer(IndexReader reader, FunctionValues values) : base(null) { this.reader = reader; this.maxDoc = reader.MaxDoc; this.values = values; CheckDeletes = true; this.liveDocs = MultiFields.GetLiveDocs(reader); }
protected internal ValueSourceScorer(IndexReader reader, FunctionValues values) : base(null) { this.reader = reader; this.maxDoc = reader.MaxDoc; this.values = values; CheckDeletes = true; this.liveDocs = MultiFields.GetLiveDocs(reader); }
public CustomScorer(BoostedQuery outerInstance, AtomicReaderContext readerContext, BoostedQuery.BoostedWeight w, float qWeight, Scorer scorer, ValueSource vs) : base(w) { this.outerInstance = outerInstance; this.weight = w; this.qWeight = qWeight; this.scorer = scorer; this.readerContext = readerContext; this.vals = vs.GetValues(weight.fcontext, readerContext); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public AllScorer(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs, FunctionWeight w, float qWeight) throws java.io.IOException public AllScorer(FunctionQuery outerInstance, AtomicReaderContext context, Bits acceptDocs, FunctionWeight w, float qWeight) : base(w) { this.outerInstance = outerInstance; this.weight = w; this.qWeight = qWeight; this.reader = context.Reader; this.maxDoc = reader.MaxDoc; this.acceptDocs = acceptDocs; vals = outerInstance.func.GetValues(weight.context, context); }
internal ExpressionFunctionValues(ValueSource parent, Expression expression, FunctionValues [] functionValues) : base(parent) { if (expression == null) { throw new ArgumentNullException(); } if (functionValues == null) { throw new ArgumentNullException(); } this.expression = expression; this.functionValues = functionValues; }
public override Explanation Explain(AtomicReaderContext readerContext, int doc) { Explanation subQueryExpl = qWeight.Explain(readerContext, doc); if (!subQueryExpl.IsMatch) { return(subQueryExpl); } FunctionValues vals = outerInstance.boostVal.GetValues(fcontext, readerContext); float sc = subQueryExpl.Value * vals.SingleVal(doc); Explanation res = new ComplexExplanation(true, sc, outerInstance.ToString() + ", product of:"); res.AddDetail(subQueryExpl); res.AddDetail(vals.Explain(doc)); return(res); }
/// <summary>Evaluates the expression for the given document.</summary> /// <remarks>Evaluates the expression for the given document.</remarks> /// <param name="document"><code>docId</code> of the document to compute a value for</param> /// <param name="functionValues"> /// /// <see cref="Lucene.Net.Queries.Function.FunctionValues">Lucene.Net.Queries.Function.FunctionValues /// </see> /// for each element of /// <see cref="variables">variables</see> /// . /// </param> /// <returns>The computed value of the expression for the given document.</returns> public abstract double Evaluate(int document, FunctionValues[] functionValues);
public DoubleDocValuesAnonymousHelper(DistanceToShapeValueSource outerInstance, FunctionValues shapeValues) : base(outerInstance) { this.outerInstance = outerInstance; this.shapeValues = shapeValues; }
public AnonymousValueSourceScorer(IndexReader reader, FunctionValues functionValues, Func <int, bool> matchesValue) : base(reader, functionValues) { this.matchesValue = matchesValue ?? throw new ArgumentNullException(nameof(matchesValue)); }
public CustomScorer(BoostedQuery outerInstance, AtomicReaderContext readerContext, BoostedQuery.BoostedWeight w, float qWeight, Scorer scorer, ValueSource vs) : base(w) { this.outerInstance = outerInstance; this.weight = w; this.qWeight = qWeight; this.scorer = scorer; this.readerContext = readerContext; this.vals = vs.GetValues(weight.fcontext, readerContext); }
public ValueFillerAnonymousInnerClassHelper(FunctionValues outerInstance) { this.outerInstance = outerInstance; mval = new MutableValueFloat(); }
public ValueSourceScorerAnonymousInnerClassHelper4(FunctionValues outerInstance, IndexReader reader, FunctionValues @this, float l, float u) : base(reader, @this) { this.outerInstance = outerInstance; this.l = l; this.u = u; }
public ValueFillerAnonymousInnerClassHelper(FunctionValues outerInstance) { this.outerInstance = outerInstance; mval = new MutableValueFloat(); }
public BoolDocValuesAnonymousHelper(ShapePredicateValueSource outerInstance, FunctionValues shapeValues) : base(outerInstance) { this.outerInstance = outerInstance; this.shapeValues = shapeValues; }
/// <summary> /// Returns the weight for the current <paramref name="docId"/> as computed /// by the <see cref="weightsValueSource"/> /// </summary> protected internal override long GetWeight(Document doc, int docId) { if (currentWeightValues == null) { return 0; } int subIndex = ReaderUtil.SubIndex(docId, starts); if (subIndex != currentLeafIndex) { currentLeafIndex = subIndex; try { currentWeightValues = outerInstance.weightsValueSource.GetValues(new Dictionary<string, object>(), leaves[currentLeafIndex]); } catch (IOException) { throw new Exception(); } } return currentWeightValues.LongVal(docId - starts[subIndex]); }
public DocumentValueSourceInputIterator(DocumentValueSourceDictionary outerInstance, bool hasPayloads, bool hasContexts) : base(outerInstance, hasPayloads, hasContexts) { this.outerInstance = outerInstance; leaves = outerInstance.reader.Leaves; starts = new int[leaves.Count + 1]; for (int i = 0; i < leaves.Count; i++) { starts[i] = leaves[i].DocBase; } starts[leaves.Count] = outerInstance.reader.MaxDoc; currentWeightValues = (leaves.Count > 0) ? outerInstance.weightsValueSource.GetValues(new Dictionary<string, object>(), leaves[currentLeafIndex]) : null; }
public CachingDoubleFunctionValue(int docBase, FunctionValues vals, IDictionary<int, double> cache) { this.docBase = docBase; values = vals; this.cache = cache; }
public BitsAnonymousHelper(DocIdSetAnonymousHelper outerInstance, FunctionValues predFuncValues, AtomicReaderContext context, Bits acceptDocs) { this.outerInstance = outerInstance; this.predFuncValues = predFuncValues; this.context = context; this.acceptDocs = acceptDocs; }
public override FieldComparer SetNextReader(AtomicReaderContext context) { docVals = outerInstance.GetValues(fcontext, context); return(this); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public AllScorer(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs, FunctionWeight w, float qWeight) throws java.io.IOException public AllScorer(FunctionQuery outerInstance, AtomicReaderContext context, Bits acceptDocs, FunctionWeight w, float qWeight) : base(w) { this.outerInstance = outerInstance; this.weight = w; this.qWeight = qWeight; this.reader = context.Reader; this.maxDoc = reader.MaxDoc; this.acceptDocs = acceptDocs; vals = outerInstance.func.GetValues(weight.context, context); }