IndexUpdater
public class IndexUpdater : ArrayProtocol, Sequence
ENTERPRISE EDITION ONLY
IndexUpdater is used for updating the index in lazy mode. Currently, the vector index is the only index type that can be updated lazily.
-
The total number of vectors to compute and set for updating the index.
Declaration
Swift
public var count: Int { get }
-
Get the value at the given index for computing the vector. The value types are Blob, ArrayObject, DictionaryObject, Number, String, or NSNull based on the underlying data type. Returns nil if the value doesn’t exist, or its value is not a string.
Declaration
Swift
public func value(at index: Int) -> Any?
-
Get the value as string at the given index for computing the vector. Returns nil if the value doesn’t exist, or its value is not a string
Declaration
Swift
public func string(at index: Int) -> String?
-
Gets the value at the given index as an Int for computing the vector. Floating point values will be rounded. The value
true
is returned as 1,false
as 0. Returns 0 if the value doesn’t exist or does not have a numeric value.Declaration
Swift
public func int(at index: Int) -> Int
-
Gets the value at the given index as an Int64 for computing the vector. Floating point values will be rounded. The value
true
is returned as 1,false
as 0. Returns 0 if the value doesn’t exist or does not have a numeric value.Declaration
Swift
public func int64(at index: Int) -> Int64
-
Gets the value at the given index as a Float for computing the vector. Integers will be converted to float. The value
true
is returned as 1.0,false
as 0.0. / Returns 0.0 if the value doesn’t exist or does not have a numeric value.Declaration
Swift
public func float(at index: Int) -> Float
-
Gets the value at the given index as a Double for computing the vector. Integers will be converted to double. The value
true
is returned as 1.0,false
as 0.0. Returns 0.0 if the property doesn’t exist or does not have a numeric value.Declaration
Swift
public func double(at index: Int) -> Double
-
Gets the value at the given index as an NSNumber for computing the vector. Returns nil if the value doesn’t exist, or its value is not a numeric value.
Declaration
Swift
public func number(at index: Int) -> NSNumber?
-
Gets the value at the given index as a Bool for computing the vector. Returns true if the value exists, and is either
true
or a nonzero number.Declaration
Swift
public func boolean(at index: Int) -> Bool
-
Gets the value at the given index as a Blob for computing the vector. Returns nil if the value doesn’t exist, or its value is not a blob.
Declaration
Swift
public func blob(at index: Int) -> Blob?
-
Gets the value at the given index as a Date for computing the vector. JSON does not directly support dates, so the actual property value must be a string, which is then parsed according to the ISO-8601 date format (the default used in JSON.) Returns nil if the value doesn’t exist, is not a string, or is not parseable as a date.
Declaration
Swift
public func date(at index: Int) -> Date?
-
Gets the value at the given index as an ArrayObject for computing the vector. Returns nil if the value doesn’t exists, or its value is not an array.
Declaration
Swift
public func array(at index: Int) -> ArrayObject?
-
Gets the value at the given index as a DictionaryObject for computing the vector. Returns nil if the value doesn’t exists, or its value is not a dictionary.
Declaration
Swift
public func dictionary(at index: Int) -> DictionaryObject?
-
Gets content of the current object as an Array. The value types of the values contained in the returned Array object are Array, Blob, Dictionary, Number types, NSNull, and String.
Declaration
Swift
public func toArray() -> Array<Any>
-
Return all values as JSON String
Declaration
Swift
public func toJSON() -> String
-
Subscript access to a Fragment object by index
Declaration
Swift
public subscript(index: Int) -> Fragment { get }
-
Gets an iterator over values.
Declaration
Swift
public func makeIterator() -> AnyIterator<Any?>
Return Value
The value iterator.
-
Sets the vector for the value corresponding to the index.
Setting nil value means that there is no vector for the value, and any existing vector will be removed when the finish() is called.
Declaration
Swift
public func setVector(_ value: Array<Float>?, at index: Int) throws
Parameters
value
Array of float numbers.
index
The index.
-
Skip setting the vector for the value corresponding to the index. The vector will be required to compute and set again for the value when the QueryIndex’s beginUpdate(limit:) is later called for updating the index.
Declaration
Swift
public func skipVector(at index: Int)
Parameters
index
The index.
-
Updates the index with the computed vectors and removes any index rows for which nil vector was given. If there are any indexes that do not have their vector value set or are skipped, a unsupported error will be thrown.
Note
Before calling the finish() function, the set vectors are kept in the memory.Declaration
Swift
public func finish() throws