Interface IndexQueryFactory<T>

  • Type Parameters:
    T - The type of query created by this factory.

    public interface IndexQueryFactory<T>
    A factory for creating arbitrarily complex index queries. This interface is implemented by the underlying backend implementation and passed to extensible matching rules so that they can construct arbitrarily complex index queries.
    • Method Detail

      • createExactMatchQuery

        T createExactMatchQuery​(AttributeDescription attributeDescription,
                                String indexId,
                                ByteString key)
        Returns a query requesting an index record matching the provided key.
        Parameters:
        attributeDescription - The attribute description whose index should be queried.
        indexId - An identifier of the index to be queried.
        key - A byte string containing the key.
        Returns:
        A query requesting the index record matching the key.
      • createMatchAllQuery

        T createMatchAllQuery​(AttributeDescription attributeDescription)
        Returns a query requesting all index records. A backend implementation may choose to return all or no records as part of the optimization.
        Parameters:
        attributeDescription - The attribute description whose index should be queried.
        Returns:
        A query requesting all index records.
      • createRangeMatchQuery

        T createRangeMatchQuery​(AttributeDescription attributeDescription,
                                String indexId,
                                ByteString lower,
                                ByteString upper,
                                boolean lowerIncluded,
                                boolean upperIncluded)
        Returns a query requesting all index records in the specified range.
        Parameters:
        attributeDescription - The attribute description whose index should be queried.
        indexId - An identifier of the index to be queried.
        lower - The lower bound of the range, or null if there is no lower bound and the range will start from the smallest key.
        upper - The upper bound of the range, or null if there is no upper bound and the range will end at the largest key.
        lowerIncluded - true if a key exactly matching the lower bound is included in the range, false if only keys strictly greater than the lower bound are included. This value is ignored if the lower bound is not specified.
        upperIncluded - true if a key exactly matching the upper bound is included in the range, false if only keys strictly less than the upper bound are included. This value is ignored if the upper bound is not specified.
        Returns:
        A query requesting all index records in the specified range.
      • createIntersectionQuery

        T createIntersectionQuery​(List<T> subQueries)
        Returns a query which returns the intersection of a list of sub-queries.
        Parameters:
        subQueries - A list of sub-queries.
        Returns:
        A query which returns the intersection of a list of sub-queries.
      • createUnionQuery

        T createUnionQuery​(List<T> subQueries)
        Returns a query which combines the results of a list of sub-queries.
        Parameters:
        subQueries - A list of sub-queries.
        Returns:
        A query which combines the results of a list of sub-queries.
      • createFirstOfQuery

        T createFirstOfQuery​(List<T> subQueries)
        Returns a query which evaluates each of the provided sub-queries one after another until one succeeds. A sub-query fails if its associated indexes are unavailable. A sub-query that returns an undefined set of candidates is still considered to be successful (it is assumed that subsequent sub-queries will also be undefined).
        Parameters:
        subQueries - A list of sub-queries.
        Returns:
        A query which evaluates each of the provide sub-queries one after another until one succeeds.
      • getIndexingOptionsOrNull

        IndexingOptions getIndexingOptionsOrNull​(AttributeDescription attributeDescription)
        Returns the indexing options for the provided attribute, or null if the attribute is not indexed.
        Parameters:
        attributeDescription - The attribute description whose index options should be queried.
        Returns:
        The indexing options for the provided attribute, or null if the attribute is not indexed.