Skip to content

Commit 483d79e

Browse files
committed
HSEARCH-3666 "Enable" "non-default" sorts in Lucene's terms aggregation tests
1 parent 6758bc7 commit 483d79e

File tree

4 files changed

+0
-38
lines changed

4 files changed

+0
-38
lines changed

documentation/src/main/asciidoc/public/reference/_search-dsl-aggregation.adoc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,6 @@ i.e. the terms with the most matching documents appear first.
174174

175175
Several other orders are available.
176176

177-
[WARNING]
178-
====
179-
With the Lucene backend, due to limitations of the current implementation,
180-
using any order other than the default one (by descending count)
181-
may lead to incorrect results.
182-
See https://hibernate.atlassian.net/browse/HSEARCH-3666[HSEARCH-3666] for more information.
183-
====
184-
185177
You can order entries by ascending term value:
186178

187179
// Search 5 anchors backward compatibility

integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/testsupport/util/LuceneTckBackendFeatures.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@
4646

4747
class LuceneTckBackendFeatures extends TckBackendFeatures {
4848

49-
@Override
50-
public boolean nonDefaultOrderInTermsAggregations() {
51-
// TODO HSEARCH-3666 Lucene terms aggregations (discrete facets) may return wrong results for any sort other than the default one
52-
return false;
53-
}
54-
5549
@Override
5650
public boolean projectionPreservesNulls() {
5751
return false;

integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/aggregation/TermsAggregationSpecificsIT.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.hibernate.search.integrationtest.backend.tck.testsupport.types.FieldTypeDescriptor;
3434
import org.hibernate.search.integrationtest.backend.tck.testsupport.types.StandardFieldTypeDescriptor;
3535
import org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType;
36-
import org.hibernate.search.integrationtest.backend.tck.testsupport.util.TckConfiguration;
3736
import org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper;
3837
import org.hibernate.search.integrationtest.backend.tck.testsupport.util.extension.SearchSetupHelper;
3938
import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer;
@@ -230,8 +229,6 @@ void orderByCountDescending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> data
230229
@MethodSource("params")
231230
@PortedFromSearch5(original = "org.hibernate.search.test.query.facet.SimpleFacetingTest.testCountSortOrderAsc")
232231
void orderByCountAscending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataSet) {
233-
assumeNonDefaultOrdersSupported();
234-
235232
String fieldPath = index.binding().fieldModels.get( fieldType ).relativeFieldName;
236233

237234
AggregationKey<Map<F, Long>> aggregationKey = AggregationKey.of( AGGREGATION_NAME );
@@ -258,8 +255,6 @@ void orderByCountAscending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataS
258255
@ParameterizedTest(name = "{0}")
259256
@MethodSource("params")
260257
void orderByTermDescending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataSet) {
261-
assumeNonDefaultOrdersSupported();
262-
263258
String fieldPath = index.binding().fieldModels.get( fieldType ).relativeFieldName;
264259

265260
AggregationKey<Map<F, Long>> aggregationKey = AggregationKey.of( AGGREGATION_NAME );
@@ -287,8 +282,6 @@ void orderByTermDescending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataS
287282
@MethodSource("params")
288283
@PortedFromSearch5(original = "org.hibernate.search.test.query.facet.SimpleFacetingTest.testAlphabeticalSortOrder")
289284
void orderByTermAscending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataSet) {
290-
assumeNonDefaultOrdersSupported();
291-
292285
String fieldPath = index.binding().fieldModels.get( fieldType ).relativeFieldName;
293286

294287
AggregationKey<Map<F, Long>> aggregationKey = AggregationKey.of( AGGREGATION_NAME );
@@ -412,8 +405,6 @@ void minDocumentCount_zero_noMatch(FieldTypeDescriptor<F, ?> fieldType, DataSet<
412405
@ParameterizedTest(name = "{0}")
413406
@MethodSource("params")
414407
void minDocumentCount_zero_noMatch_orderByTermDescending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataSet) {
415-
assumeNonDefaultOrdersSupported();
416-
417408
String fieldPath = index.binding().fieldModels.get( fieldType ).relativeFieldName;
418409

419410
AggregationKey<Map<F, Long>> aggregationKey = AggregationKey.of( AGGREGATION_NAME );
@@ -491,8 +482,6 @@ void maxTermCount_positive(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataS
491482
@ParameterizedTest(name = "{0}")
492483
@MethodSource("params")
493484
void maxTermCount_positive_orderByTermAscending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataSet) {
494-
assumeNonDefaultOrdersSupported();
495-
496485
String fieldPath = index.binding().fieldModels.get( fieldType ).relativeFieldName;
497486

498487
AggregationKey<Map<F, Long>> aggregationKey = AggregationKey.of( AGGREGATION_NAME );
@@ -521,8 +510,6 @@ void maxTermCount_positive_orderByTermAscending(FieldTypeDescriptor<F, ?> fieldT
521510
@ParameterizedTest(name = "{0}")
522511
@MethodSource("params")
523512
void maxTermCount_positive_orderByCountAscending(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataSet) {
524-
assumeNonDefaultOrdersSupported();
525-
526513
String fieldPath = index.binding().fieldModels.get( fieldType ).relativeFieldName;
527514

528515
AggregationKey<Map<F, Long>> aggregationKey = AggregationKey.of( AGGREGATION_NAME );
@@ -710,13 +697,6 @@ void terms_max(FieldTypeDescriptor<F, ?> fieldType, DataSet<F> dataSet) {
710697
return index.createScope().query().where( f -> f.matchAll() );
711698
}
712699

713-
private void assumeNonDefaultOrdersSupported() {
714-
assumeTrue(
715-
TckConfiguration.get().getBackendFeatures().nonDefaultOrderInTermsAggregations(),
716-
"Non-default orders are not supported for terms aggregations with this backend"
717-
);
718-
}
719-
720700
@SuppressWarnings("unchecked")
721701
private <K, V> Consumer<Map<F, V>> containsExactly(Consumer<BiConsumer<F, V>> expectationBuilder,
722702
FieldTypeDescriptor<F, ?> fieldType) {

integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/testsupport/util/TckBackendFeatures.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ public boolean nonCanonicalRangeInAggregations() {
3232
return true;
3333
}
3434

35-
public boolean nonDefaultOrderInTermsAggregations() {
36-
return true;
37-
}
38-
3935
public boolean projectionPreservesNulls() {
4036
return true;
4137
}

0 commit comments

Comments
 (0)