forked from jbellis/colbert-astra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.cql
24 lines (19 loc) · 967 Bytes
/
schema.cql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CREATE KEYSPACE IF NOT EXISTS wikidata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
USE wikidata;
CREATE TABLE IF NOT EXISTS articles (
wiki text,
language text,
title text,
chunk_no int,
bert_embedding_no int,
id int,
revision int,
body text,
all_minilm_l6_v2_embedding vector<float, 384>,
bert_embedding vector<float, 128>,
PRIMARY KEY ((wiki, language, title), chunk_no, bert_embedding_no)
) WITH COMMENT = 'chunk_no=-1 contans the full (unchunked) article body. bert_embedding_no=-1 contains the body chunk and the all_minilm_l6_v2_embeddings.';
CREATE CUSTOM INDEX IF NOT EXISTS all_minilm_l6_v2_ann ON articles(all_minilm_l6_v2_embedding) USING 'StorageAttachedIndex'
WITH OPTIONS = { 'similarity_function': 'COSINE' };
CREATE CUSTOM INDEX IF NOT EXISTS colbert_ann ON articles(bert_embedding) USING 'StorageAttachedIndex'
WITH OPTIONS = { 'similarity_function': 'DOT_PRODUCT' };