use of org.hibernate.search.util.impl.test.annotation.TestForIssue in project hibernate-search by hibernate.
the class FieldSearchSortUnsupportedTypesIT method error_notSupported.
@Test
@TestForIssue(jiraKey = "HSEARCH-3798")
public void error_notSupported() {
StubMappingScope scope = index.createScope();
String absoluteFieldPath = getFieldPath();
assertThatThrownBy(() -> scope.sort().field(absoluteFieldPath)).isInstanceOf(SearchException.class).hasMessageContainingAll("Cannot use 'sort:field' on field '" + absoluteFieldPath + "'", "'sort:field' is not available for fields of this type").satisfies(FailureReportUtils.hasContext(EventContexts.fromIndexFieldAbsolutePath(absoluteFieldPath)));
}
use of org.hibernate.search.util.impl.test.annotation.TestForIssue in project hibernate-search by hibernate.
the class DistanceSearchSortTypeCheckingAndConversionIT method multiIndex_withMissingFieldIndex.
@Test
@TestForIssue(jiraKey = "HSEARCH-4173")
public void multiIndex_withMissingFieldIndex() {
assumeTrue("This backend doesn't support distance sorts on a field that is missing from some of the target indexes.", TckConfiguration.get().getBackendFeatures().supportsDistanceSortWhenFieldMissingInSomeTargetIndexes());
StubMappingScope scope = mainIndex.createScope(missingFieldIndex);
SearchQuery<DocumentReference> query;
String fieldPath = getFieldPath();
query = matchNonEmptyQuery(f -> f.distance(fieldPath, CENTER_POINT), scope);
/*
* Not testing the ordering of results here because it's not what we are interested in:
* we just want to check that fields are correctly detected as compatible,
* that no exception is thrown and that the query is correctly executed on all indexes
* with no silent error (HSEARCH-4173).
*/
assertThatQuery(query).hasDocRefHitsAnyOrder(b -> {
b.doc(missingFieldIndex.typeName(), MISSING_FIELD_INDEX_DOCUMENT_1);
b.doc(mainIndex.typeName(), DOCUMENT_1);
b.doc(mainIndex.typeName(), DOCUMENT_2);
b.doc(mainIndex.typeName(), DOCUMENT_3);
});
}
use of org.hibernate.search.util.impl.test.annotation.TestForIssue in project hibernate-search by hibernate.
the class DistanceSearchSortTypeCheckingAndConversionIT method multiIndex_withMissingFieldIndex_nested.
/**
* Test the behavior when even the <strong>parent</strong> field of the field to sort on is missing,
* and that parent field is <strong>nested</strong> in the main index.
*/
@Test
@TestForIssue(jiraKey = "HSEARCH-4173")
public void multiIndex_withMissingFieldIndex_nested() {
assumeTrue("This backend doesn't support distance sorts on a nested field that is missing from some of the target indexes.", TckConfiguration.get().getBackendFeatures().supportsDistanceSortWhenNestedFieldMissingInSomeTargetIndexes());
StubMappingScope scope = mainIndex.createScope(missingFieldIndex);
SearchQuery<DocumentReference> query;
String fieldPath = getFieldInNestedPath();
query = matchNonEmptyQuery(f -> f.distance(fieldPath, CENTER_POINT), scope);
/*
* Not testing the ordering of results here because it's not what we are interested in:
* we just want to check that fields are correctly detected as compatible,
* that no exception is thrown and that the query is correctly executed on all indexes
* with no silent error (HSEARCH-4173).
*/
assertThatQuery(query).hasDocRefHitsAnyOrder(b -> {
b.doc(missingFieldIndex.typeName(), MISSING_FIELD_INDEX_DOCUMENT_1);
b.doc(mainIndex.typeName(), DOCUMENT_1);
b.doc(mainIndex.typeName(), DOCUMENT_2);
b.doc(mainIndex.typeName(), DOCUMENT_3);
});
}
use of org.hibernate.search.util.impl.test.annotation.TestForIssue in project hibernate-search by hibernate.
the class FieldSearchProjectionTypeCheckingAndConversionIT method multiIndex_withMissingFieldIndex_projectionConverterDisabled.
@Test
@TestForIssue(jiraKey = "HSEARCH-4173")
public void multiIndex_withMissingFieldIndex_projectionConverterDisabled() {
StubMappingScope scope = mainIndex.createScope(missingFieldIndex);
String fieldPath = getFieldWithConverterPath();
assertThatQuery(scope.query().select(f -> f.field(fieldPath, fieldType.getJavaType(), ValueConvert.NO)).where(f -> f.matchAll()).toQuery()).hasHitsAnyOrder(getFieldValue(1), getFieldValue(2), getFieldValue(3), // Empty document
null, // From the "missing field" index
null);
}
use of org.hibernate.search.util.impl.test.annotation.TestForIssue in project hibernate-search by hibernate.
the class FieldSearchProjectionTypeCheckingAndConversionIT method multiIndex_withMissingFieldIndex_projectionConverterEnabled.
@Test
@TestForIssue(jiraKey = "HSEARCH-4173")
public void multiIndex_withMissingFieldIndex_projectionConverterEnabled() {
StubMappingScope scope = mainIndex.createScope(missingFieldIndex);
String fieldPath = getFieldWithConverterPath();
assertThatQuery(scope.query().select(f -> f.field(fieldPath, ValueWrapper.class)).where(f -> f.matchAll()).toQuery()).hasHitsAnyOrder(new ValueWrapper<F>(getFieldValue(1)), new ValueWrapper<F>(getFieldValue(2)), new ValueWrapper<F>(getFieldValue(3)), // Empty document
new ValueWrapper<F>(null), // From the "missing field" index
new ValueWrapper<F>(null));
}
Aggregations