@Documented @Target({METHOD,FIELD}) @Retention(RUNTIME) @Repeatable(List.class) @PropertyMapping(processor=@PropertyMappingAnnotationProcessorRef(type=org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.impl.GenericFieldProcessor.class,retrieval=CONSTRUCTOR)) public @interface GenericField
Maps an entity property to a field in the index.

This is a generic annotation that will work for any standard field type supported by the backend: String, Integer, LocalDate, ...

Note that this annotation, being generic, does not offer configuration options that are specific to only some types of fields. Use more specific annotations if you want that kind of configuration. For example, to define a tokenized (multi-word) text field, use FullTextField. To define a non-tokenized (single-word), but normalized (lowercased, ...) text field, use KeywordField.

  • Element Details

    • name

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

      Projectable projectable
      Returns:
      Whether projections are enabled for this field.
      Default:
      DEFAULT
    • sortable

      Sortable sortable
      Returns:
      Whether this field should be sortable.
      Default:
      DEFAULT
    • searchable

      Searchable searchable
      Returns:
      Whether this field should be searchable.
      See Also:
      Default:
      DEFAULT
    • aggregable

      Aggregable aggregable
      Returns:
      Whether aggregations are enabled for this field.
      See Also:
      Default:
      DEFAULT
    • indexNullAs

      String indexNullAs
      Returns:
      A value used instead of null values when indexing.
      Default:
      "__HibernateSearch_indexNullAs_default"
    • valueBridge

      ValueBridgeRef valueBridge
      Returns:
      A reference to the value bridge to use for this field. Must not be set if valueBinder() is set.
      See Also:
      Default:
      @org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef
    • valueBinder

      ValueBinderRef valueBinder
      Returns:
      A reference to the value binder to use for this field. Must not be set if valueBridge() is set.
      See Also:
      Default:
      @org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBinderRef
    • extraction

      Returns:
      A definition of container extractors to be applied to the property, allowing the binding of a value bridge to 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 binding the field to the map keys instead of the map values. By default, Hibernate Search will try to apply a set of extractors for common container types.
      See Also:
      Default:
      @org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction