-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuildVectorQuery.test.ts
More file actions
30 lines (25 loc) · 973 Bytes
/
buildVectorQuery.test.ts
File metadata and controls
30 lines (25 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { buildVectorQuery } from './buildVectorQuery';
interface Document {
vec: number[];
}
describe('buildVectorQuery', () => {
it('composes a query f the nearest neighbor vector search', () => {
expect(buildVectorQuery<Document>('vec', [0.96826, 0.94, 0.39557, 0.306488])).toBe(
'vec:([0.96826,0.94,0.39557,0.306488])'
);
});
it('composes a query for searching for similar documents', () => {
expect(buildVectorQuery<Document>('vec', 'foobar')).toBe('vec:([],id:foobar)');
});
it('composes a query for searching for similar documents', () => {
expect(buildVectorQuery<Document>('vec', 'foobar')).toBe('vec:([],id:foobar)');
});
it('composes a query for a brute-force searching', () => {
expect(
buildVectorQuery<Document>('vec', [0.96826, 0.94, 0.39557, 0.306488], {
$k: 100,
$flat_search_cutoff: 20,
})
).toBe('vec:([0.96826,0.94,0.39557,0.306488],k:100,flat_search_cutoff:20)');
});
});