Couchbase Lite C++
Couchbase Lite C++ API
Loading...
Searching...
No Matches
cbl::IndexUpdater Class Reference

Updates a lazy index by setting the computed vectors for the documents returned from QueryIndex::beginUpdate. More...

#include <cbl++/QueryIndex.hh>

Inheritance diagram for cbl::IndexUpdater:

Public Member Functions

size_t count () const
 The total number of vectors to compute and set for updating the index.
fleece::Value value (size_t index) const
 Get the value at the given index for computing the vector.
void setVector (unsigned index, const float *_Nullable vector, size_t dimension)
 Sets the vector for the value corresponding to the given index.
void skipVector (size_t index)
 Skip setting the vector for the value corresponding to the index.
void finish ()
 Updates the index with the computed vectors and removes any index rows for which null vector was given.
 IndexUpdater () noexcept
 Constructs a null reference (one that points to no object).
IndexUpdateroperator= (std::nullptr_t)
 Releases the underlying object and resets this to a null reference.
bool valid () const
 Returns true if this references an object, or false if it is a null reference.
 operator bool () const
 Returns true if this references an object (same as valid).
bool operator== (const IndexUpdater &other) const
 Returns true if both sides reference the same object, or are both null references.
bool operator!= (const IndexUpdater &other) const
 Returns true if the two sides reference different objects.
CBLIndexUpdater *_Nullable ref () const
 Returns a pointer to the underlying C object (CBLIndexUpdater), or NULL if this is a null reference.
 IndexUpdater (const IndexUpdater &other) noexcept
 Copy constructor: creates another reference to the same object as other.
 IndexUpdater (IndexUpdater &&other) noexcept
 Move constructor: takes over the reference from other, leaving it a null reference.
IndexUpdateroperator= (const IndexUpdater &other) noexcept
 Copy assignment: replaces this reference with a reference to other's object.
IndexUpdateroperator= (IndexUpdater &&other) noexcept
 Move assignment: replaces this reference with other's, leaving other a null reference.

Protected Member Functions

 IndexUpdater (CBLIndexUpdater *_Nullable ref)
 (Internal) Constructs a reference wrapping, and retaining, a C object pointer.

Static Protected Member Functions

static IndexUpdater adopt (const CBLIndexUpdater *_Nullable i, CBLError *error)

Friends

class QueryIndex

Detailed Description

Updates a lazy index by setting the computed vectors for the documents returned from QueryIndex::beginUpdate.

Currently, the vector index is the only index type that can be updated lazily.

Note
ENTERPRISE EDITION ONLY

Constructor & Destructor Documentation

◆ IndexUpdater() [1/4]

cbl::IndexUpdater::IndexUpdater ( )
inlinenoexcept

Constructs a null reference (one that points to no object).

◆ IndexUpdater() [2/4]

cbl::IndexUpdater::IndexUpdater ( CBLIndexUpdater *_Nullable ref)
inlineexplicitprotected

(Internal) Constructs a reference wrapping, and retaining, a C object pointer.

◆ IndexUpdater() [3/4]

cbl::IndexUpdater::IndexUpdater ( const IndexUpdater & other)
inlinenoexcept

Copy constructor: creates another reference to the same object as other.

◆ IndexUpdater() [4/4]

cbl::IndexUpdater::IndexUpdater ( IndexUpdater && other)
inlinenoexcept

Move constructor: takes over the reference from other, leaving it a null reference.

Member Function Documentation

◆ adopt()

IndexUpdater cbl::IndexUpdater::adopt ( const CBLIndexUpdater *_Nullable i,
CBLError * error )
inlinestaticprotected

◆ count()

size_t cbl::IndexUpdater::count ( ) const
inline

The total number of vectors to compute and set for updating the index.

◆ finish()

void cbl::IndexUpdater::finish ( )
inline

Updates the index with the computed vectors and removes any index rows for which null vector was given.

If there are any indexes that do not have their vector value set or are skipped, a error will be returned.

Note
Before calling IndexUpdater::finish, the set vectors are kept in the memory.
Warning
The index updater cannot be used after calling IndexUpdater::finish.

◆ operator bool()

cbl::IndexUpdater::operator bool ( ) const
inlineexplicit

Returns true if this references an object (same as valid).

◆ operator!=()

bool cbl::IndexUpdater::operator!= ( const IndexUpdater & other) const
inline

Returns true if the two sides reference different objects.

◆ operator=() [1/3]

IndexUpdater & cbl::IndexUpdater::operator= ( const IndexUpdater & other)
inlinenoexcept

Copy assignment: replaces this reference with a reference to other's object.

◆ operator=() [2/3]

IndexUpdater & cbl::IndexUpdater::operator= ( IndexUpdater && other)
inlinenoexcept

Move assignment: replaces this reference with other's, leaving other a null reference.

◆ operator=() [3/3]

IndexUpdater & cbl::IndexUpdater::operator= ( std::nullptr_t )
inline

Releases the underlying object and resets this to a null reference.

◆ operator==()

bool cbl::IndexUpdater::operator== ( const IndexUpdater & other) const
inline

Returns true if both sides reference the same object, or are both null references.

◆ ref()

CBLIndexUpdater *_Nullable cbl::IndexUpdater::ref ( ) const
inline

Returns a pointer to the underlying C object (CBLIndexUpdater), or NULL if this is a null reference.

◆ setVector()

void cbl::IndexUpdater::setVector ( unsigned index,
const float *_Nullable vector,
size_t dimension )
inline

Sets the vector for the value corresponding to the given index.

Setting NULL vector means that there is no vector for the value, and any existing vector will be removed when the IndexUpdater::finish is called.

Parameters
indexThe zero-based index.
vectorA pointer to the vector which is an array of floats, or NULL if there is no vector.
dimensionThe dimension of vector. Must be equal to the dimension value set in the vector index config.

◆ skipVector()

void cbl::IndexUpdater::skipVector ( size_t index)
inline

Skip setting the vector for the value corresponding to the index.

The vector will be required to compute and set again when the QueryIndex::beginUpdate is later called.

Parameters
indexThe zero-based index.

◆ valid()

bool cbl::IndexUpdater::valid ( ) const
inline

Returns true if this references an object, or false if it is a null reference.

◆ value()

fleece::Value cbl::IndexUpdater::value ( size_t index) const
inline

Get the value at the given index for computing the vector.

Parameters
indexThe zero-based index.
Returns
The value.

◆ QueryIndex

friend class QueryIndex
friend

The documentation for this class was generated from the following file: