/// <summary> Create a CustomScoreQuery over input subQuery and a {@link ValueSourceQuery}.</summary> /// <param name="subQuery">the sub query whose score is being customized. Must not be null. /// </param> /// <param name="valSrcQueries">value source queries whose scores are used in the custom score /// computation. For most simple/convenient use case these would be /// {@link Mono.Lucene.Net.Search.Function.FieldScoreQuery FieldScoreQueries}. /// This parameter is optional - it can be null or even an empty array. /// </param> public CustomScoreQuery(Query subQuery, ValueSourceQuery[] valSrcQueries) { this.subQuery = subQuery; this.valSrcQueries = valSrcQueries != null?valSrcQueries:new ValueSourceQuery[0]; if (subQuery == null) throw new System.ArgumentException("<subquery> must not be null!"); }
/*(non-Javadoc) @see Mono.Lucene.Net.Search.Query#rewrite(Mono.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); }
// constructor internal ValueSourceScorer(ValueSourceQuery enclosingInstance, Similarity similarity, IndexReader reader, ValueSourceWeight w) : base(similarity) { InitBlock(enclosingInstance); this.weight = w; this.qWeight = w.GetValue(); // this is when/where the values are first created. vals = Enclosing_Instance.valSrc.GetValues(reader); termDocs = reader.TermDocs(null); }
/// <summary>Returns true if <code>o</code> is equal to this. </summary> public override bool Equals(System.Object o) { if (GetType() != o.GetType()) { return(false); } ValueSourceQuery other = (ValueSourceQuery)o; return(this.GetBoost() == other.GetBoost() && this.valSrc.Equals(other.valSrc)); }
public ValueSourceWeight(ValueSourceQuery enclosingInstance, Searcher searcher) { InitBlock(enclosingInstance); this.similarity = Enclosing_Instance.GetSimilarity(searcher); }
private void InitBlock(ValueSourceQuery enclosingInstance) { this.enclosingInstance = enclosingInstance; }
// constructor internal ValueSourceScorer(ValueSourceQuery enclosingInstance, Similarity similarity, IndexReader reader, ValueSourceWeight w):base(similarity) { InitBlock(enclosingInstance); this.weight = w; this.qWeight = w.GetValue(); // this is when/where the values are first created. vals = Enclosing_Instance.valSrc.GetValues(reader); termDocs = reader.TermDocs(null); }
/// <summary> Create a CustomScoreQuery over input subQuery and a {@link ValueSourceQuery}.</summary> /// <param name="subQuery">the sub query whose score is being customed. Must not be null. /// </param> /// <param name="valSrcQuery">a value source query whose scores are used in the custom score /// computation. For most simple/convineient use case this would be a /// {@link Mono.Lucene.Net.Search.Function.FieldScoreQuery FieldScoreQuery}. /// This parameter is optional - it can be null or even an empty array. /// </param> public CustomScoreQuery(Query subQuery, ValueSourceQuery valSrcQuery):this(subQuery, valSrcQuery != null?new ValueSourceQuery[]{valSrcQuery}:new ValueSourceQuery[0]) { }
/// <summary> Create a CustomScoreQuery over input subQuery and a {@link ValueSourceQuery}.</summary> /// <param name="subQuery">the sub query whose score is being customed. Must not be null. /// </param> /// <param name="valSrcQuery">a value source query whose scores are used in the custom score /// computation. For most simple/convineient use case this would be a /// {@link Mono.Lucene.Net.Search.Function.FieldScoreQuery FieldScoreQuery}. /// This parameter is optional - it can be null or even an empty array. /// </param> public CustomScoreQuery(Query subQuery, ValueSourceQuery valSrcQuery) : this(subQuery, valSrcQuery != null?new ValueSourceQuery[] { valSrcQuery }:new ValueSourceQuery[0]) { }
public ValueSourceWeight(ValueSourceQuery enclosingInstance, Searcher searcher) { InitBlock(enclosingInstance); this.similarity = Enclosing_Instance.GetSimilarity(searcher); }
private void InitBlock(ValueSourceQuery enclosingInstance) { this.enclosingInstance = enclosingInstance; }