lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nam...@apache.org
Subject [lucene-solr] branch branch_8x updated: LUCENE-9046: Fix wrong example in Javadoc of TermInSetQuery
Date Fri, 15 Nov 2019 18:01:00 GMT
This is an automated email from the ASF dual-hosted git repository.

namgyu pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 4ffd6ee  LUCENE-9046: Fix wrong example in Javadoc of TermInSetQuery
4ffd6ee is described below

commit 4ffd6ee7c2f88621f0463ba145b1646736022d3d
Author: Namgyu Kim <namgyu@apache.org>
AuthorDate: Sat Nov 16 02:42:55 2019 +0900

    LUCENE-9046: Fix wrong example in Javadoc of TermInSetQuery
    
    Signed-off-by: Namgyu Kim <namgyu@apache.org>
---
 lucene/CHANGES.txt                                                | 2 ++
 lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 9548feb..7ae02af 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -66,6 +66,8 @@ Other
 
 * LUCENE-8994: Code Cleanup - Pass values to list constructor instead of empty constructor
followed by addAll(). (Koen De Groote)
 
+* LUCENE-9046: Fix wrong example in Javadoc of TermInSetQuery (Namgyu Kim)
+
 Build
 
 * Upgrade forbiddenapis to version 2.7; upgrade Groovy to 2.4.17.  (Uwe Schindler)
diff --git a/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java b/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
index 4df4a6d..9e5648b 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
@@ -52,7 +52,7 @@ import org.apache.lucene.util.RamUsageEstimator;
  * <p>For instance in the following example, both {@code q1} and {@code q2}
  * would yield the same scores:
  * <pre class="prettyprint">
- * Query q1 = new TermInSetQuery(new Term("field", "foo"), new Term("field", "bar"));
+ * Query q1 = new TermInSetQuery("field", new BytesRef("foo"), new BytesRef("bar"));
  *
  * BooleanQuery bq = new BooleanQuery();
  * bq.add(new TermQuery(new Term("field", "foo")), Occur.SHOULD);
@@ -79,7 +79,7 @@ public class TermInSetQuery extends Query implements Accountable {
    * Creates a new {@link TermInSetQuery} from the given collection of terms.
    */
   public TermInSetQuery(String field, Collection<BytesRef> terms) {
-    BytesRef[] sortedTerms = terms.toArray(new BytesRef[terms.size()]);
+    BytesRef[] sortedTerms = terms.toArray(new BytesRef[0]);
     // already sorted if we are a SortedSet with natural order
     boolean sorted = terms instanceof SortedSet && ((SortedSet<BytesRef>)terms).comparator()
== null;
     if (!sorted) {


Mime
View raw message