コード例 #1
0
        /*(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);
        }
コード例 #2
0
        /// <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);
            }
            ValueSourceQuery other = (ValueSourceQuery)o;

            return(this.Boost == other.Boost && this.valSrc.Equals(other.valSrc));
        }
コード例 #3
0
 // constructor
 internal ValueSourceScorer(ValueSourceQuery enclosingInstance, Similarity similarity, IndexReader reader, ValueSourceWeight w)
     : base(similarity)
 {
     InitBlock(enclosingInstance);
     this.weight  = w;
     this.qWeight = w.Value;
     // this is when/where the values are first created.
     vals     = Enclosing_Instance.valSrc.GetValues(reader);
     termDocs = reader.TermDocs(null);
 }
コード例 #4
0
			public ValueSourceWeight(ValueSourceQuery enclosingInstance, Searcher searcher)
			{
				InitBlock(enclosingInstance);
				this.similarity = Enclosing_Instance.GetSimilarity(searcher);
			}
コード例 #5
0
			private void  InitBlock(ValueSourceQuery enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
コード例 #6
0
 // constructor
 internal ValueSourceScorer(ValueSourceQuery enclosingInstance, Similarity similarity, IndexReader reader, ValueSourceWeight w)
     : base(similarity)
 {
     InitBlock(enclosingInstance);
     this.weight = w;
     this.qWeight = w.Value;
     // this is when/where the values are first created.
     vals = Enclosing_Instance.valSrc.GetValues(reader);
     termDocs = reader.TermDocs(null);
 }
コード例 #7
0
 /// <summary> Create a CustomScoreQuery over input subQuery and a <see cref="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
 /// <see cref="Lucene.Net.Search.Function.FieldScoreQuery">FieldScoreQuery</see>.
 /// 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])
 {
 }
コード例 #8
0
		/// <summary> Create a CustomScoreQuery over input subQuery and a <see cref="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 
		/// <see cref="Lucene.Net.Search.Function.FieldScoreQuery">FieldScoreQuery</see>.
        /// 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])
		{
		}
コード例 #9
0
 public ValueSourceWeight(ValueSourceQuery enclosingInstance, Searcher searcher)
 {
     InitBlock(enclosingInstance);
     this.similarity = Enclosing_Instance.GetSimilarity(searcher);
 }
コード例 #10
0
 private void  InitBlock(ValueSourceQuery enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }