Annotation Type IndexingDependency

  • @Documented
    public @interface IndexingDependency
    Given a property, defines how a dependency of the indexing process to this property should affect automatic indexing.

    This annotation is generally not needed, as the default behavior is to consider all properties that are actually used in the indexing process as dependencies that trigger reindexing when they are updated.

    However, some tuning may be required for some properties:

    • Some properties may be updated very frequently and/or trigger reindexing to other entities that are very expensive to load in memory. In that case, it may be a good idea to tell Hibernate Search to ignore updates to those properties using reindexOnUpdate(). The index will be slightly out-of-sync whenever the property is modified, but this can be solved by triggering reindexing manually, for example every night.
    • Some properties may be computed dynamically based on other properties, instead of being stored. In that case, the mapper may not be able to detect changes to the computed property directly. Thus Hibernate Search needs to know which other properties are used when generating the value of this property, which can be configured using derivedFrom().

    This annotation may be applied multiple times to the same property with different extractions, to configure differently the dependency to different container elements. For example with a property of type Map<Entity1, Entity2>, one can have a dependency to Entity1 (map keys) or Entity2 (map values), and each may require a different configuration.

    • Element Detail

      • reindexOnUpdate

        ReindexOnUpdate reindexOnUpdate
        How indexed entities using the annotated property should be reindexed when the value, or any nested value, is updated. This setting is only effective for values that are actually used when indexing (values used in field definitions, in bridges, ...).
      • derivedFrom

        ObjectPath[] derivedFrom
        Paths to other values that are used to generate the value of this property. Paths are relative to the parent type of the annotated property. This is useful mainly for getters that are not simply bound to class field, but rather compute a value based on other properties: it allows Hibernate Search to know that whenever these other properties are changed, this property may change too and thus should be reindexed.
      • extraction

        ContainerExtraction extraction
        A definition of container extractors to be applied to the property, allowing the definition of the indexing dependencies for container elements. This is useful when the property is of container type, for example a Map<TypeA, TypeB>: defining the extraction as @ContainerExtraction(BuiltinContainerExtractors.MAP_KEY) allows referencing map keys instead of map values. By default, Hibernate Search will try to apply a set of extractors for common container types.
        See Also: