Interface QueryOptimizer

  • All Known Implementing Classes:
    DisableQueryOptimizer, EmpiricalQueryOptimizer

    public interface QueryOptimizer
    Interface to automatically add indexes to a database when no suitable indexes have been found. The dummy implementation DisableQueryOptimizer can be used to disable this functionality, for example for benchmarking purposes.
    Since:
    0.8.0
    Author:
    Erich Schubert
    • Method Detail

      • getSimilarityQuery

        default <O> SimilarityQuery<O> getSimilarityQuery​(Relation<? extends O> relation,
                                                          Similarity<? super O> similarityFunction,
                                                          int flags)
        Optimize a similarity query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        similarityFunction - Similarity function
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • getDistanceQuery

        default <O> DistanceQuery<O> getDistanceQuery​(Relation<? extends O> relation,
                                                      Distance<? super O> distanceFunction,
                                                      int flags)
        Optimize a distance query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceFunction - Distance function
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • kNNByObject

        default <O> KNNSearcher<O> kNNByObject​(Relation<? extends O> relation,
                                               DistanceQuery<O> distanceQuery,
                                               int maxk,
                                               int flags)
        Optimize a kNN query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceQuery - distance query
        maxk - Maximum k
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • kNNByDBID

        default <O> KNNSearcher<DBIDRef> kNNByDBID​(Relation<? extends O> relation,
                                                   DistanceQuery<O> distanceQuery,
                                                   int maxk,
                                                   int flags)
        Optimize a kNN query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceQuery - distance query
        maxk - Maximum k
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • rangeByObject

        default <O> RangeSearcher<O> rangeByObject​(Relation<? extends O> relation,
                                                   DistanceQuery<O> distanceQuery,
                                                   double maxrange,
                                                   int flags)
        Optimize a range query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceQuery - distance query
        maxrange - Maximum range
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • rangeByDBID

        default <O> RangeSearcher<DBIDRef> rangeByDBID​(Relation<? extends O> relation,
                                                       DistanceQuery<O> distanceQuery,
                                                       double maxrange,
                                                       int flags)
        Optimize a range query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceQuery - distance query
        maxrange - Maximum range
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • similarityRangeByObject

        default <O> RangeSearcher<O> similarityRangeByObject​(Relation<? extends O> relation,
                                                             SimilarityQuery<O> simQuery,
                                                             double maxrange,
                                                             int flags)
        Optimize a range query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        simQuery - similarity query
        maxrange - Maximum range
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • similarityRangeByDBID

        default <O> RangeSearcher<DBIDRef> similarityRangeByDBID​(Relation<? extends O> relation,
                                                                 SimilarityQuery<O> simQuery,
                                                                 double maxrange,
                                                                 int flags)
        Optimize a range query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        simQuery - similarity query
        maxrange - Maximum range
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • rkNNByObject

        default <O> RKNNSearcher<O> rkNNByObject​(Relation<? extends O> relation,
                                                 DistanceQuery<O> distanceQuery,
                                                 int maxk,
                                                 int flags)
        Optimize a reverse nearest neighbors query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceQuery - distance query
        flags - Optimizer flags
        maxk - Maximum k to query
        Returns:
        optimized query, if possible
      • rkNNByDBID

        default <O> RKNNSearcher<DBIDRef> rkNNByDBID​(Relation<? extends O> relation,
                                                     DistanceQuery<O> distanceQuery,
                                                     int maxk,
                                                     int flags)
        Optimize a reverse nearest neighbors query for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceQuery - distance query
        flags - Optimizer flags
        maxk - Maximum k to query
        Returns:
        optimized query, if possible
      • priorityByObject

        default <O> PrioritySearcher<O> priorityByObject​(Relation<? extends O> relation,
                                                         DistanceQuery<O> distanceQuery,
                                                         double maxrange,
                                                         int flags)
        Optimize a distance priority search for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceQuery - distance query
        maxrange - Maximum range
        flags - Optimizer flags
        Returns:
        optimized query, if possible
      • priorityByDBID

        default <O> PrioritySearcher<DBIDRef> priorityByDBID​(Relation<? extends O> relation,
                                                             DistanceQuery<O> distanceQuery,
                                                             double maxrange,
                                                             int flags)
        Optimize a distance priority search for this relation.
        Type Parameters:
        O - Object type
        Parameters:
        relation - Data relation
        distanceQuery - distance query
        maxrange - Maximum range
        flags - Optimizer flags
        Returns:
        optimized query, if possible