Beispiel #1
0
        public override Query Rewrite(IndexReader reader)
        {
            SpanOrQuery clone = null;

            for (int i = 0; i < clauses.Count; i++)
            {
                SpanQuery c     = clauses[i];
                SpanQuery query = (SpanQuery)c.Rewrite(reader);
                if (query != c)
                {
                    // clause rewrote: must clone
                    if (clone == null)
                    {
                        clone = (SpanOrQuery)this.Clone();
                    }
                    clone.clauses[i] = query;
                }
            }
            if (clone != null)
            {
                return(clone);                // some clauses rewrote
            }
            else
            {
                return(this);                // no clauses rewrote
            }
        }
Beispiel #2
0
        public override System.Object Clone()
        {
            int sz = clauses.Count;

            SpanQuery[] newClauses = new SpanQuery[sz];

            for (int i = 0; i < sz; i++)
            {
                newClauses[i] = (SpanQuery)clauses[i].Clone();
            }
            SpanOrQuery soq = new SpanOrQuery(newClauses);

            soq.Boost = Boost;
            return(soq);
        }
Beispiel #3
0
        public override bool Equals(System.Object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || GetType() != o.GetType())
            {
                return(false);
            }

            SpanOrQuery that = (SpanOrQuery)o;

            if (!clauses.Equals(that.clauses))
            {
                return(false);
            }
            if (!(clauses.Count == 0) && !field.Equals(that.field))
            {
                return(false);
            }

            return(Boost == that.Boost);
        }
Beispiel #4
0
 private void  InitBlock(Lucene.Net.Index.IndexReader reader, SpanOrQuery enclosingInstance)
 {
     this.reader            = reader;
     this.enclosingInstance = enclosingInstance;
 }
Beispiel #5
0
 public SpanQueue(SpanOrQuery enclosingInstance, int size)
 {
     InitBlock(enclosingInstance);
     Initialize(size);
 }
Beispiel #6
0
 private void  InitBlock(SpanOrQuery enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Beispiel #7
0
 public AnonymousClassSpans(Lucene.Net.Index.IndexReader reader, SpanOrQuery enclosingInstance)
 {
     InitBlock(reader, enclosingInstance);
 }