001package io.ebean.annotation;
002
003import java.lang.annotation.ElementType;
004import java.lang.annotation.Retention;
005import java.lang.annotation.RetentionPolicy;
006import java.lang.annotation.Target;
007
008/**
009 * Specify the entity type maps to a document store (like ElasticSearch).
010 */
011@Target({ElementType.FIELD})
012@Retention(RetentionPolicy.RUNTIME)
013public @interface DocProperty {
014
015  /**
016   * Set this to true to indicate that this property should be un-analysed.
017   */
018  boolean code() default false;
019
020  /**
021   * Set this to true to get an additional un-analysed 'raw' field to use for sorting etc.
022   */
023  boolean sortable() default false;
024
025  /**
026   * Set to true to have the property additionally stored separately from _source.
027   */
028  boolean store() default false;
029
030  /**
031   * Set a boost value specific to this property.
032   */
033  float boost() default 1;
034
035  /**
036   * Set a value to use instead of null.
037   */
038  String nullValue() default "";
039
040  /**
041   * Set this to false to exclude this from the _all property.
042   */
043  boolean includeInAll() default true;
044
045  /**
046   * The analyzer to use.
047   */
048  String analyzer() default "";
049
050  /**
051   * The analyzer to use for searches.
052   */
053  String searchAnalyzer() default "";
054
055  /**
056   * The index options for this property.
057   */
058  Option options() default Option.DEFAULT;
059
060  /**
061   * Set this to false such that doc values are not stored separately for this property.
062   */
063  boolean docValues() default true;
064
065  /**
066   * Set a copyTo field.
067   */
068  String copyTo() default "";
069
070  /**
071   * Set to false to disable the field from indexing, it will only be get/set in _source.
072   */
073  boolean enabled() default true;
074
075  /**
076   * Set to false such that norms are not stored.
077   */
078  boolean norms() default true;
079
080  /**
081   * Index options for a property.
082   */
083  enum Option {
084
085    /**
086     * Only index the doc number.
087     */
088    DOCS,
089
090    /**
091     * Doc number and term frequencies are indexed.
092     */
093    FREQS,
094
095    /**
096     * Doc number, term frequencies and term positions are indexed.
097     */
098    POSITIONS,
099
100    /**
101     * Doc number, term frequencies, term positions and start/end offsets are indexed.
102     */
103    OFFSETS,
104
105    /**
106     * Use the default which means analysed string properties use POSITIONS as the default and all other types use DOCS.
107     */
108    DEFAULT
109  }
110}