Skip to content

Commit 2f10305

Browse files
committed
change the index definition data
1 parent 83668c4 commit 2f10305

File tree

1 file changed

+187
-103
lines changed

1 file changed

+187
-103
lines changed

src/extensionApiMock.ts

Lines changed: 187 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -176,124 +176,208 @@ const MOCK_INDEXES = {
176176
}
177177

178178
const MOCK_INDEX_DEFINITIONS = {
179+
'idx:bikes_vss': {
180+
index_name: 'idx:bikes_vss',
181+
attributes: [
182+
{
183+
identifier: 'model',
184+
attribute: 'model',
185+
type: 'TEXT',
186+
WEIGHT: '1',
187+
SORTABLE: true,
188+
NOSTEM: true,
189+
},
190+
{
191+
identifier: 'brand',
192+
attribute: 'brand',
193+
type: 'TEXT',
194+
WEIGHT: '1',
195+
SORTABLE: true,
196+
NOSTEM: true,
197+
},
198+
{
199+
identifier: 'price',
200+
attribute: 'price',
201+
type: 'NUMERIC',
202+
SORTABLE: true,
203+
UNF: true,
204+
},
205+
{
206+
identifier: 'type',
207+
attribute: 'type',
208+
type: 'TAG',
209+
SEPARATOR: ',',
210+
},
211+
{
212+
identifier: 'material',
213+
attribute: 'material',
214+
type: 'TAG',
215+
SEPARATOR: ',',
216+
},
217+
{
218+
identifier: 'weight',
219+
attribute: 'weight',
220+
type: 'NUMERIC',
221+
SORTABLE: true,
222+
UNF: true,
223+
},
224+
{
225+
identifier: 'description_embeddings',
226+
attribute: 'description_embeddings',
227+
type: 'VECTOR',
228+
algorithm: 'FLAT',
229+
data_type: 'FLOAT32',
230+
dim: 768,
231+
distance_metric: 'L2',
232+
},
233+
],
234+
documents_type: 'HASH',
235+
},
179236
'idx:smpl_bicycle': {
180237
index_name: 'idx:smpl_bicycle',
181-
index_type: 'HASH',
182-
index_definition: ['ON', 'HASH', 'PREFIX', '1', 'bicycle:'],
183238
attributes: [
184-
['model', 'type', 'TEXT', 'SORTABLE'],
185-
['brand', 'type', 'TEXT', 'SORTABLE'],
186-
['price', 'type', 'NUMERIC', 'SORTABLE'],
187-
['condition', 'type', 'TAG', 'SORTABLE'],
188-
['description', 'type', 'TEXT'],
189-
['year', 'type', 'NUMERIC', 'SORTABLE'],
239+
{
240+
identifier: '$.brand',
241+
attribute: 'brand',
242+
type: 'TEXT',
243+
WEIGHT: '1',
244+
},
245+
{
246+
identifier: '$.model',
247+
attribute: 'model',
248+
type: 'TEXT',
249+
WEIGHT: '1',
250+
},
251+
{
252+
identifier: '$.description',
253+
attribute: 'description',
254+
type: 'TEXT',
255+
WEIGHT: '1',
256+
},
257+
{
258+
identifier: '$.price',
259+
attribute: 'price',
260+
type: 'NUMERIC',
261+
},
262+
{
263+
identifier: '$.condition',
264+
attribute: 'condition',
265+
type: 'TAG',
266+
SEPARATOR: ',',
267+
},
268+
{
269+
identifier: '$.type',
270+
attribute: 'type',
271+
type: 'TAG',
272+
SEPARATOR: '',
273+
},
274+
{
275+
identifier: '$.helmet_included',
276+
attribute: 'helmet_included',
277+
type: 'TAG',
278+
SEPARATOR: '',
279+
},
280+
{
281+
identifier: '$.specs.material',
282+
attribute: 'material',
283+
type: 'TAG',
284+
SEPARATOR: '',
285+
},
286+
{
287+
identifier: '$.specs.weight',
288+
attribute: 'weight',
289+
type: 'NUMERIC',
290+
},
190291
],
191-
num_docs: '2,456',
192-
max_doc_id: '3000',
193-
num_terms: '8,234',
194-
num_records: '24,560',
195-
inverted_sz_mb: '4.12',
196-
vector_index_sz_mb: '0.00',
197-
total_inverted_index_blocks: '156',
198-
offset_vectors_sz_mb: '0.41',
199-
doc_table_size_mb: '1.85',
200-
sortable_values_size_mb: '0.92',
201-
key_table_size_mb: '0.18',
292+
documents_type: 'JSON',
202293
},
203294
'idx:user_prefs': {
204295
index_name: 'idx:user_prefs',
205-
index_type: 'HASH',
206-
index_definition: ['ON', 'HASH', 'PREFIX', '1', 'user_prefs:'],
207296
attributes: [
208-
['user_id', 'type', 'TAG'],
209-
['theme', 'type', 'TAG', 'SORTABLE'],
210-
['language', 'type', 'TAG', 'SORTABLE'],
211-
['notifications', 'type', 'TAG'],
212-
['created_at', 'type', 'NUMERIC', 'SORTABLE'],
213-
['updated_at', 'type', 'NUMERIC', 'SORTABLE'],
214-
],
215-
num_docs: '1,789',
216-
max_doc_id: '2500',
217-
num_terms: '456',
218-
num_records: '17,890',
219-
inverted_sz_mb: '0.87',
220-
vector_index_sz_mb: '0.00',
221-
total_inverted_index_blocks: '45',
222-
offset_vectors_sz_mb: '0.08',
223-
doc_table_size_mb: '0.65',
224-
sortable_values_size_mb: '0.32',
225-
key_table_size_mb: '0.12',
226-
},
227-
'idx:smpl_restaurant': {
228-
index_name: 'idx:smpl_restaurant',
229-
index_type: 'HASH',
230-
index_definition: ['ON', 'HASH', 'PREFIX', '1', 'restaurant:'],
231-
attributes: [
232-
['name', 'type', 'TEXT', 'SORTABLE'],
233-
['cuisine', 'type', 'TAG', 'SORTABLE'],
234-
['rating', 'type', 'NUMERIC', 'SORTABLE'],
235-
['price_range', 'type', 'TAG', 'SORTABLE'],
236-
['location', 'type', 'GEO'],
237-
['description', 'type', 'TEXT'],
297+
{
298+
identifier: '$.descr',
299+
attribute: '$.descr',
300+
type: 'TEXT',
301+
WEIGHT: '1',
302+
},
303+
{
304+
identifier: '$.labels',
305+
attribute: '$.labels',
306+
type: 'TAG',
307+
SEPARATOR: ',',
308+
},
309+
{
310+
identifier: '$.vector_embedding',
311+
attribute: 'vector',
312+
type: 'VECTOR',
313+
algorithm: 'HNSW',
314+
data_type: 'FLOAT32',
315+
dim: 3,
316+
distance_metric: 'COSINE',
317+
M: 16,
318+
ef_construction: 200,
319+
},
238320
],
239-
num_docs: '3,567',
240-
max_doc_id: '4500',
241-
num_terms: '12,345',
242-
num_records: '35,670',
243-
inverted_sz_mb: '6.78',
244-
vector_index_sz_mb: '0.00',
245-
total_inverted_index_blocks: '234',
246-
offset_vectors_sz_mb: '0.67',
247-
doc_table_size_mb: '2.89',
248-
sortable_values_size_mb: '1.45',
249-
key_table_size_mb: '0.34',
321+
documents_type: 'JSON',
250322
},
251-
'idx:bikes_vss': {
252-
index_name: 'idx:bikes_vss',
253-
index_type: 'HASH',
254-
index_definition: ['ON', 'HASH', 'PREFIX', '1', 'bikes_vss:'],
323+
'idx:bicycle': {
324+
index_name: 'idx:bicycle',
255325
attributes: [
256-
['model', 'type', 'TEXT', 'SORTABLE'],
257-
['features', 'type', 'VECTOR', 'FLAT', '6', 'TYPE', 'FLOAT32', 'DIM', '512', 'DISTANCE_METRIC', 'COSINE'],
258-
['category', 'type', 'TAG', 'SORTABLE'],
259-
['price', 'type', 'NUMERIC', 'SORTABLE'],
260-
['availability', 'type', 'TAG'],
326+
{
327+
identifier: '$.brand',
328+
attribute: 'brand',
329+
type: 'TEXT',
330+
WEIGHT: '1',
331+
},
332+
{
333+
identifier: '$.model',
334+
attribute: 'model',
335+
type: 'TEXT',
336+
WEIGHT: '1',
337+
},
338+
{
339+
identifier: '$.description',
340+
attribute: 'description',
341+
type: 'TEXT',
342+
WEIGHT: '1',
343+
},
344+
{
345+
identifier: '$.price',
346+
attribute: 'price',
347+
type: 'NUMERIC',
348+
},
349+
{
350+
identifier: '$.condition',
351+
attribute: 'condition',
352+
type: 'TAG',
353+
SEPARATOR: ',',
354+
INDEXEMPTY: 'INDEXMISSING',
355+
},
261356
],
262-
num_docs: '1,234',
263-
max_doc_id: '1500',
264-
num_terms: '5,678',
265-
num_records: '12,340',
266-
inverted_sz_mb: '3.45',
267-
vector_index_sz_mb: '15.67',
268-
total_inverted_index_blocks: '89',
269-
offset_vectors_sz_mb: '0.34',
270-
doc_table_size_mb: '1.23',
271-
sortable_values_size_mb: '0.67',
272-
key_table_size_mb: '0.15',
357+
documents_type: 'JSON',
273358
},
274-
'idx:bicycle': {
275-
index_name: 'idx:bicycle',
276-
index_type: 'HASH',
277-
index_definition: ['ON', 'HASH', 'PREFIX', '1', 'bike:'],
359+
'idx:smpl_restaurant': {
360+
index_name: 'idx:smpl_restaurant',
278361
attributes: [
279-
['title', 'type', 'TEXT', 'SORTABLE'],
280-
['brand', 'type', 'TAG', 'SORTABLE'],
281-
['type', 'type', 'TAG', 'SORTABLE'],
282-
['size', 'type', 'TAG', 'SORTABLE'],
283-
['price', 'type', 'NUMERIC', 'SORTABLE'],
284-
['color', 'type', 'TAG'],
362+
{
363+
identifier: '$.cuisine',
364+
attribute: 'cuisine',
365+
type: 'TAG',
366+
SEPARATOR: '',
367+
},
368+
{
369+
identifier: '$.name',
370+
attribute: 'restaunt_name',
371+
type: 'TEXT',
372+
WEIGHT: '1',
373+
},
374+
{
375+
identifier: '$.location',
376+
attribute: 'location',
377+
type: 'GEO',
378+
},
285379
],
286-
num_docs: '4,321',
287-
max_doc_id: '5000',
288-
num_terms: '9,876',
289-
num_records: '43,210',
290-
inverted_sz_mb: '8.54',
291-
vector_index_sz_mb: '0.00',
292-
total_inverted_index_blocks: '287',
293-
offset_vectors_sz_mb: '0.85',
294-
doc_table_size_mb: '3.76',
295-
sortable_values_size_mb: '1.89',
296-
key_table_size_mb: '0.42',
380+
documents_type: 'JSON',
297381
},
298382
}
299383

0 commit comments

Comments
 (0)