CBLIndexBuilder

@interface CBLIndexBuilder : NSObject

IndexBuilder used for building database index objects.

  • Create a value index with the given index items. The index items are a list of the properties or expressions to be indexed.

    Declaration

    Objective-C

    + (nonnull CBLValueIndex *)valueIndexWithItems:
        (nonnull NSArray<CBLValueIndexItem *> *)items;

    Swift

    class func valueIndex(with items: [CBLValueIndexItem]) -> CBLValueIndex

    Parameters

    items

    The index items.

    Return Value

    The value index.

  • Create a full-text search index with the given index item and options. Typically the index item is the property that is used to perform the match operation against with. Setting the nil options means using the default options.

    Declaration

    Objective-C

    + (nonnull CBLFullTextIndex *)fullTextIndexWithItems:
        (nonnull NSArray<CBLFullTextIndexItem *> *)items;

    Swift

    class func fullTextIndex(with items: [CBLFullTextIndexItem]) -> CBLFullTextIndex

    Parameters

    items

    The index items.

    Return Value

    The full-text search index.

  • Not available

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • ENTERPRISE EDITION ONLY : UNCOMMITTED

    Create a predictive index with the given predictive model name, input specification to the predictive model, and the properties of the prediction result.

    The input given specification should be matched to the input specification given to the query prediction() function so that the predictive index can be matched and used in query.

    The predictive index is different from the normal index in that the predictive index will also cache the prediction result along with creating the value index of the specified properties. If the properties are not specified, the predictive index will only cache the prediction result so that the prediction model will not be called again after indexing. If multiple properties are specified, a compound value index will be created from the the given properties.

    Declaration

    Objective-C

    + (nonnull CBLPredictiveIndex *)
        predictiveIndexWithModel:(nonnull NSString *)model
                           input:(nonnull CBLQueryExpression *)input
                      properties:(nullable NSArray<NSString *> *)properties;

    Swift

    class func predictiveIndex(withModel model: String, input: CBLQueryExpression, properties: [String]?) -> CBLPredictiveIndex

    Parameters

    model

    The predictive model name.

    input

    The input specification that should be matched with the input specification given to the query prediction function.

    properties

    The prediction result’s properties to be indexed.

    Return Value

    The predictive index.