This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit 0ab4eb77bc5ad5b5079029024b26d5aa8754c3a2 Author: Shad Storhaug <[email protected]> AuthorDate: Thu Oct 31 09:58:38 2019 +0700 BUG: Lucene.Net.Highlighter.PostingsHighlight.PostingsHighlighter: SortedSet<T> has the wrong behavior for getting a range of values (second argument is supposed to be exclusive), so swapped in TreeSet<T> (LUCENENET-619) --- .../PostingsHighlight/PostingsHighlighter.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs index e8e20f3..b94550c 100644 --- a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs +++ b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs @@ -389,7 +389,7 @@ namespace Lucene.Net.Search.PostingsHighlight } IndexReader reader = searcher.IndexReader; Query rewritten = Rewrite(query); - SortedSet<Term> queryTerms = new SortedSet<Term>();//new TreeSet<>(); + TreeSet<Term> queryTerms = new TreeSet<Term>(); rewritten.ExtractTerms(queryTerms); IndexReaderContext readerContext = reader.Context; @@ -417,7 +417,10 @@ namespace Lucene.Net.Search.PostingsHighlight int numPassages = maxPassages[i]; Term floor = new Term(field, ""); Term ceiling = new Term(field, UnicodeUtil.BIG_TERM); - SortedSet<Term> fieldTerms = queryTerms.GetViewBetween(floor, ceiling); //SubSet(floor, ceiling); + // LUCENENET NOTE: System.Collections.Generic.SortedSet<T>.GetViewBetween ceiling is inclusive. + // However, in Java, subSet ceiling is exclusive. Also, + // SortedSet<T> doesn't seem to have the correct logic, but C5.TreeSet<T> does. + var fieldTerms = queryTerms.RangeFromTo(floor, ceiling); //SubSet(floor, ceiling); // TODO: should we have some reasonable defaults for term pruning? (e.g. stopwords) // Strip off the redundant field:
