You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developers/applications/defining-schemas.md
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,7 +169,35 @@ The `@primaryKey` directive specifies that an attribute is the primary key for a
169
169
170
170
#### `@indexed`
171
171
172
-
The `@indexed` directivespecifiesthatanattributeshouldbeindexed. Thisisnecessaryifyouwanttoexecutequeriesusingthisattribute (whether that is through RESTful query parameters, SQL, or NoSQL operations).
172
+
The `@indexed` directivespecifiesthatanattributeshouldbeindexed. Whenanattributeisindexed, Harperwillcreatesecondaryindexfromthedatainthisfieldforfast/efficientqueryingusingthisfield. Thisisnecessaryifyouwanttoexecutequeriesusingthisattribute (whether that is through RESTful query parameters, SQL, or NoSQL operations).
173
+
174
+
Astandardindexwillindexthevaluesineachfield, soyoucanquerydirectlybythosevalues. Ifthefield'svalueisanarray, eachofthevaluesinthearraywillbeindexed (you can query by any individual value).
175
+
176
+
#### Vector Indexing
177
+
178
+
The `@indexed` directivecanalsospecifya `type`. Tousevectorindexing, youcanspecifythe `type` as `HNSW` forHierarchicalNavigableSmallWorldindexing. Thiswillcreateavectorindexfortheattribute. Forexample:
HNSW supports several additional arguments to the `@indexed` directive to adjust the HNSW parameters:
195
+
*`distance` - Define the distance function. This can be set to 'euclidean' or 'cosine' (uses negative of cosine similarity). The default is cosine.
196
+
*`efConstruction` - Maximum number of nodes to keep in the list for finding nearest neighbors. A higher value can yield better recall, and a lower value can have better performance. If `efSearchConstruction` is set, this is only applied to indexing. The default is 100.
197
+
*`M` - The preferred number of connections at each layer in the HNSW graph. A higher number uses more space but can be helpful when the intrinsic dimensionality of the data is higher. A lower number can be more efficient. The default is 16.
198
+
*`optimizeRouting` - This uses a heuristic to avoid graph connections that match existing indirect connections (connections through another node). This can yield more efficient graph traversals for the same M setting. This is a number between 0 and 1 and a higher value will more aggressively omit connections with alternate paths. Setting this to 0 will disable route optimizing and follow the traditional HNSW algorithm for creating connections. The default is 0.5.
199
+
*`mL` - The normalization factor for level generation, by default this is computed from `M`.
200
+
*`efSearchConstruction` - Maximum number of nodes to keep in the list for finding nearest neighbors for searching. The default is 50.
4.6 introduces vector indexing support with the Hierarchical Navigable Small World (HNSW) algorithm. This provides powerful efficient vector-based searching for semantic and AI-based querying functionality. HNSW maintains an optimal balance of recall rate with efficient, high-performance execution.
0 commit comments