/*(non-Javadoc) <see cref="Lucene.Net.Search.Query.rewrite(Lucene.Net.Index.IndexReader) */ public override Query Rewrite(IndexReader reader) { CustomScoreQuery clone = null; Query sq = subQuery.Rewrite(reader); if (sq != subQuery) { clone = (CustomScoreQuery)Clone(); clone.subQuery = sq; } for (int i = 0; i < valSrcQueries.Length; i++) { ValueSourceQuery v = (ValueSourceQuery)valSrcQueries[i].Rewrite(reader); if (v != valSrcQueries[i]) { if (clone == null) { clone = (CustomScoreQuery)Clone(); } clone.valSrcQueries[i] = v; } } return((clone == null) ? this : clone); }
private float[] vScores; // reused in score() to avoid allocating this array for each doc // constructor internal CustomScorer(CustomScoreQuery enclosingInstance, Similarity similarity, IndexReader reader, CustomWeight w, Scorer subQueryScorer, Scorer[] valSrcScorers) : base(similarity) { InitBlock(enclosingInstance); this.qWeight = w.Value; this.subQueryScorer = subQueryScorer; this.valSrcScorers = valSrcScorers; this.reader = reader; this.vScores = new float[valSrcScorers.Length]; this.provider = this.Enclosing_Instance.GetCustomScoreProvider(reader); }
public CustomWeight(CustomScoreQuery enclosingInstance, Searcher searcher) { InitBlock(enclosingInstance); this.similarity = Enclosing_Instance.GetSimilarity(searcher); this.subQueryWeight = Enclosing_Instance.subQuery.Weight(searcher); this.valSrcWeights = new Weight[Enclosing_Instance.valSrcQueries.Length]; for (int i = 0; i < Enclosing_Instance.valSrcQueries.Length; i++) { this.valSrcWeights[i] = Enclosing_Instance.valSrcQueries[i].CreateWeight(searcher); } this.qStrict = Enclosing_Instance.strict; }
/*(non-Javadoc) <see cref="Lucene.Net.Search.Query.clone() */ public override System.Object Clone() { CustomScoreQuery clone = (CustomScoreQuery)base.Clone(); clone.subQuery = (Query)subQuery.Clone(); clone.valSrcQueries = new ValueSourceQuery[valSrcQueries.Length]; for (int i = 0; i < valSrcQueries.Length; i++) { clone.valSrcQueries[i] = (ValueSourceQuery)valSrcQueries[i].Clone(); } return(clone); }
/// <summary>Returns true if <c>o</c> is equal to this. </summary> public override bool Equals(System.Object o) { if (GetType() != o.GetType()) { return(false); } CustomScoreQuery other = (CustomScoreQuery)o; if (this.Boost != other.Boost || !this.subQuery.Equals(other.subQuery) || this.strict != other.strict || this.valSrcQueries.Length != other.valSrcQueries.Length) { return(false); } // SequenceEqual should properly mimic java's Array.equals() return(valSrcQueries.SequenceEqual(other.valSrcQueries)); }
private void InitBlock(CustomScoreQuery enclosingInstance) { this.enclosingInstance = enclosingInstance; }
public AnonymousCustomScoreProvider(CustomScoreQuery parent, IndexReader reader) : base(reader) { this.parent = parent; }
private float[] vScores; // reused in score() to avoid allocating this array for each doc // constructor internal CustomScorer(CustomScoreQuery enclosingInstance, Similarity similarity, IndexReader reader, CustomWeight w, Scorer subQueryScorer, Scorer[] valSrcScorers):base(similarity) { InitBlock(enclosingInstance); this.qWeight = w.Value; this.subQueryScorer = subQueryScorer; this.valSrcScorers = valSrcScorers; this.reader = reader; this.vScores = new float[valSrcScorers.Length]; this.provider = this.Enclosing_Instance.GetCustomScoreProvider(reader); }