예제 #1
0
        /// <summary>Prints a user-readable version of this query. </summary>
        public override System.String ToString(System.String f)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            if (!field.Equals(f))
            {
                buffer.Append(field);
                buffer.Append(":");
            }

            buffer.Append("\"");
            System.Collections.IEnumerator i = termArrays.GetEnumerator();
            while (i.MoveNext())
            {
                Term[] terms = (Term[])i.Current;
                buffer.Append(terms[0].Text() + (terms.Length > 1?"*":""));
                if (i.MoveNext())
                {
                    buffer.Append(" ");
                }
            }
            buffer.Append("\"");

            if (slop != 0)
            {
                buffer.Append("~");
                buffer.Append(slop);
            }

            buffer.Append(ToStringUtils.Boost(GetBoost()));

            return(buffer.ToString());
        }
예제 #2
0
        /// <summary>Prints a user-readable version of this query. </summary>
        public override System.String ToString(System.String f)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            if (!field.Equals(f))
            {
                buffer.Append(field);
                buffer.Append(":");
            }

            buffer.Append("\"");
            for (int i = 0; i < terms.Count; i++)
            {
                buffer.Append(((Term)terms[i]).Text());
                if (i != terms.Count - 1)
                {
                    buffer.Append(" ");
                }
            }
            buffer.Append("\"");

            if (slop != 0)
            {
                buffer.Append("~");
                buffer.Append(slop);
            }

            buffer.Append(ToStringUtils.Boost(GetBoost()));

            return(buffer.ToString());
        }
예제 #3
0
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("*:*");
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #4
0
        /// <summary>Prints a user-readable version of this query. </summary>
        public override System.String ToString(System.String field)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            bool needParens = (GetBoost() != 1.0) || (GetMinimumNumberShouldMatch() > 0);

            if (needParens)
            {
                buffer.Append("(");
            }

            for (int i = 0; i < clauses.Count; i++)
            {
                BooleanClause c = (BooleanClause)clauses[i];
                if (c.IsProhibited())
                {
                    buffer.Append("-");
                }
                else if (c.IsRequired())
                {
                    buffer.Append("+");
                }

                Query subQuery = c.GetQuery();
                if (subQuery is BooleanQuery)
                {
                    // wrap sub-bools in parens
                    buffer.Append("(");
                    buffer.Append(c.GetQuery().ToString(field));
                    buffer.Append(")");
                }
                else
                {
                    buffer.Append(c.GetQuery().ToString(field));
                }

                if (i != clauses.Count - 1)
                {
                    buffer.Append(" ");
                }
            }

            if (needParens)
            {
                buffer.Append(")");
            }

            if (GetMinimumNumberShouldMatch() > 0)
            {
                buffer.Append('~');
                buffer.Append(GetMinimumNumberShouldMatch());
            }

            if (GetBoost() != 1.0f)
            {
                buffer.Append(ToStringUtils.Boost(GetBoost()));
            }

            return(buffer.ToString());
        }
예제 #5
0
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("spanRegexQuery(");
     buffer.Append(term);
     buffer.Append(")");
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #6
0
 /// <summary>Prints a user-readable version of this query. </summary>
 public override System.String ToString(System.String s)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("filtered(");
     buffer.Append(query.ToString(s));
     buffer.Append(")->");
     buffer.Append(filter);
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #7
0
        /// <summary>Prints a user-readable version of this query. </summary>
        public override System.String ToString(System.String f)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            if (!field.Equals(f))
            {
                buffer.Append(field);
                buffer.Append(":");
            }

            bool appendSpace = false;

            buffer.Append("\"");
            System.Collections.IEnumerator i = termArrays.GetEnumerator();
            while (i.MoveNext())
            {
                if (appendSpace == true)
                {
                    buffer.Append(" ");
                }
                else
                {
                    appendSpace = true;
                }

                Term[] terms = (Term[])i.Current;
                if (terms.Length > 1)
                {
                    buffer.Append("(");
                    for (int j = 0; j < terms.Length; j++)
                    {
                        buffer.Append(terms[j].Text());
                        if (j < terms.Length - 1)
                        {
                            buffer.Append(" ");
                        }
                    }
                    buffer.Append(")");
                }
                else
                {
                    buffer.Append(terms[0].Text());
                }
            }
            buffer.Append("\"");

            if (slop != 0)
            {
                buffer.Append("~");
                buffer.Append(slop);
            }

            buffer.Append(ToStringUtils.Boost(GetBoost()));

            return(buffer.ToString());
        }
예제 #8
0
        /// <summary>Prints a user-readable version of this query. </summary>
        public override string ToString(string f)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            if (!field.Equals(f))
            {
                buffer.Append(field);
                buffer.Append(":");
            }

            buffer.Append("\"");
            System.Collections.Generic.IEnumerator <Term[]> i = termArrays.GetEnumerator();
            bool first = true;

            while (i.MoveNext())
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    buffer.Append(" ");
                }

                Term[] terms = i.Current;
                if (terms.Length > 1)
                {
                    buffer.Append("(");
                    for (int j = 0; j < terms.Length; j++)
                    {
                        buffer.Append(terms[j].Text);
                        if (j < terms.Length - 1)
                        {
                            buffer.Append(" ");
                        }
                    }
                    buffer.Append(")");
                }
                else
                {
                    buffer.Append(terms[0].Text);
                }
            }
            buffer.Append("\"");

            if (slop != 0)
            {
                buffer.Append("~");
                buffer.Append(slop);
            }

            buffer.Append(ToStringUtils.Boost(Boost));

            return(buffer.ToString());
        }
예제 #9
0
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("spanFirst(");
     buffer.Append(match.ToString(field));
     buffer.Append(", ");
     buffer.Append(end);
     buffer.Append(")");
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("mask(");
     buffer.Append(maskedQuery.ToString(field));
     buffer.Append(")");
     buffer.Append(ToStringUtils.Boost(Boost));
     buffer.Append(" as ");
     buffer.Append(this.field);
     return buffer.ToString();
 }
예제 #11
0
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("spanNot(");
     buffer.Append(include.ToString(field));
     buffer.Append(", ");
     buffer.Append(exclude.ToString(field));
     buffer.Append(")");
     buffer.Append(ToStringUtils.Boost(Boost));
     return(buffer.ToString());
 }
예제 #12
0
        /// <summary>Prints a user-readable version of this query. </summary>
        public override string ToString(string f)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            if (!field.Equals(f))
            {
                buffer.Append(field);
                buffer.Append(":");
            }

            buffer.Append("\"");
            bool first = true;

            foreach (Term[] terms in termArrays)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    buffer.Append(" ");
                }

                if (terms.Length > 1)
                {
                    buffer.Append("(");
                    for (int j = 0; j < terms.Length; j++)
                    {
                        buffer.Append(terms[j].Text());
                        if (j < terms.Length - 1)
                        {
                            buffer.Append(" ");
                        }
                    }
                    buffer.Append(")");
                }
                else
                {
                    buffer.Append(terms[0].Text());
                }
            }
            buffer.Append("\"");

            if (slop != 0)
            {
                buffer.Append("~");
                buffer.Append(slop);
            }

            buffer.Append(ToStringUtils.Boost(GetBoost()));

            return(buffer.ToString());
        }
예제 #13
0
 /// <summary>Prints a user-readable version of this query. </summary>
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     if (!term.Field().Equals(field))
     {
         buffer.Append(term.Field());
         buffer.Append(":");
     }
     buffer.Append(term.Text());
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #14
0
        /// <summary>Prints a user-readable version of this query. </summary>
        public override System.String ToString(System.String f)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            if (field != null && !field.Equals(f))
            {
                buffer.Append(field);
                buffer.Append(":");
            }

            buffer.Append("\"");
            System.String[] pieces = new System.String[maxPosition + 1];
            for (int i = 0; i < terms.Count; i++)
            {
                int           pos = ((System.Int32)positions[i]);
                System.String s   = pieces[pos];
                if (s == null)
                {
                    s = ((Term)terms[i]).Text();
                }
                else
                {
                    s = s + "|" + ((Term)terms[i]).Text();
                }
                pieces[pos] = s;
            }
            for (int i = 0; i < pieces.Length; i++)
            {
                if (i > 0)
                {
                    buffer.Append(' ');
                }
                System.String s = pieces[i];
                if (s == null)
                {
                    buffer.Append('?');
                }
                else
                {
                    buffer.Append(s);
                }
            }
            buffer.Append("\"");

            if (slop != 0)
            {
                buffer.Append("~");
                buffer.Append(slop);
            }

            buffer.Append(ToStringUtils.Boost(GetBoost()));

            return(buffer.ToString());
        }
예제 #15
0
 /* (non-Javadoc) @see Lucene.Net.Search.Query#toString(java.lang.String) */
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder(Name()).Append("(");
     sb.Append(subQuery.ToString(field));
     for (int i = 0; i < valSrcQueries.Length; i++)
     {
         sb.Append(", ").Append(valSrcQueries[i].ToString(field));
     }
     sb.Append(")");
     sb.Append(strict ? " STRICT" : "");
     return(sb.ToString() + ToStringUtils.Boost(GetBoost()));
 }
예제 #16
0
 /// <summary>Prints a user-readable version of this query. </summary>
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     if (!internalTerm.Field.Equals(field))
     {
         buffer.Append(internalTerm.Field);
         buffer.Append(":");
     }
     buffer.Append(internalTerm.Text);
     buffer.Append(ToStringUtils.Boost(Boost));
     return(buffer.ToString());
 }
예제 #17
0
 /// <summary>Prints a user-readable version of this query. </summary>
 public override string ToString(string field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     if (!prefix.Field.Equals(field))
     {
         buffer.Append(prefix.Field);
         buffer.Append(":");
     }
     buffer.Append(prefix.Text);
     buffer.Append('*');
     buffer.Append(ToStringUtils.Boost(Boost));
     return(buffer.ToString());
 }
예제 #18
0
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     if (!term.Field().Equals(field))
     {
         buffer.Append(term.Field());
         buffer.Append(":");
     }
     buffer.Append(term.Text());
     buffer.Append('~');
     buffer.Append(SupportClass.Single.ToString(minimumSimilarity));
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #19
0
 /// <summary>Prints a user-readable version of this query. </summary>
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     if (!GetField().Equals(field))
     {
         buffer.Append(GetField());
         buffer.Append(":");
     }
     buffer.Append(inclusive ? "[" : "{");
     buffer.Append(lowerTerm != null ? lowerTerm.Text() : "null");
     buffer.Append(" TO ");
     buffer.Append(upperTerm != null ? upperTerm.Text() : "null");
     buffer.Append(inclusive ? "]" : "}");
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #20
0
 /// <summary>Prints a user-readable version of this query. </summary>
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     if (!GetField().Equals(field))
     {
         buffer.Append(GetField());
         buffer.Append(":");
     }
     buffer.Append(includeLower?'[':'{');
     buffer.Append(lowerTerm != null?lowerTerm:"*");
     buffer.Append(" TO ");
     buffer.Append(upperTerm != null?upperTerm:"*");
     buffer.Append(includeUpper?']':'}');
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #21
0
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("spanOr([");
     System.Collections.IEnumerator i = clauses.GetEnumerator();
     while (i.MoveNext())
     {
         SpanQuery clause = (SpanQuery)i.Current;
         buffer.Append(clause.ToString(field));
         if (i.MoveNext())
         {
             buffer.Append(", ");
         }
     }
     buffer.Append("])");
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #22
0
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("spanNear([");
     foreach (SpanQuery clause in clauses)
     {
         buffer.Append(clause.ToString(field));
         buffer.Append(", ");
     }
     if (clauses.Count > 0)
     {
         buffer.Length -= 2;
     }
     buffer.Append("], ");
     buffer.Append(slop);
     buffer.Append(", ");
     buffer.Append(inOrder);
     buffer.Append(")");
     buffer.Append(ToStringUtils.Boost(GetBoost()));
     return(buffer.ToString());
 }
예제 #23
0
        public override System.String ToString(System.String field)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            buffer.Append("payloadNear([");
            int j = 0;

            foreach (SpanQuery clause in clauses)
            {
                j++;
                buffer.Append(clause.ToString(field));
                if (j < clauses.Count)
                {
                    buffer.Append(", ");
                }
            }
            buffer.Append("], ");
            buffer.Append(slop);
            buffer.Append(", ");
            buffer.Append(inOrder);
            buffer.Append(")");
            buffer.Append(ToStringUtils.Boost(GetBoost()));
            return(buffer.ToString());
        }
예제 #24
0
        public override string ToString(string field)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            buffer.Append("payloadNear([");
            var i = clauses.GetEnumerator();

            while (i.MoveNext())
            {
                SpanQuery clause = i.Current;
                buffer.Append(clause.ToString(field));
                if (i.MoveNext())
                {
                    buffer.Append(", ");
                }
            }
            buffer.Append("], ");
            buffer.Append(internalSlop);
            buffer.Append(", ");
            buffer.Append(inOrder);
            buffer.Append(")");
            buffer.Append(ToStringUtils.Boost(Boost));
            return(buffer.ToString());
        }
예제 #25
0
 public override System.String ToString(System.String field)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append("spanNear([");
     System.Collections.Generic.IEnumerator <SpanQuery> i = clauses.GetEnumerator();
     while (i.MoveNext())
     {
         SpanQuery clause = i.Current;
         buffer.Append(clause.ToString(field));
         buffer.Append(", ");
     }
     if (clauses.Count > 0)
     {
         buffer.Length -= 2;
     }
     buffer.Append("], ");
     buffer.Append(internalSlop);
     buffer.Append(", ");
     buffer.Append(inOrder);
     buffer.Append(")");
     buffer.Append(ToStringUtils.Boost(Boost));
     return(buffer.ToString());
 }
예제 #26
0
 public override System.String ToString(System.String field)
 {
     return(valSrc.ToString() + ToStringUtils.Boost(Boost));
 }
예제 #27
0
        /// <summary>Prints a user-readable version of this query. </summary>
        public override string ToString(string field)
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            bool needParens = (Boost != 1.0) || (MinimumNumberShouldMatch > 0);

            if (needParens)
            {
                buffer.Append("(");
            }

            for (int i = 0; i < clauses.Count; i++)
            {
                BooleanClause c = clauses[i];
                if (c.IsProhibited)
                {
                    buffer.Append("-");
                }
                else if (c.IsRequired)
                {
                    buffer.Append("+");
                }

                Query subQuery = c.Query;
                if (subQuery != null)
                {
                    if (subQuery is BooleanQuery)
                    {
                        // wrap sub-bools in parens
                        buffer.Append("(");
                        buffer.Append(subQuery.ToString(field));
                        buffer.Append(")");
                    }
                    else
                    {
                        buffer.Append(subQuery.ToString(field));
                    }
                }
                else
                {
                    buffer.Append("null");
                }

                if (i != clauses.Count - 1)
                {
                    buffer.Append(" ");
                }
            }

            if (needParens)
            {
                buffer.Append(")");
            }

            if (MinimumNumberShouldMatch > 0)
            {
                buffer.Append('~');
                buffer.Append(MinimumNumberShouldMatch);
            }

            if (Boost != 1.0f)
            {
                buffer.Append(ToStringUtils.Boost(Boost));
            }

            return(buffer.ToString());
        }
예제 #28
0
 public override string ToString(string field)
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     if (!this.field.Equals(field))
     {
         sb.Append(this.field).Append(':');
     }
     return(sb.Append(minInclusive ? '[' : '{').Append((min == null) ? "*" : min.ToString()).Append(" TO ").Append((max == null) ? "*" : max.ToString()).Append(maxInclusive ? ']' : '}').Append(ToStringUtils.Boost(Boost)).ToString());
 }