lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [2/2] lucenenet git commit: Lucene.Net.Highlighter.Passage refactor: GetMatchStarts() > MatchStarts, GetMatchEnds() > MatchEnds, GetMatchTerms() > MatchTerms
Date Wed, 01 Feb 2017 10:43:07 GMT
Lucene.Net.Highlighter.Passage refactor: GetMatchStarts() > MatchStarts, GetMatchEnds()
> MatchEnds, GetMatchTerms() > MatchTerms


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/460653e4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/460653e4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/460653e4

Branch: refs/heads/api-work
Commit: 460653e4ee543a5c8b3f80105b8ae050d3e64b95
Parents: 6a16e80
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Feb 1 17:42:23 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Feb 1 17:42:23 2017 +0700

----------------------------------------------------------------------
 .../PostingsHighlight/Passage.cs                | 21 ++++++++++----------
 .../TestMultiTermHighlighting.cs                |  2 +-
 .../TestPostingsHighlighterRanking.cs           |  6 +++---
 3 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/460653e4/src/Lucene.Net.Highlighter/PostingsHighlight/Passage.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/Passage.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/Passage.cs
index 8ec3bfd..54a2446 100644
--- a/src/Lucene.Net.Highlighter/PostingsHighlight/Passage.cs
+++ b/src/Lucene.Net.Highlighter/PostingsHighlight/Passage.cs
@@ -1,4 +1,5 @@
 ´╗┐using Lucene.Net.Util;
+using System.Collections.Generic;
 using System.Diagnostics;
 
 namespace Lucene.Net.Search.PostingsHighlight
@@ -139,8 +140,8 @@ namespace Lucene.Net.Search.PostingsHighlight
 
         /// <summary>
         /// Number of term matches available in 
-        /// <see cref="GetMatchStarts()"/>, <see cref="GetMatchEnds()"/>,
-        /// <see cref="GetMatchTerms()"/>
+        /// <see cref="MatchStarts"/>, <see cref="MatchEnds"/>,
+        /// <see cref="MatchTerms"/>
         /// </summary>
         public int NumMatches
         {
@@ -154,31 +155,31 @@ namespace Lucene.Net.Search.PostingsHighlight
         /// offsets are absolute (not relative to <see cref="StartOffset"/>).
         /// </summary>
         /// <returns></returns>
-        public int[] GetMatchStarts()
+        public IReadOnlyList<int> MatchStarts
         {
-            return matchStarts;
+            get { return matchStarts; }
         }
 
         /// <summary>
-        /// End offsets of the term matches, corresponding with <see cref="GetMatchStarts()"/>.

+        /// End offsets of the term matches, corresponding with <see cref="MatchStarts"/>.

         /// <para/>
         /// Only <see cref="NumMatches"/> are valid. Note that its possible that an
end offset 
         /// could exceed beyond the bounds of the passage <see cref="EndOffset"/>,
if the 
         /// <see cref="Analysis.Analyzer"/> produced a term which spans a passage boundary.
         /// </summary>
-        public int[] GetMatchEnds()
+        public IReadOnlyList<int> MatchEnds
         {
-            return matchEnds;
+            get { return matchEnds; }
         }
 
         /// <summary>
-        /// BytesRef (term text) of the matches, corresponding with <see cref="GetMatchStarts()"/>.
+        /// BytesRef (term text) of the matches, corresponding with <see cref="MatchStarts"/>.
         /// <para/>
         /// Only <see cref="NumMatches"/> are valid.
         /// </summary>
-        public BytesRef[] GetMatchTerms()
+        public IReadOnlyList<BytesRef> MatchTerms
         {
-            return matchTerms;
+            get { return matchTerms; }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/460653e4/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestMultiTermHighlighting.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestMultiTermHighlighting.cs
b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestMultiTermHighlighting.cs
index 0c9b3ab..4a3a314 100644
--- a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestMultiTermHighlighting.cs
+++ b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestMultiTermHighlighting.cs
@@ -781,7 +781,7 @@ namespace Lucene.Net.Search.PostingsHighlight
                             int startPos = Math.Max(pos, start);
                             sb.Append(content, startPos, end - startPos);
                             sb.Append('(');
-                            sb.Append(passage.GetMatchTerms()[i].Utf8ToString());
+                            sb.Append(passage.MatchTerms[i].Utf8ToString());
                             sb.Append(')');
                             sb.Append("</b>");
                             pos = end;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/460653e4/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
index 15d3468..7d5ea02 100644
--- a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
+++ b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
@@ -199,12 +199,12 @@ namespace Lucene.Net.Search.PostingsHighlight
                     int lastMatchStart = -1;
                     for (int i = 0; i < p.NumMatches; i++)
                     {
-                        BytesRef term = p.GetMatchTerms()[i];
-                        int matchStart = p.GetMatchStarts()[i];
+                        BytesRef term = p.MatchTerms[i];
+                        int matchStart = p.MatchStarts[i];
                         assertTrue(matchStart >= 0);
                         // must at least start within the passage
                         assertTrue(matchStart < p.EndOffset);
-                        int matchEnd = p.GetMatchEnds()[i];
+                        int matchEnd = p.MatchEnds[i];
                         assertTrue(matchEnd >= 0);
                         // always moving forward
                         assertTrue(matchStart >= lastMatchStart);


Mime
View raw message