LiteCore
Couchbase Lite cross-platform core implementation
Loading...
Searching...
No Matches
c4Index.h
Go to the documentation of this file.
1//
2// c4Index.h
3//
4// Copyright 2019-Present Couchbase, Inc.
5//
6// Use of this software is governed by the Business Source License included
7// in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
8// in that file, in accordance with the Business Source License, use of this
9// software will be governed by the Apache License, Version 2.0, included in
10// the file licenses/APL2.txt.
11//
12
13#pragma once
14#include "c4IndexTypes.h"
15
18
19//======== C4Collection Methods:
20
72 C4QueryLanguage queryLanguage, C4IndexType indexType,
73 const C4IndexOptions* C4NULLABLE indexOptions,
74 C4Error* C4NULLABLE outError) C4API;
75
79 C4Error* C4NULLABLE outError) C4API;
80
88 C4Error* C4NULLABLE outError) C4API;
89
98
107
108//======== C4Index Methods:
109
113
117
121
125
129
136
137
138#ifdef COUCHBASE_ENTERPRISE
139
145CBL_CORE_API bool c4index_isTrained(C4Index*, C4Error* C4NULLABLE outError) C4API;
146
147
148//======== UPDATING LAZY INDEXES:
149
150
171NODISCARD CBL_CORE_API C4IndexUpdater* C4NULLABLE c4index_beginUpdate(C4Index* index, size_t limit,
172 C4Error* outError) C4API;
173
176CBL_CORE_API size_t c4indexupdater_count(C4IndexUpdater* updater) C4API;
177
187NODISCARD CBL_CORE_API FLValue C4NULLABLE c4indexupdater_valueAt(C4IndexUpdater* updater, size_t i) C4API;
188
198NODISCARD CBL_CORE_API bool c4indexupdater_setVectorAt(C4IndexUpdater* updater, size_t i,
199 const float vector[C4NULLABLE], size_t dimension,
200 C4Error* outError) C4API;
201
210CBL_CORE_API bool c4indexupdater_skipVectorAt(C4IndexUpdater* updater, size_t i) C4API;
211
228CBL_CORE_API bool c4indexupdater_finish(C4IndexUpdater* updater, C4Error* outError) C4API;
229
230#endif
231
232
233#ifndef C4_STRICT_COLLECTION_API
234//======== SEMI-DEPRECATED DATABASE METHODS:
236 C4IndexType indexType, const C4IndexOptions* C4NULLABLE indexOptions,
237 C4Error* C4NULLABLE outError) C4API;
239 C4QueryLanguage queryLanguage, C4IndexType indexType,
240 const C4IndexOptions* C4NULLABLE indexOptions,
241 C4Error* C4NULLABLE outError) C4API;
243#endif
244
256
#define NODISCARD
Definition CompilerSupport.h:59
#define CBL_CORE_API
Definition c4Compat.h:134
#define C4NULLABLE
Definition c4Compat.h:38
#define C4API
Definition c4Compat.h:114
#define C4_ASSUME_NONNULL_BEGIN
Definition c4Compat.h:36
#define C4API_END_DECLS
Definition c4Compat.h:116
#define C4API_BEGIN_DECLS
Definition c4Compat.h:115
#define C4_ASSUME_NONNULL_END
Definition c4Compat.h:37
struct C4Index C4Index
Represents an existing index.
Definition c4Base.h:148
struct C4IndexUpdater C4IndexUpdater
Describes a set of index values that need to be computed by the application.
Definition c4Base.h:151
struct C4Collection C4Collection
Opaque handle to a namespace of documents in an opened database.
Definition c4Base.h:126
struct C4Database C4Database
Opaque handle to an opened database.
Definition c4Base.h:136
NODISCARD CBL_CORE_API bool c4db_deleteIndex(C4Database *database, C4String name, C4Error *outError)
NODISCARD CBL_CORE_API bool c4db_createIndex2(C4Database *database, C4String name, C4String indexSpec, C4QueryLanguage queryLanguage, C4IndexType indexType, const C4IndexOptions *indexOptions, C4Error *outError)
CBL_CORE_API bool c4index_getOptions(C4Index *index, C4IndexOptions *outOpts)
Gets the index's FTS/vector options, if any.
CBL_CORE_API C4SliceResult c4coll_getIndexesInfo(C4Collection *collection, C4Error *outError)
Returns information about all indexes in the collection.
NODISCARD CBL_CORE_API bool c4coll_createIndex(C4Collection *collection, C4String name, C4String indexSpec, C4QueryLanguage queryLanguage, C4IndexType indexType, const C4IndexOptions *indexOptions, C4Error *outError)
Creates a collection index, of the values of specific expressions across all documents.
CBL_CORE_API C4Index * c4coll_getIndex(C4Collection *collection, C4String name, C4Error *outError)
Returns an object representing an existing index.
CBL_CORE_API C4SliceResult c4db_getIndexesInfo(C4Database *database, C4Error *outError)
Returns information about all indexes in the database.
NODISCARD CBL_CORE_API bool c4coll_deleteIndex(C4Collection *collection, C4String name, C4Error *outError)
Deletes an index that was created by c4coll_createIndex.
CBL_CORE_API C4String c4index_getExpression(C4Index *)
Returns the indexed expression.
CBL_CORE_API C4IndexType c4index_getType(C4Index *)
Returns the index's type.
CBL_CORE_API C4Slice c4index_getName(C4Index *index)
Returns the name of this index.
NODISCARD CBL_CORE_API bool c4db_createIndex(C4Database *database, C4String name, C4String indexSpecJSON, C4IndexType indexType, const C4IndexOptions *indexOptions, C4Error *outError)
CBL_CORE_API C4QueryLanguage c4index_getQueryLanguage(C4Index *)
Returns the index's query language (JSON or N1QL).
C4IndexType
Definition c4IndexTypes.h:25
CBL_CORE_API bool c4coll_isIndexTrained(C4Collection *collection, C4String name, C4Error *outError)
Returns whether a vector index has been trained yet or not.
CBL_CORE_API C4Collection * c4index_getCollection(C4Index *index)
Returns the collection this index belongs to.
C4QueryLanguage
Definition c4QueryTypes.h:26
const struct _FLValue * FLValue
A reference to a value of any type.
Definition FLBase.h:35
An error value.
Definition c4Error.h:133
Options for indexes; these each apply to specific types of indexes.
Definition c4IndexTypes.h:89
A simple reference to a block of memory.
Definition FLSlice.h:45
A heap-allocated block of memory returned from an API call.
Definition FLSlice.h:63