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 Modifier and Type Field Description protected LuceneIndexCompositeNodeType.BuildertypeBuilder
-
Constructor Summary
Constructors Constructor Description LuceneIndexRootBuilder(EventContext indexEventContext, BackendMapperContext backendMapperContext, String mappedTypeName, LuceneAnalysisDefinitionRegistry analysisDefinitionRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <F> IndexSchemaFieldOptionsStep<?,IndexFieldReference<F>>addField(String relativeFieldName, TreeNodeInclusion inclusion, IndexFieldType<F> indexFieldType)Create a new field and add it to the current builder.IndexSchemaFieldTemplateOptionsStep<?>addFieldTemplate(String templateName, TreeNodeInclusion inclusion, IndexFieldType<?> indexFieldType, String prefix)Create a new field template and add it to the current builder.IndexSchemaNamedPredicateOptionsStepaddNamedPredicate(String name, TreeNodeInclusion inclusion, PredicateDefinition definition)Create a new named predicate and add it to the current builder.IndexObjectFieldBuilderaddObjectField(String relativeFieldName, TreeNodeInclusion inclusion, ObjectStructure structure)Create a new object field and add it to the current builder.IndexSchemaFieldTemplateOptionsStep<?>addObjectFieldTemplate(String templateName, ObjectStructure structure, String prefix, TreeNodeInclusion inclusion)Create a new object field template and add it to the current builder.LuceneIndexModelbuild(String indexName)LuceneIndexFieldTypeFactorycreateTypeFactory(IndexFieldTypeDefaultsProvider defaultsProvider)EventContexteventContext()voidexplicitRouting()Inform 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.LuceneIndexRootBuildergetRootNodeBuilder()<I> voididDslConverter(Class<I> valueType, ToDocumentValueConverter<I,String> converter)Defines how identifier values passed to the search DSL should be converted to document identifiers.<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.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.search.engine.backend.document.model.dsl.spi.IndexCompositeNodeBuilder
addField, addFieldTemplate, addNamedPredicate, addObjectField, addObjectFieldTemplate
-
-
-
-
Field Detail
-
typeBuilder
protected final LuceneIndexCompositeNodeType.Builder typeBuilder
-
-
Constructor Detail
-
LuceneIndexRootBuilder
public LuceneIndexRootBuilder(EventContext indexEventContext, BackendMapperContext backendMapperContext, String mappedTypeName, LuceneAnalysisDefinitionRegistry analysisDefinitionRegistry)
-
-
Method Detail
-
eventContext
public EventContext 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
public <I> void idDslConverter(Class<I> valueType, ToDocumentValueConverter<I,String> converter)
Description copied from interface:IndexRootBuilderDefines how identifier values passed to the search DSL should be converted to document identifiers.When not set, users are expected to pass document identifiers directly.
- 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).
-
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
public LuceneIndexRootBuilder getRootNodeBuilder()
-
build
public LuceneIndexModel build(String indexName)
-
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.
-
-