21 Haziran 2018 Perşembe

HibernateSearch @AnalyzerDef Anotasyonu

Giriş
Şu satırı dahil ederiz.
import org.apache.lucene.analysis.core.LowerCaseFilterFactory;
import org.apache.lucene.analysis.core.WhitespaceTokenizerFactory;

import org.hibernate.search.annotations.AnalyzerDef;
import org.hibernate.search.annotations.TokenFilterDef;
import org.hibernate.search.annotations.TokenizerDef;
Örnek
Şöyle yaparız.
@Entity
@Indexed
@Inheritance
@Table(name = "application",
 uniqueConstraints = { @UniqueConstraint(columnNames = "reference") })
@AnalyzerDef(name = "customAnalyser",
 tokenizer = @TokenizerDef(factory = WhitespaceTokenizerFactory.class), filters = {

        @TokenFilterDef(factory = LowerCaseFilterFactory.class), // Lowercase
                                                                    // all
                                                                    // characters
})
public class Application implements Serializable {
  ...
}

Hiç yorum yok:

Yorum Gönder