Search in sources :

Example 1 with TypeMappingStep

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep in project hibernate-search by hibernate.

the class RoutingBridgeRoutingKeyIT method params.

@Parameterized.Parameters(name = "{0}")
public static List<?> params() {
    return DocumentationSetupHelper.testParamsForBothAnnotationsAndProgrammatic(BackendConfigurations.hashBasedSharding(SHARD_COUNT), mapping -> {
        // tag::programmatic[]
        TypeMappingStep bookMapping = mapping.type(Book.class);
        bookMapping.indexed().routingBinder(new BookGenreRoutingBinder());
        bookMapping.property("genre").keywordField();
    // end::programmatic[]
    });
}
Also used : TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep)

Example 2 with TypeMappingStep

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep in project hibernate-search by hibernate.

the class RoutingBridgeConditionalIndexingIT method params.

@Parameterized.Parameters(name = "{0}")
public static List<?> params() {
    return DocumentationSetupHelper.testParamsForBothAnnotationsAndProgrammatic(BackendConfigurations.simple(), mapping -> {
        // tag::programmatic[]
        TypeMappingStep bookMapping = mapping.type(Book.class);
        bookMapping.indexed().routingBinder(new BookStatusRoutingBinder());
        bookMapping.property("status").keywordField();
    // end::programmatic[]
    });
}
Also used : TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep)

Example 3 with TypeMappingStep

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep in project hibernate-search by hibernate.

the class ValueBridgeBinderIT method params.

@Parameterized.Parameters(name = "{0}")
public static List<?> params() {
    return DocumentationSetupHelper.testParamsForBothAnnotationsAndProgrammatic(BackendConfigurations.simple(), mapping -> {
        // tag::programmatic[]
        TypeMappingStep bookMapping = mapping.type(Book.class);
        bookMapping.indexed();
        bookMapping.property("isbn").genericField().valueBinder(new ISBNValueBinder()).sortable(Sortable.YES);
    // end::programmatic[]
    });
}
Also used : TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep)

Example 4 with TypeMappingStep

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep in project hibernate-search by hibernate.

the class ContainerExtractorIT method params.

@Parameterized.Parameters(name = "{0}")
public static List<?> params() {
    return DocumentationSetupHelper.testParamsForBothAnnotationsAndProgrammatic(BackendConfigurations.simple(), mapping -> {
        TypeMappingStep bookMapping = mapping.type(Book.class);
        bookMapping.indexed();
        // tag::programmatic-extractor[]
        bookMapping.property("priceByFormat").genericField("availableFormats").extractor(BuiltinContainerExtractors.MAP_KEY);
        // end::programmatic-extractor[]
        // tag::programmatic-noExtractors[]
        bookMapping.property("authors").genericField("authorCount").valueBridge(new MyCollectionSizeBridge()).noExtractors();
    // end::programmatic-noExtractors[]
    });
}
Also used : TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep)

Example 5 with TypeMappingStep

use of org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep in project hibernate-search by hibernate.

the class TypeBridgeParamIT method params.

@Parameterized.Parameters(name = "{0}")
public static List<?> params() {
    return DocumentationSetupHelper.testParamsForBothAnnotationsAndProgrammatic(BackendConfigurations.simple(), mapping -> {
        // tag::programmatic[]
        TypeMappingStep authorMapping = mapping.type(Author.class);
        authorMapping.indexed();
        authorMapping.binder(new FullNameBinder().sortField(true));
    // end::programmatic[]
    });
}
Also used : TypeMappingStep(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep)

Aggregations

TypeMappingStep (org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep)79 Test (org.junit.Test)50 BackendMock (org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock)35 Rule (org.junit.Rule)35 TestForIssue (org.hibernate.search.util.impl.test.annotation.TestForIssue)30 SearchException (org.hibernate.search.util.common.SearchException)23 Indexed (org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed)21 SearchMapping (org.hibernate.search.mapper.javabean.mapping.SearchMapping)20 SearchSession (org.hibernate.search.mapper.javabean.session.SearchSession)20 PojoModelPath (org.hibernate.search.mapper.pojo.model.path.PojoModelPath)20 MethodHandles (java.lang.invoke.MethodHandles)19 ArrayList (java.util.ArrayList)19 List (java.util.List)19 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)19 JavaBeanMappingSetupHelper (org.hibernate.search.integrationtest.mapper.pojo.testsupport.util.rule.JavaBeanMappingSetupHelper)19 Arrays (java.util.Arrays)18 LocalDate (java.time.LocalDate)17 LinkedHashMap (java.util.LinkedHashMap)16 Map (java.util.Map)16 Month (java.time.Month)15