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] Updated: (LUCENENET-159) Lucene.Net.Search.Spans.SpanOrQuery
Date Thu, 16 Oct 2008 14:13:44 GMT

     [ https://issues.apache.org/jira/browse/LUCENENET-159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gaëtan Kesteloot updated LUCENENET-159:
---------------------------------------

    Description: 
            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();
}



  was:
            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();
}


There is the same problem on SpanNearQuery class.

public override System.String ToString(System.String field)
{
            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
            buffer.Append("spanNear([");
            //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} 
{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(slop);
             buffer.Append(", ");
             buffer.Append(inOrder);
             buffer.Append(")");
             buffer.Append(ToStringUtils.Boost(GetBoost()));
             return buffer.ToString();
}

> 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
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
>             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