Annotation Type Indexed


  • @Documented
    @Retention(RUNTIME)
    @Target(METHOD)
    public @interface Indexed
    An annotation that should be applied to accessor methods for the properties that need to be indexed.

    Indexing significantly improves query and aggregation performance by both avoiding deserialization of stored entities and optimizing query execution, so in general, any property that is used for querying should be indexed.

    Since:
    21.06
    Author:
    Aleks Seovic 2021.02.12
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class<? extends Comparator> comparator
      An optional Comparator class to use for ordering.
      boolean ordered
      Determines whether the index should be ordered or not (default).
    • Element Detail

      • ordered

        boolean ordered
        Determines whether the index should be ordered or not (default).

        Ordered indices are more effective with range queries, such as greater than, less than and between, and should be used for attributes that are primarily queried using those types of filters.

        When that's not the case, the unordered filters (default) are less expensive to create and maintain, and should be preferred.

        Returns:
        whether the index should be ordered
        Default:
        false
      • comparator

        Class<? extends Comparator> comparator
        An optional Comparator class to use for ordering. Only applicable when ordered() is set to true. Must have a default constructor.

        If not specified, the natural ordering will be used, assuming that the property marked with this annotation returns a type that implements Comparable interface.

        Returns:
        the class of the Comparator to use for ordering
        Default:
        java.util.Comparator.class