HnswIndex class
An annotation to create an HSNW index for a field of an Entity class. See HnswIndex.new.
Constructors
- HnswIndex({int? dimensions, int? neighborsPerNode, int? indexingSearchCount, HnswFlags? flags, VectorDistanceType? distanceType, double? reparationBacklinkProbability, int? vectorCacheHintSizeKB, VectorQuantization? quantization, double? quantizationOversample, double? quantizationRescoreFactor, VectorSearchLevel? searchLevel, VectorBuildLevel? buildLevel, int? bruteForceMaxCandidates, int? filteredSearchMaxNodes, int? randomSeed})
-
Creates an HNSW index for a field of an Entity class.
const
Properties
- bruteForceMaxCandidates → int?
-
For queries combining nearest neighbor search with other conditions: if
the other conditions (using indexes and relations) leave at most this many
candidates, the nearest neighbors among the matching candidates are found
by brute force instead of by a graph search with a filter. Brute force
results always carry exact distances.
final
- buildLevel → VectorBuildLevel?
-
Sets the neighborsPerNode and the indexingSearchCount of a build
level; see VectorBuildLevel. If those are set too, they take precedence
over the level.
final
- dimensions → int?
-
Dimensions of vectors; vector data with fewer dimensions are ignored.
Vectors with more dimensions than specified here are only evaluated up to
the given dimension value.
final
- distanceType → VectorDistanceType?
-
The distance type used for the HNSW index; if none is given, the default
VectorDistanceType.euclidean is used.
final
- filteredSearchMaxNodes → int?
-
For queries combining nearest neighbor search with other conditions: the
graph search, which accepts only objects matching the other conditions as
results, explores at most this many nodes; if few objects match, it would
otherwise walk through much of the graph. At the limit, the query returns
the matching objects found so far, which may be fewer than the requested
result count.
final
- flags → HnswFlags?
-
See HnswFlags.new.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- indexingSearchCount → int?
-
Aka "efConstruction": the number of neighbor searched for while indexing
(default: 128; an existing index keeps the value it was built with, e.g.
100, the default before 6.0).
final
- neighborsPerNode → int?
-
Aka "M": the max number of connections per node (default: 30).
final
- quantization → VectorQuantization?
-
The quantization (compression) of the vectors held in memory for
searching; see VectorQuantization for the available types and the
default.
final
- quantizationOversample → double?
-
With quantization: the oversample factor that corrects for the
quantization error, for searches that do not set one: they explore this
factor times as many candidates (rounded, at least the requested result
count).
final
- quantizationRescoreFactor → double?
-
With quantization and rescoring: sets how many of the explored
candidates are rescored with the full-precision vectors, for searches that
do not set it: only this factor times the requested result count of the
candidates with the nearest estimates (rounded, at least the result count,
at most the explored candidates), i.e. fewer object reads when exploring
many candidates.
final
- randomSeed → int?
-
Seeds the random levels of new graph nodes (if not set or 0: a random
seed), e.g. for reproducible tests: putting the same objects in the same
order builds the same graph. Each store opening restarts the random
sequence, transactions do not.
final
- reparationBacklinkProbability → double?
-
When repairing the graph after a node was removed, this gives the
probability of adding backlinks to the repaired neighbors.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchLevel → VectorSearchLevel?
-
The search level of queries that do not set one (default:
VectorSearchLevel.l4Balanced); see VectorSearchLevel.
final
- vectorCacheHintSizeKB → int?
-
A non-binding hint at the maximum size of the vector cache in KB
(default: 2097152 or 2 GB/GiB).
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited