Annotation Type KeywordField


  • @Documented
    @Target({METHOD,FIELD})
    @Retention(RUNTIME)
    @Repeatable(List.class)
    @PropertyMapping(processor=@PropertyMappingAnnotationProcessorRef(type=org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.impl.KeywordFieldProcessor.class,retrieval=CONSTRUCTOR))
    public @interface KeywordField
    Maps a property to a keyword field in the index, holding a single token (word) of text.

    On contrary to FullTextField, this annotation only creates non-tokenized (single-word) text fields. As a result:

    • The field value (the value of your annotated property, or at least the value produced by your custom value bridge must be of type String
    • You cannot assign an analyzer when using this annotation
    • You can, however, assign a normalizer (which is an analyzer that doesn't perform tokenization) when using this annotation
    • This annotation allows to make the field sortable

    If you want to index a non-String value, use the GenericField annotation instead. If you want to index a String value, but want the field to be tokenized, use FullTextField instead.

    • Element Detail

      • name

        String name
        Returns:
        The name of the index field.
        Default:
        ""
      • normalizer

        String normalizer
        Returns:
        A reference to the normalizer to use for this field. Defaults to an empty string, meaning no normalization at all. See the documentation of your backend to know how to define normalization.
        Default:
        ""
      • norms

        Norms norms
        Returns:
        Whether index time scoring information should be stored or not.
        See Also:
        Norms
        Default:
        org.hibernate.search.engine.backend.types.Norms.DEFAULT
      • indexNullAs

        String indexNullAs
        Returns:
        A value used instead of null values when indexing.
        See Also:
        GenericField.indexNullAs()
        Default:
        "__HibernateSearch_indexNullAs_default"
      • extraction

        ContainerExtraction extraction
        Returns:
        A definition of container extractors to be applied to the property, allowing the binding of a value bridge to container elements. By default, Hibernate Search will try to apply a set of extractors for common container types.
        See Also:
        GenericField.extraction()
        Default:
        @org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction