lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gaëtan Kesteloot (JIRA) <j...@apache.org>
Subject [jira] Created: (LUCENENET-159) Lucene.Net.Search.Spans.SpanOrQuery
Date Thu, 16 Oct 2008 14:03:45 GMT
Lucene.Net.Search.Spans.SpanOrQuery
-----------------------------------

                 Key: LUCENENET-159
                 URL: https://issues.apache.org/jira/browse/LUCENENET-159
             Project: Lucene.Net
          Issue Type: Bug
         Environment: Windows XP, Dotnet 2.0
            Reporter: Gaëtan Kesteloot


            SpanTermQuery term1 = new SpanTermQuery(new Term("Content", "couleur"));
            SpanTermQuery term2 = new SpanTermQuery(new Term("Content", "noir"));
            SpanTermQuery term3 = new SpanTermQuery(new Term("Content", "tee"));
            SpanQuery[] clauses = { term1, term2, term3 };
            SpanOrQuery soq = new SpanOrQuery(clauses);

Only term1 and term3 are present in the SpanOrQuery class. All pair term are not present.

Possible correction 

Original source :

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();
{color:red}
             while (i.MoveNext())
            {
                SpanQuery clause = (SpanQuery)i.Current;
                buffer.Append(clause.ToString(field));
                if (i.MoveNext())
                {
                    buffer.Append(", ");
                }
            }
{color} 
           buffer.Append("])"); 
           buffer.Append(ToStringUtils.Boost(GetBoost()));
           return buffer.ToString();
}

Proposal corrected source :

public override System.String ToString(System.String field)
{
             System.Text.StringBuilder buffer = new System.Text.StringBuilder();
             buffer.Append("spanOr([");
{color:blue}
            for (int i = 0; i < clauses.Count; i++)
            {
                SpanQuery clause = (SpanQuery)clauses[i];
                if (i == clauses.Count - 1) { buffer.Append(clause.ToString(field)); }
                else { buffer.Append(clause.ToString(field)); buffer.Append(", "); }

            }
 {color} 
             buffer.Append("])");
             buffer.Append(ToStringUtils.Boost(GetBoost()));
             return buffer.ToString();
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message