Exemplo n.º 1
0
        public override Query Rewrite(IndexReader reader)
        {
            SpanOrQuery clone = null;

            for (int i = 0; i < clauses.Count; i++)
            {
                SpanQuery c     = (SpanQuery)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
            }
        }
Exemplo n.º 2
0
        public override Query Rewrite(IndexReader reader)
        {
            SpanNotQuery clone = null;

            SpanQuery rewrittenInclude = (SpanQuery)include.Rewrite(reader);

            if (rewrittenInclude != include)
            {
                clone         = (SpanNotQuery)this.Clone();
                clone.include = rewrittenInclude;
            }
            SpanQuery rewrittenExclude = (SpanQuery)exclude.Rewrite(reader);

            if (rewrittenExclude != exclude)
            {
                if (clone == null)
                {
                    clone = (SpanNotQuery)this.Clone();
                }
                clone.exclude = rewrittenExclude;
            }

            if (clone != null)
            {
                return(clone);                // some clauses rewrote
            }
            else
            {
                return(this);                // no clauses rewrote
            }
        }
Exemplo n.º 3
0
        public override Query Rewrite(IndexReader reader)
        {
            SpanFirstQuery clone = null;

            SpanQuery rewritten = (SpanQuery)match.Rewrite(reader);

            if (rewritten != match)
            {
                clone       = (SpanFirstQuery)this.Clone();
                clone.match = rewritten;
            }

            if (clone != null)
            {
                return(clone);                // some clauses rewrote
            }
            else
            {
                return(this);                // no clauses rewrote
            }
        }
Exemplo n.º 4
0
        public override Query Rewrite(IndexReader reader)
        {
            FieldMaskingSpanQuery clone = null;

            SpanQuery rewritten = (SpanQuery)maskedQuery.Rewrite(reader);

            if (rewritten != maskedQuery)
            {
                clone             = (FieldMaskingSpanQuery)this.Clone();
                clone.maskedQuery = rewritten;
            }

            if (clone != null)
            {
                return(clone);
            }
            else
            {
                return(this);
            }
        }