18 Nisan 2022 Pazartesi

HibernateSearch @FullTextFieldAnotasyonu

Giriş
Şu satırı dahil ederiz.
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
Açıklaması şöyle
we annotate the fields we want to search on with the @FullTextField annotation. This annotation works only for string fields, but others exist for fields of different types.
Örnek
Şöyle yaparız
import org.hibernate.annotations.NaturalId;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;


@Indexed
@Entity
@Table(name = "plant")
public class Plant {

  @FullTextField
  @NaturalId
  private String name;

  @FullTextField
  @NaturalId
  private String scientificName;

  @FullTextField
  private String family;
  
}