You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gs...@apache.org on 2023/03/07 02:13:10 UTC
[lucene] branch main updated: Fixup TestLongValueFacetCounts after GITHUB#11744. (#12192)
This is an automated email from the ASF dual-hosted git repository.
gsmiller pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 0651d25713d Fixup TestLongValueFacetCounts after GITHUB#11744. (#12192)
0651d25713d is described below
commit 0651d25713dde144df6541663b18accbc93cdc64
Author: Greg Miller <gs...@gmail.com>
AuthorDate: Mon Mar 6 18:13:03 2023 -0800
Fixup TestLongValueFacetCounts after GITHUB#11744. (#12192)
GH#11744 deprecated LongValueFacetCounts#getTopChildrenSortByCount in favor
of the standard Facets#getTopChildren. The issue is that #getTopChildrenSortByCount
didn't do any input validation and allowed for topN == 0, while #getTopChildren
does input validation. Randomized testing could produce topN values of 0, which
resulted in falied tests. This addresses the tests.
---
.../test/org/apache/lucene/facet/TestLongValueFacetCounts.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java b/lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java
index 58c232c8c6e..a35b76ff1d5 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java
@@ -394,7 +394,7 @@ public class TestLongValueFacetCounts extends FacetTestCase {
if (random().nextBoolean()) {
topN = docCount;
} else {
- topN = random().nextInt(docCount);
+ topN = random().nextInt(1, docCount);
}
if (VERBOSE) {
System.out.println(" topN=" + topN);
@@ -486,7 +486,7 @@ public class TestLongValueFacetCounts extends FacetTestCase {
if (random().nextBoolean()) {
topN = docCount;
} else {
- topN = random().nextInt(docCount);
+ topN = random().nextInt(1, docCount);
}
actual = facetCounts.getTopChildren(topN, "field");
assertSame(
@@ -657,7 +657,7 @@ public class TestLongValueFacetCounts extends FacetTestCase {
if (random().nextBoolean()) {
topN = docCount;
} else {
- topN = random().nextInt(docCount);
+ topN = random().nextInt(1, docCount);
}
if (VERBOSE) {
System.out.println(" topN=" + topN);
@@ -727,7 +727,7 @@ public class TestLongValueFacetCounts extends FacetTestCase {
if (random().nextBoolean()) {
topN = docCount;
} else {
- topN = random().nextInt(docCount);
+ topN = random().nextInt(1, docCount);
}
actual = facetCounts.getTopChildren(topN, "field");
assertSame(