use of org.hibernate.search.engine.search.sort.dsl.SearchSortFactory in project hibernate-search by hibernate.
the class DistanceSearchSortBaseIT method factoryWithRoot.
@Test
@TestForIssue(jiraKey = "HSEARCH-4162")
public void factoryWithRoot() {
assumeTestParametersWork();
AbstractObjectBinding parentObjectBinding = index.binding().getParentObject(fieldStructure);
assumeTrue("This test is only relevant when the field is located on an object field", parentObjectBinding.absolutePath != null);
DataSet dataSet = dataSetForAsc;
assertThatQuery(index.query().where(f -> f.matchAll()).routing(dataSet.routingKey).sort(((Function<SearchSortFactory, DistanceSortOptionsStep<?, ?>>) f -> f.withRoot(parentObjectBinding.absolutePath).distance(parentObjectBinding.getRelativeFieldName(fieldStructure, fieldType), CENTER_POINT)).andThen(this::applySortMode).andThen(optionsStep -> {
if (fieldStructure.isInNested()) {
return optionsStep.filter(f -> f.match().field(AbstractObjectBinding.DISCRIMINATOR_FIELD_NAME).matching("included"));
} else {
return optionsStep;
}
}))).hasDocRefHitsExactOrder(index.typeName(), dataSet.doc1Id, dataSet.doc2Id, dataSet.doc3Id, dataSet.emptyDoc1Id);
}
use of org.hibernate.search.engine.search.sort.dsl.SearchSortFactory in project hibernate-search by hibernate.
the class DistanceSortBaseIT method factoryWithRoot.
@Test
@TestForIssue(jiraKey = "HSEARCH-4162")
public void factoryWithRoot() {
assumeTestParametersWork();
AbstractObjectBinding parentObjectBinding = index.binding().getParentObject(fieldStructure);
assumeTrue("This test is only relevant when the field is located on an object field", parentObjectBinding.absolutePath != null);
DataSet dataSet = dataSetForAsc;
assertThatQuery(index.query().where(f -> f.matchAll()).routing(dataSet.routingKey).sort(((Function<SearchSortFactory, DistanceSortOptionsStep<?, ?>>) f -> f.withRoot(parentObjectBinding.absolutePath).distance(parentObjectBinding.getRelativeFieldName(fieldStructure, fieldType), CENTER_POINT)).andThen(this::applySortMode).andThen(optionsStep -> {
if (fieldStructure.isInNested()) {
return optionsStep.filter(f -> f.match().field(AbstractObjectBinding.DISCRIMINATOR_FIELD_NAME).matching("included"));
} else {
return optionsStep;
}
}))).hasDocRefHitsExactOrder(index.typeName(), dataSet.doc1Id, dataSet.doc2Id, dataSet.doc3Id, dataSet.emptyDoc1Id);
}
use of org.hibernate.search.engine.search.sort.dsl.SearchSortFactory in project hibernate-search by hibernate.
the class FieldSortBaseIT method factoryWithRoot.
@Test
@TestForIssue(jiraKey = "HSEARCH-4162")
public void factoryWithRoot() {
assumeTestParametersWork();
AbstractObjectBinding parentObjectBinding = index.binding().getParentObject(fieldStructure);
assumeTrue("This test is only relevant when the field is located on an object field", parentObjectBinding.absolutePath != null);
DataSet<F> dataSet = dataSetForAsc;
assertThatQuery(index.query().where(f -> f.matchAll().except(f.id().matchingAny(Arrays.asList(dataSet.emptyDoc1Id, dataSet.emptyDoc2Id, dataSet.emptyDoc3Id, dataSet.emptyDoc4Id)))).routing(dataSet.routingKey).sort(((Function<SearchSortFactory, FieldSortOptionsStep<?, ?>>) f -> f.withRoot(parentObjectBinding.absolutePath).field(parentObjectBinding.getRelativeFieldName(fieldStructure, fieldType))).andThen(this::applySortMode).andThen(optionsStep -> {
if (fieldStructure.isInNested()) {
return optionsStep.filter(f -> f.match().field(AbstractObjectBinding.DISCRIMINATOR_FIELD_NAME).matching("included"));
} else {
return optionsStep;
}
}))).hasDocRefHitsExactOrder(index.typeName(), dataSet.doc1Id, dataSet.doc2Id, dataSet.doc3Id);
}
use of org.hibernate.search.engine.search.sort.dsl.SearchSortFactory in project hibernate-search by hibernate.
the class FieldSearchSortBaseIT method factoryWithRoot.
@Test
@TestForIssue(jiraKey = "HSEARCH-4162")
public void factoryWithRoot() {
assumeTestParametersWork();
AbstractObjectBinding parentObjectBinding = index.binding().getParentObject(fieldStructure);
assumeTrue("This test is only relevant when the field is located on an object field", parentObjectBinding.absolutePath != null);
DataSet<F> dataSet = dataSetForAsc;
assertThatQuery(index.query().where(f -> f.matchAll().except(f.id().matchingAny(Arrays.asList(dataSet.emptyDoc1Id, dataSet.emptyDoc2Id, dataSet.emptyDoc3Id, dataSet.emptyDoc4Id)))).routing(dataSet.routingKey).sort(((Function<SearchSortFactory, FieldSortOptionsStep<?, ?>>) f -> f.withRoot(parentObjectBinding.absolutePath).field(parentObjectBinding.getRelativeFieldName(fieldStructure, fieldType))).andThen(this::applySortMode).andThen(optionsStep -> {
if (fieldStructure.isInNested()) {
return optionsStep.filter(f -> f.match().field(AbstractObjectBinding.DISCRIMINATOR_FIELD_NAME).matching("included"));
} else {
return optionsStep;
}
}))).hasDocRefHitsExactOrder(index.typeName(), dataSet.doc1Id, dataSet.doc2Id, dataSet.doc3Id);
}
Aggregations