<commit_before>package com.rizki.mufrizal.aplikasi.inventory.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;

/**
 *
 * @Author <NAME> <<EMAIL>>
 * @Since Mar 16, 2016
 * @Time 7:47:08 PM
 * @Encoding UTF-8
 * @Project Aplikasi-Inventory
 * @Package com.rizki.mufrizal.aplikasi.inventory.domain
 *
 */
@Entity
@Table(name = "tb_barang", indexes = {
    @Index(columnList = "id_barang", name = "idBarang")
})
public class Barang implements Serializable {

    @Id
    @GeneratedValue(generator = "uuid2")
    @GenericGenerator(name = "uuid2", strategy = "uuid2")
    @Column(name = "id_barang", length = 150)
    private String idBarang;

    @Column(name = "nama_barang", length = 50, nullable = false)
    private String namaBarang;

    @Enumerated(EnumType.STRING)
    @Column(name = "jenis_barang", length = 50, nullable = false)
    private JenisBarang jenisBarang;

    @Temporal(TemporalType.DATE)
    @Column(name = "tanggal_kadaluarsa", nullable = false)
    private Date tanggalKadaluarsa;

    @Column(name = "harga_satuan_barang")
    private BigDecimal hargaSatuanBarang;<commit_msg>tambah indexed dan analyzer hibernate search pada domain barang<commit_after>package com.rizki.mufrizal.aplikasi.inventory.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.apache.lucene.analysis.core.LowerCaseFilterFactory;
import org.apache.lucene.analysis.snowball.SnowballPorterFilterFactory;
import org.apache.lucene.analysis.standard.StandardTokenizerFactory;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.AnalyzerDef;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;
import org.hibernate.search.annotations.TokenFilterDef;
import org.hibernate.search.annotations.TokenizerDef;

/**
 *
 * @Author <NAME> <<EMAIL>>
 * @Since Mar 16, 2016
 * @Time 7:47:08 PM
 * @Encoding UTF-8
 * @Project Aplikasi-Inventory
 * @Package com.rizki.mufrizal.aplikasi.inventory.domain
 *
 */
@Entity
@Indexed
@AnalyzerDef(name = "BarangAnalyzer",
    tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class),
    filters = {
        @TokenFilterDef(factory = LowerCaseFilterFactory.class),
        @TokenFilterDef(factory = SnowballPorterFilterFactory.class)
    }
)
@Table(name = "tb_barang", indexes = {
    @Index(columnList = "id_barang", name = "idBarang")
})
public class Barang implements Serializable {

    @Id
    @DocumentId
    @GeneratedValue(generator = "uuid2")
    @GenericGenerator(name = "uuid2", strategy = "uuid2")
    @Column(name = "id_barang", length = 150)
    private String idBarang;

    @Analyzer(definition = "BarangAnalyzer")
    @Column(name = "nama_barang", length = 50, nullable = false)
    @Field(index = org.hibernate.search.annotations.Index.YES, analyze = Analyze.YES, store = Store.NO)
    private String namaBarang;

    @Enumerated(EnumType.STRING)
    @Column(name = "jenis_barang", length = 50, nullable = false)
    private JenisBarang jenisBarang;

    @Temporal(TemporalType.DATE)
    @Column(name = "tanggal_kadaluarsa", nullable = false)
    private Date tanggalKadaluarsa;

    @Column(name = "harga_satuan_barang")
    private BigDecimal hargaSatuanBarang;
{'fraction_non_alphanumeric': 0.111358574610245, 'fraction_numerical': 0.009799554565701559, 'mean_word_length': 5.246175243393602, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '419660', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1420, 'n_words': 277}