19 using System.Collections.Generic;
20 using Lucene.Net.Index;
21 using Lucene.Net.Support;
24 using Query = Lucene.Net.Search.Query;
26 namespace Lucene.Net.Search.Spans
33 private class AnonymousClassSpans :
Spans
35 public AnonymousClassSpans(Lucene.Net.Index.IndexReader reader,
SpanFirstQuery enclosingInstance)
37 InitBlock(reader, enclosingInstance);
39 private void InitBlock(Lucene.Net.Index.IndexReader reader,
SpanFirstQuery enclosingInstance)
42 this.enclosingInstance = enclosingInstance;
43 spans = Enclosing_Instance.match.
GetSpans(reader);
45 private Lucene.Net.Index.IndexReader reader;
51 return enclosingInstance;
57 public override bool Next()
62 if (End() <= Enclosing_Instance.end)
68 public override bool SkipTo(
int target)
70 if (!spans.SkipTo(target))
73 return spans.
End() <= Enclosing_Instance.end || Next();
76 public override int Doc()
80 public override int Start()
84 public override int End()
91 public override ICollection<byte[]> GetPayload()
93 System.Collections.Generic.ICollection<byte[]> result = null;
94 if (spans.IsPayloadAvailable())
96 result = spans.GetPayload();
103 public override bool IsPayloadAvailable()
105 return spans.IsPayloadAvailable();
108 public override System.String ToString()
110 return "spans(" + Enclosing_Instance.ToString() +
")";
128 get {
return match; }
132 public virtual int End
137 public override string Field
139 get {
return match.
Field; }
142 public override System.String ToString(System.String field)
144 System.Text.StringBuilder buffer =
new System.Text.StringBuilder();
145 buffer.Append(
"spanFirst(");
146 buffer.Append(match.ToString(field));
151 return buffer.ToString();
154 public override System.Object Clone()
157 spanFirstQuery.
Boost = Boost;
158 return spanFirstQuery;
161 public override void ExtractTerms(System.Collections.Generic.ISet<
Term> terms)
168 return new AnonymousClassSpans(reader,
this);
176 if (rewritten != match)
179 clone.match = rewritten;
192 public override bool Equals(System.Object o)
199 SpanFirstQuery other = (SpanFirstQuery) o;
200 return this.end == other.end && this.match.Equals(other.match) && this.Boost == other.
Boost;
203 public override int GetHashCode()
205 int h = match.GetHashCode();
207 h ^= System.Convert.ToInt32(Boost) ^ end;