Elffuss BraidHub

kikocis/lancedb public

main · 2.8 KiBRenderedRawPermalink
1[**@lancedb/lancedb**](../README.md) • **Docs**
2
3***
4
5[@lancedb/lancedb](../globals.md) / Index
6
7# Class: Index
8
9## Methods
10
11### btree()
12
13> `static` **btree**(): [`Index`](Index.md)
14
15Create a btree index
16
17A btree index is an index on a scalar columns. The index stores a copy of the column
18in sorted order. A header entry is created for each block of rows (currently the
19block size is fixed at 4096). These header entries are stored in a separate
20cacheable structure (a btree). To search for data the header is used to determine
21which blocks need to be read from disk.
22
23For example, a btree index in a table with 1Bi rows requires sizeof(Scalar) * 256Ki
24bytes of memory and will generally need to read sizeof(Scalar) * 4096 bytes to find
25the correct row ids.
26
27This index is good for scalar columns with mostly distinct values and does best when
28the query is highly selective.
29
30The btree index does not currently have any parameters though parameters such as the
31block size may be added in the future.
32
33#### Returns
34
35[`Index`](Index.md)
36
37***
38
39### ivfPq()
40
41> `static` **ivfPq**(`options`?): [`Index`](Index.md)
42
43Create an IvfPq index
44
45This index stores a compressed (quantized) copy of every vector. These vectors
46are grouped into partitions of similar vectors. Each partition keeps track of
47a centroid which is the average value of all vectors in the group.
48
49During a query the centroids are compared with the query vector to find the closest
50partitions. The compressed vectors in these partitions are then searched to find
51the closest vectors.
52
53The compression scheme is called product quantization. Each vector is divided into
54subvectors and then each subvector is quantized into a small number of bits. the
55parameters `num_bits` and `num_subvectors` control this process, providing a tradeoff
56between index size (and thus search speed) and index accuracy.
57
58The partitioning process is called IVF and the `num_partitions` parameter controls how
59many groups to create.
60
61Note that training an IVF PQ index on a large dataset is a slow operation and
62currently is also a memory intensive operation.
63
64#### Parameters
65
66• **options?**: `Partial`<[`IvfPqOptions`](../interfaces/IvfPqOptions.md)>
67
68#### Returns
69
70[`Index`](Index.md)
71
72### fts()
73
74> `static` **fts**(`options`?): [`Index`](Index.md)
75
76Create a full text search index
77
78This index is used to search for text data. The index is created by tokenizing the text
79into words and then storing occurrences of these words in a data structure called inverted index
80that allows for fast search.
81
82During a search the query is tokenized and the inverted index is used to find the rows that
83contain the query words. The rows are then scored based on BM25 and the top scoring rows are
84sorted and returned.
85
86#### Parameters
87
88• **options?**: `Partial`<[`FtsOptions`](../interfaces/FtsOptions.md)>
89
90#### Returns
91
92[`Index`](Index.md)