Skip to content

Commit

Permalink
HSEARCH-4704 Ignore a bug for year fields in Elasticsearch 8.4.2 in t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
yrodiere committed Sep 21, 2022
1 parent c04851e commit a40baf2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,9 @@ public boolean supportsFieldSortWhenNestedFieldMissingInSomeTargetIndexes() {
public boolean reliesOnNestedDocumentsForMultiValuedObjectProjection() {
return false;
}

@Override
public boolean supportsYearType() {
return !dialect.hasBugForDateFormattedAsYear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.integrationtest.backend.tck.testsupport.types;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand All @@ -16,14 +16,17 @@
import org.hibernate.search.integrationtest.backend.tck.testsupport.types.expectations.IndexNullAsMatchPredicateExpectactions;
import org.hibernate.search.integrationtest.backend.tck.testsupport.types.values.AscendingUniqueTermValues;
import org.hibernate.search.integrationtest.backend.tck.testsupport.types.values.IndexableValues;
import org.hibernate.search.integrationtest.backend.tck.testsupport.util.TckConfiguration;

public abstract class FieldTypeDescriptor<F> {

private static List<FieldTypeDescriptor<?>> all;

public static List<FieldTypeDescriptor<?>> getAll() {
if ( all == null ) {
all = Collections.unmodifiableList( Arrays.asList(
List<FieldTypeDescriptor<?>> list = new ArrayList<>();
Collections.addAll(
list,
KeywordStringFieldTypeDescriptor.INSTANCE,
AnalyzedStringFieldTypeDescriptor.INSTANCE,
NormalizedStringFieldTypeDescriptor.INSTANCE,
Expand All @@ -39,15 +42,18 @@ public static List<FieldTypeDescriptor<?>> getAll() {
LocalDateTimeFieldTypeDescriptor.INSTANCE,
LocalTimeFieldTypeDescriptor.INSTANCE,
ZonedDateTimeFieldTypeDescriptor.INSTANCE,
YearFieldTypeDescriptor.INSTANCE,
YearMonthFieldTypeDescriptor.INSTANCE,
MonthDayFieldTypeDescriptor.INSTANCE,
OffsetDateTimeFieldTypeDescriptor.INSTANCE,
OffsetTimeFieldTypeDescriptor.INSTANCE,
GeoPointFieldTypeDescriptor.INSTANCE,
BigDecimalFieldTypeDescriptor.INSTANCE,
BigIntegerFieldTypeDescriptor.INSTANCE
) );
);
if ( TckConfiguration.get().getBackendFeatures().supportsYearType() ) {
list.add( YearFieldTypeDescriptor.INSTANCE );
}
all = Collections.unmodifiableList( list );
}
return all;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,8 @@ public boolean projectionPreservesEmptySingleValuedObject(ObjectStructure struct

public abstract boolean reliesOnNestedDocumentsForMultiValuedObjectProjection();

public boolean supportsYearType() {
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import java.util.Optional;

import org.hibernate.search.backend.elasticsearch.ElasticsearchVersion;
import org.hibernate.search.backend.elasticsearch.client.impl.Paths;
import org.hibernate.search.backend.elasticsearch.client.spi.ElasticsearchRequest;
import org.hibernate.search.backend.elasticsearch.util.spi.URLEncodedString;
Expand Down Expand Up @@ -183,4 +184,10 @@ public boolean supportsIgnoreUnmappedForGeoPointField() {
public boolean ignoresFieldSortWhenNestedFieldMissing() {
return true;
}

@Override
public boolean hasBugForDateFormattedAsYear() {
// https://github.com/elastic/elasticsearch/issues/90187
return ElasticsearchVersion.of( "elastic:8.4.2" ).matches( ElasticsearchTestDialect.getActualVersion() );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,6 @@ default String getConcatenatedLocalDateDefaultMappingFormats() {

boolean ignoresFieldSortWhenNestedFieldMissing();

boolean hasBugForDateFormattedAsYear();

}

0 comments on commit a40baf2

Please sign in to comment.