예제 #1
0
		public SpanWeight(SpanQuery query, Searcher searcher)
		{
			this.similarity = query.GetSimilarity(searcher);
			this.query = query;
			terms = new System.Collections.Hashtable();
			query.ExtractTerms(terms);
			idfExp = similarity.idfExplain(new System.Collections.ArrayList(terms.Values), searcher);
			idf = idfExp.GetIdf();
		}
예제 #2
0
		public SpanNearQuery(SpanQuery[] clauses, int slop, bool inOrder, bool collectPayloads)
		{
			
			// copy clauses array into an ArrayList
			this.clauses = new System.Collections.ArrayList(clauses.Length);
			for (int i = 0; i < clauses.Length; i++)
			{
				SpanQuery clause = clauses[i];
				if (i == 0)
				{
					// check field
					field = clause.GetField();
				}
				else if (!clause.GetField().Equals(field))
				{
					throw new System.ArgumentException("Clauses must have same field.");
				}
				this.clauses.Add(clause);
			}
			this.collectPayloads = collectPayloads;
			this.slop = slop;
			this.inOrder = inOrder;
		}
예제 #3
0
		/// <summary>Construct a SpanFirstQuery matching spans in <code>match</code> whose end
		/// position is less than or equal to <code>end</code>. 
		/// </summary>
		public SpanFirstQuery(SpanQuery match, int end)
		{
			this.match = match;
			this.end = end;
		}
예제 #4
0
		public override System.Object Clone()
		{
			int sz = clauses.Count;
			SpanQuery[] newClauses = new SpanQuery[sz];
			
			for (int i = 0; i < sz; i++)
			{
				SpanQuery clause = (SpanQuery) clauses[i];
				newClauses[i] = (SpanQuery) clause.Clone();
			}
			SpanOrQuery soq = new SpanOrQuery(newClauses);
			soq.SetBoost(GetBoost());
			return soq;
		}
예제 #5
0
		/// <summary>Construct a SpanOrQuery merging the provided clauses. </summary>
		public SpanOrQuery(SpanQuery[] clauses)
		{
			
			// copy clauses array into an ArrayList
			this.clauses = new SupportClass.EquatableList<SpanQuery>(clauses.Length);
			for (int i = 0; i < clauses.Length; i++)
			{
				SpanQuery clause = clauses[i];
				if (i == 0)
				{
					// check field
					field = clause.GetField();
				}
				else if (!clause.GetField().Equals(field))
				{
					throw new System.ArgumentException("Clauses must have same field.");
				}
				this.clauses.Add(clause);
			}
		}
예제 #6
0
		public FieldMaskingSpanQuery(SpanQuery maskedQuery, System.String maskedField)
		{
			this.maskedQuery = maskedQuery;
			this.field = maskedField;
		}
예제 #7
0
		/// <summary>Construct a SpanNotQuery matching spans from <code>include</code> which
		/// have no overlap with spans from <code>exclude</code>.
		/// </summary>
		public SpanNotQuery(SpanQuery include, SpanQuery exclude)
		{
			this.include = include;
			this.exclude = exclude;
			
			if (!include.GetField().Equals(exclude.GetField()))
				throw new System.ArgumentException("Clauses must have same field.");
		}
예제 #8
0
		/// <summary>Construct a SpanNearQuery.  Matches spans matching a span from each
		/// clause, with up to <code>slop</code> total unmatched positions between
		/// them.  * When <code>inOrder</code> is true, the spans from each clause
		/// must be * ordered as in <code>clauses</code>. 
		/// </summary>
		public SpanNearQuery(SpanQuery[] clauses, int slop, bool inOrder):this(clauses, slop, inOrder, true)
		{
		}
예제 #9
0
		public override System.Object Clone()
		{
			int sz = clauses.Count;
			SpanQuery[] newClauses = new SpanQuery[sz];
			
			for (int i = 0; i < sz; i++)
			{
				SpanQuery clause = (SpanQuery) clauses[i];
				newClauses[i] = (SpanQuery) clause.Clone();
			}
			SpanNearQuery spanNearQuery = new SpanNearQuery(newClauses, slop, inOrder);
			spanNearQuery.SetBoost(GetBoost());
			return spanNearQuery;
		}
예제 #10
0
 public FieldMaskingSpanQuery(SpanQuery maskedQuery, System.String maskedField)
 {
     this.maskedQuery = maskedQuery;
     this.field       = maskedField;
 }