Search in sources :

Example 1 with BulkIndexer

use of org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer in project hibernate-search by hibernate.

the class FieldSearchProjectionTypeCheckingAndConversionIT method initData.

private static void initData() {
    BulkIndexer mainIndexer = mainIndex.bulkIndexer().add(DOCUMENT_1, document -> initDocument(mainIndex.binding(), document, 1)).add(DOCUMENT_2, document -> initDocument(mainIndex.binding(), document, 2)).add(DOCUMENT_3, document -> initDocument(mainIndex.binding(), document, 3)).add(EMPTY, document -> {
    });
    BulkIndexer compatibleIndexer = compatibleIndex.bulkIndexer().add(COMPATIBLE_INDEX_DOCUMENT_1, document -> {
        compatibleIndex.binding().fieldModels.forEach(f -> addFieldValue(document, f, 1));
        compatibleIndex.binding().fieldWithConverterModels.forEach(f -> addFieldValue(document, f, 1));
    });
    BulkIndexer rawFieldCompatibleIndexer = rawFieldCompatibleIndex.bulkIndexer().add(RAW_FIELD_COMPATIBLE_INDEX_DOCUMENT_1, document -> rawFieldCompatibleIndex.binding().fieldWithConverterModels.forEach(f -> addFieldValue(document, f, 1)));
    BulkIndexer missingFieldIndexer = missingFieldIndex.bulkIndexer().add(MISSING_FIELD_INDEX_DOCUMENT_1, document -> {
    });
    mainIndexer.join(compatibleIndexer, rawFieldCompatibleIndexer, missingFieldIndexer);
}
Also used : SearchException(org.hibernate.search.util.common.SearchException) SimpleFieldModelsByType(org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType) IndexObjectFieldReference(org.hibernate.search.engine.backend.document.IndexObjectFieldReference) BeforeClass(org.junit.BeforeClass) SimpleFieldModel(org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModel) Searchable(org.hibernate.search.engine.backend.types.Searchable) RunWith(org.junit.runner.RunWith) FromDocumentValueConvertContext(org.hibernate.search.engine.backend.types.converter.runtime.FromDocumentValueConvertContext) SearchSetupHelper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper) SearchResultAssert.assertThatQuery(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatQuery) ObjectStructure(org.hibernate.search.engine.backend.types.ObjectStructure) ArrayList(java.util.ArrayList) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) BulkIndexer(org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer) FromDocumentValueConverter(org.hibernate.search.engine.backend.types.converter.FromDocumentValueConverter) SimpleMappedIndex(org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex) StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) ValueConvert(org.hibernate.search.engine.search.common.ValueConvert) ClassRule(org.junit.ClassRule) DocumentElement(org.hibernate.search.engine.backend.document.DocumentElement) Parameterized(org.junit.runners.Parameterized) ValueWrapper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper) FieldTypeDescriptor(org.hibernate.search.integrationtest.backend.tck.testsupport.types.FieldTypeDescriptor) Sortable(org.hibernate.search.engine.backend.types.Sortable) Test(org.junit.Test) IndexSchemaElement(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaElement) IndexSchemaObjectField(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaObjectField) List(java.util.List) TestForIssue(org.hibernate.search.util.impl.test.annotation.TestForIssue) Aggregable(org.hibernate.search.engine.backend.types.Aggregable) StandardIndexFieldTypeOptionsStep(org.hibernate.search.engine.backend.types.dsl.StandardIndexFieldTypeOptionsStep) Projectable(org.hibernate.search.engine.backend.types.Projectable) BulkIndexer(org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer)

Example 2 with BulkIndexer

use of org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer in project hibernate-search by hibernate.

the class FieldSearchProjectionMultiValuedBaseIT method setup.

@BeforeClass
public static void setup() {
    setupHelper.start().withIndex(index).setup();
    BulkIndexer indexer = index.bulkIndexer();
    for (DataSet<?> dataSet : dataSets) {
        dataSet.contribute(indexer);
    }
    indexer.join();
}
Also used : BulkIndexer(org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer) BeforeClass(org.junit.BeforeClass)

Example 3 with BulkIndexer

use of org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer in project hibernate-search by hibernate.

the class FieldSearchSortTypeCheckingAndConversionIT method initData.

private static void initData() {
    BulkIndexer mainIndexer = mainIndex.bulkIndexer().add(DOCUMENT_2, document -> initDocument(mainIndex.binding(), document, DOCUMENT_2_ORDINAL)).add(EMPTY, document -> initDocument(mainIndex.binding(), document, null)).add(DOCUMENT_1, document -> initDocument(mainIndex.binding(), document, DOCUMENT_1_ORDINAL)).add(DOCUMENT_3, document -> initDocument(mainIndex.binding(), document, DOCUMENT_3_ORDINAL));
    BulkIndexer compatibleIndexer = compatibleIndex.bulkIndexer().add(COMPATIBLE_INDEX_DOCUMENT_1, document -> {
        CompatibleIndexBinding binding = compatibleIndex.binding();
        binding.fieldModels.forEach(fieldModel -> addValue(fieldModel, document, DOCUMENT_1_ORDINAL));
        binding.fieldWithDslConverterModels.forEach(fieldModel -> addValue(fieldModel, document, DOCUMENT_1_ORDINAL));
    });
    BulkIndexer rawFieldCompatibleIndexer = rawFieldCompatibleIndex.bulkIndexer().add(RAW_FIELD_COMPATIBLE_INDEX_DOCUMENT_1, document -> initDocument(rawFieldCompatibleIndex.binding(), document, DOCUMENT_1_ORDINAL));
    BulkIndexer missingFieldIndexer = missingFieldIndex.bulkIndexer().add(MISSING_FIELD_INDEX_DOCUMENT_1, document -> {
    });
    mainIndexer.join(compatibleIndexer, rawFieldCompatibleIndexer, missingFieldIndexer);
}
Also used : SearchException(org.hibernate.search.util.common.SearchException) SimpleFieldModelsByType(org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType) IndexObjectFieldReference(org.hibernate.search.engine.backend.document.IndexObjectFieldReference) BeforeClass(org.junit.BeforeClass) SimpleFieldModel(org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModel) Searchable(org.hibernate.search.engine.backend.types.Searchable) RunWith(org.junit.runner.RunWith) SortFinalStep(org.hibernate.search.engine.search.sort.dsl.SortFinalStep) SearchSetupHelper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper) SearchResultAssert.assertThatQuery(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatQuery) SearchSortFactory(org.hibernate.search.engine.search.sort.dsl.SearchSortFactory) Function(java.util.function.Function) ObjectStructure(org.hibernate.search.engine.backend.types.ObjectStructure) ArrayList(java.util.ArrayList) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) BulkIndexer(org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer) Locale(java.util.Locale) SimpleMappedIndex(org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex) StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) ValueConvert(org.hibernate.search.engine.search.common.ValueConvert) FailureReportUtils(org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils) ClassRule(org.junit.ClassRule) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) DocumentElement(org.hibernate.search.engine.backend.document.DocumentElement) Parameterized(org.junit.runners.Parameterized) ValueWrapper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper) FieldTypeDescriptor(org.hibernate.search.integrationtest.backend.tck.testsupport.types.FieldTypeDescriptor) Sortable(org.hibernate.search.engine.backend.types.Sortable) EventContexts(org.hibernate.search.engine.reporting.spi.EventContexts) Test(org.junit.Test) IndexSchemaElement(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaElement) IndexSchemaObjectField(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaObjectField) InvalidType(org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType) NormalizedStringFieldTypeDescriptor(org.hibernate.search.integrationtest.backend.tck.testsupport.types.NormalizedStringFieldTypeDescriptor) Consumer(java.util.function.Consumer) List(java.util.List) TestForIssue(org.hibernate.search.util.impl.test.annotation.TestForIssue) Aggregable(org.hibernate.search.engine.backend.types.Aggregable) StandardIndexFieldTypeOptionsStep(org.hibernate.search.engine.backend.types.dsl.StandardIndexFieldTypeOptionsStep) SearchQuery(org.hibernate.search.engine.search.query.SearchQuery) Assume.assumeTrue(org.junit.Assume.assumeTrue) Projectable(org.hibernate.search.engine.backend.types.Projectable) TckConfiguration(org.hibernate.search.integrationtest.backend.tck.testsupport.util.TckConfiguration) BulkIndexer(org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer)

Example 4 with BulkIndexer

use of org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer in project hibernate-search by hibernate.

the class DistanceSearchProjectionMultiValuedBaseIT method setup.

@BeforeClass
public static void setup() {
    setupHelper.start().withIndexes(mainIndex, sortableIndex).setup();
    BulkIndexer mainIndexer = mainIndex.bulkIndexer();
    BulkIndexer sortableIndexer = sortableIndex.bulkIndexer();
    for (DataSet dataSet : dataSets) {
        dataSet.contribute(mainIndexer, sortableIndexer);
    }
    mainIndexer.join(sortableIndexer);
}
Also used : BulkIndexer(org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer) BeforeClass(org.junit.BeforeClass)

Example 5 with BulkIndexer

use of org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer in project hibernate-search by hibernate.

the class DistanceSearchProjectionSingleValuedBaseIT method setup.

@BeforeClass
public static void setup() {
    setupHelper.start().withIndexes(mainIndex, sortableIndex).setup();
    BulkIndexer mainIndexer = mainIndex.bulkIndexer();
    BulkIndexer sortableIndexer = sortableIndex.bulkIndexer();
    for (DataSet dataSet : dataSets) {
        dataSet.contribute(mainIndexer, sortableIndexer);
    }
    mainIndexer.join(sortableIndexer);
}
Also used : BulkIndexer(org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer) BeforeClass(org.junit.BeforeClass)

Aggregations

BulkIndexer (org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer)66 BeforeClass (org.junit.BeforeClass)58 Test (org.junit.Test)17 SearchSetupHelper (org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper)16 SearchResultAssert.assertThatQuery (org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatQuery)16 SimpleMappedIndex (org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex)15 StubMappingScope (org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope)15 IndexSchemaElement (org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaElement)14 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)13 SearchException (org.hibernate.search.util.common.SearchException)13 TestForIssue (org.hibernate.search.util.impl.test.annotation.TestForIssue)13 ClassRule (org.junit.ClassRule)13 DocumentElement (org.hibernate.search.engine.backend.document.DocumentElement)12 Sortable (org.hibernate.search.engine.backend.types.Sortable)12 DocumentReference (org.hibernate.search.engine.backend.common.DocumentReference)10 IndexObjectFieldReference (org.hibernate.search.engine.backend.document.IndexObjectFieldReference)10 IndexSchemaObjectField (org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaObjectField)10 ObjectStructure (org.hibernate.search.engine.backend.types.ObjectStructure)10 Projectable (org.hibernate.search.engine.backend.types.Projectable)10 SearchQuery (org.hibernate.search.engine.search.query.SearchQuery)9