lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lai...@apache.org
Subject [lucenenet] branch master updated: Fixes LUCENENET-597
Date Mon, 21 Jan 2019 12:51:16 GMT
This is an automated email from the ASF dual-hosted git repository.

laimis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new de4032a  Fixes LUCENENET-597
de4032a is described below

commit de4032a7da9887d9830c5b2fc680c0d1e8654bce
Author: Simon Svensson <sisve@devhost.se>
AuthorDate: Sat Jan 19 15:02:31 2019 +0100

    Fixes LUCENENET-597
---
 src/Lucene.Net.Tests/Search/Spans/TestSpans.cs | 16 ++++++++++++++++
 src/Lucene.Net/Search/Spans/SpanNearQuery.cs   |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/Lucene.Net.Tests/Search/Spans/TestSpans.cs b/src/Lucene.Net.Tests/Search/Spans/TestSpans.cs
index 29dcdce..5a2794f 100644
--- a/src/Lucene.Net.Tests/Search/Spans/TestSpans.cs
+++ b/src/Lucene.Net.Tests/Search/Spans/TestSpans.cs
@@ -554,6 +554,22 @@ namespace Lucene.Net.Search.Spans
             Assert.AreEqual(0, SpanCount("s3", "s1", 8, 8), "SpanNotS3NotS1_8_8");
         }
 
+        [Test]
+        [Description("LUCENENET-597")]
+        public void TestToString_LUCENENET_597()
+        {
+            var clauses = new[]
+            {
+                new SpanTermQuery(new Term("f", "lucene")),
+                new SpanTermQuery(new Term("f", "net")),
+                new SpanTermQuery(new Term("f", "solr"))
+            };
+            var query = new SpanNearQuery(clauses, 0, true);
+            var queryString = query.ToString();
+
+            Assert.AreEqual("SpanNear([f:lucene, f:net, f:solr], 0, True)", queryString);
+        }
+
         private int SpanCount(string include, string exclude, int pre, int post)
         {
             SpanTermQuery iq = new SpanTermQuery(new Term(field, include));
diff --git a/src/Lucene.Net/Search/Spans/SpanNearQuery.cs b/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
index e7b1169..9b6449e 100644
--- a/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
@@ -134,11 +134,11 @@ namespace Lucene.Net.Search.Spans
             while (i.MoveNext())
             {
                 SpanQuery clause = i.Current;
-                buffer.Append(clause.ToString(field));
                 if (!isFirst)
                 {
                     buffer.Append(", ");
                 }
+                buffer.Append(clause.ToString(field));
                 isFirst = false;
             }
             buffer.Append("], ");


Mime
View raw message