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(); }
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; }
/// <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; }
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; }
/// <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); } }
public FieldMaskingSpanQuery(SpanQuery maskedQuery, System.String maskedField) { this.maskedQuery = maskedQuery; this.field = maskedField; }
/// <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."); }
/// <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) { }
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; }