Class LuceneIndexRootBuilder
java.lang.Object
org.hibernate.search.backend.lucene.document.model.dsl.impl.LuceneIndexRootBuilder
- All Implemented Interfaces:
IndexCompositeNodeBuilder,IndexRootBuilder,IndexSchemaBuildContext
public class LuceneIndexRootBuilder
extends Object
implements IndexRootBuilder, IndexSchemaBuildContext
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLuceneIndexRootBuilder(EventContext indexEventContext, BackendMapperContext backendMapperContext, String mappedTypeName, LuceneAnalysisDefinitionRegistry analysisDefinitionRegistry) -
Method Summary
Modifier and TypeMethodDescriptionaddField(String relativeFieldName, TreeNodeInclusion inclusion, IndexFieldType<F> indexFieldType) Create a new field and add it to the current builder.addFieldTemplate(String templateName, TreeNodeInclusion inclusion, IndexFieldType<?> indexFieldType, String prefix) Create a new field template and add it to the current builder.addNamedPredicate(String name, TreeNodeInclusion inclusion, PredicateDefinition definition) Create a new named predicate and add it to the current builder.addObjectField(String relativeFieldName, TreeNodeInclusion inclusion, ObjectStructure structure) Create a new object field and add it to the current builder.addObjectFieldTemplate(String templateName, ObjectStructure structure, String prefix, TreeNodeInclusion inclusion) Create a new object field template and add it to the current builder.createTypeFactory(IndexFieldTypeDefaultsProvider defaultsProvider) voidInform the model collector that documents will always be provided along with an explicit routing key, to be used to route the document to a specific shard.<I> voididDslConverter(Class<I> valueType, ToDocumentValueConverter<I, String> converter) Defines how identifier values passed to the search DSL should be converted to document identifiers when usingValueModel.MAPPING.voididParser(ToDocumentValueConverter<String, String> converter) Defines how identifier values passed to the search DSL should be converted to document identifiers when usingValueModel.STRING.<I> voididProjectionConverter(Class<I> valueType, FromDocumentValueConverter<String, I> converter) Define how values returned when projecting on identifiers should be converted before being returned to the user.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.search.engine.backend.document.model.dsl.spi.IndexCompositeNodeBuilder
addField, addFieldTemplate, addNamedPredicate, addObjectField, addObjectFieldTemplate
-
Field Details
-
typeBuilder
-
-
Constructor Details
-
LuceneIndexRootBuilder
public LuceneIndexRootBuilder(EventContext indexEventContext, BackendMapperContext backendMapperContext, String mappedTypeName, LuceneAnalysisDefinitionRegistry analysisDefinitionRegistry)
-
-
Method Details
-
eventContext
- Specified by:
eventContextin interfaceIndexSchemaBuildContext- Returns:
- A list of failure context elements to be passed to the constructor of any
SearchExceptionoccurring in this context.
-
createTypeFactory
public LuceneIndexFieldTypeFactory createTypeFactory(IndexFieldTypeDefaultsProvider defaultsProvider) - Specified by:
createTypeFactoryin interfaceIndexRootBuilder
-
explicitRouting
public void explicitRouting()Description copied from interface:IndexRootBuilderInform the model collector that documents will always be provided along with an explicit routing key, to be used to route the document to a specific shard.- Specified by:
explicitRoutingin interfaceIndexRootBuilder
-
idDslConverter
Description copied from interface:IndexRootBuilderDefines how identifier values passed to the search DSL should be converted to document identifiers when usingValueModel.MAPPING.- Specified by:
idDslConverterin interfaceIndexRootBuilder- Type Parameters:
I- The type of identifier values that can be passed to the DSL.- Parameters:
valueType- The type of values that can be passed to the DSL.converter- A converter from the given value type to the document identifier (a string).
-
idParser
Description copied from interface:IndexRootBuilderDefines how identifier values passed to the search DSL should be converted to document identifiers when usingValueModel.STRING.- Specified by:
idParserin interfaceIndexRootBuilder- Parameters:
converter- A converter from the string value type to the document identifier (a string).
-
idProjectionConverter
public <I> void idProjectionConverter(Class<I> valueType, FromDocumentValueConverter<String, I> converter) Description copied from interface:IndexRootBuilderDefine how values returned when projecting on identifiers should be converted before being returned to the user.When not set, users will be returned the document identifier directly.
- Specified by:
idProjectionConverterin interfaceIndexRootBuilder- Type Parameters:
I- The type of values that will be returned when projecting on identifiers.- Parameters:
valueType- The type of values that will be returned when projecting on fields of this type.converter- A converter from the document identifier (a string) to the given value type.
-
getRootNodeBuilder
-
build
-
toString
-
addField
public <F> IndexSchemaFieldOptionsStep<?,IndexFieldReference<F>> addField(String relativeFieldName, TreeNodeInclusion inclusion, IndexFieldType<F> indexFieldType) Description copied from interface:IndexCompositeNodeBuilderCreate a new field and add it to the current builder.- Specified by:
addFieldin interfaceIndexCompositeNodeBuilder- Type Parameters:
F- The type of values for the new field- Parameters:
relativeFieldName- The relative name of the new fieldinclusion- Whether fields matching this template should be included, provided their parent is included.indexFieldType- The type of the new field- Returns:
- A DSL step where the field can be defined in more details.
-
addObjectField
public IndexObjectFieldBuilder addObjectField(String relativeFieldName, TreeNodeInclusion inclusion, ObjectStructure structure) Description copied from interface:IndexCompositeNodeBuilderCreate a new object field and add it to the current builder.- Specified by:
addObjectFieldin interfaceIndexCompositeNodeBuilder- Parameters:
relativeFieldName- The relative name of the new object fieldinclusion- Whether fields matching this template should be included, provided their parent is included.structure- The structure of the new object field- Returns:
- A builder for the new object field
-
addNamedPredicate
public IndexSchemaNamedPredicateOptionsStep addNamedPredicate(String name, TreeNodeInclusion inclusion, PredicateDefinition definition) Description copied from interface:IndexCompositeNodeBuilderCreate a new named predicate and add it to the current builder.- Specified by:
addNamedPredicatein interfaceIndexCompositeNodeBuilder- Parameters:
name- The relative name of the new named predicate.inclusion- Whether fields matching this template should be included, provided their parent is included.definition- The definition of the named predicate.- Returns:
- A DSL step where the named predicate can be defined in more details.
-
addFieldTemplate
public IndexSchemaFieldTemplateOptionsStep<?> addFieldTemplate(String templateName, TreeNodeInclusion inclusion, IndexFieldType<?> indexFieldType, String prefix) Description copied from interface:IndexCompositeNodeBuilderCreate a new field template and add it to the current builder.- Specified by:
addFieldTemplatein interfaceIndexCompositeNodeBuilder- Parameters:
templateName- The name of the new templateinclusion- Whether fields matching this template should be included, provided their parent is included.indexFieldType- The type of the new field templateprefix- A prefix to prepend to theglob patternand to field paths passed toDocumentElement.addValue(String, Object).- Returns:
- A DSL step where the field template can be defined in more details.
-
addObjectFieldTemplate
public IndexSchemaFieldTemplateOptionsStep<?> addObjectFieldTemplate(String templateName, ObjectStructure structure, String prefix, TreeNodeInclusion inclusion) Description copied from interface:IndexCompositeNodeBuilderCreate a new object field template and add it to the current builder.- Specified by:
addObjectFieldTemplatein interfaceIndexCompositeNodeBuilder- Parameters:
templateName- The name of the new templatestructure- The structure of the new object field templateprefix- A prefix to prepend to theglob patternand to field paths passed toDocumentElement.addObject(String).inclusion- Whether fields matching this template should be included, provided their parent is included.- Returns:
- A DSL step where the field template can be defined in more details.
-