Skip to content

Commit c8b79b9

Browse files
add demo
1 parent a4bad7e commit c8b79b9

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

crates/skardi/src/sources/providers/sqlx/pg/postgres.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,6 @@ async fn register_postgres_catalog(
247247
let catalog_provider = Arc::new(MemoryCatalogProvider::new());
248248

249249
for (schema, table_name) in &schema_tables {
250-
<<<<<<< HEAD
251-
let table_reference = TableReference::partial(schema.as_str(), table_name.as_str());
252-
let table_provider =
253-
build_postgres_table_provider(&read_pool, table_reference, read_write, &sqlx_pool)
254-
.await
255-
.with_context(|| {
256-
format!(
257-
"Failed to build table provider for '{}.{}' in catalog '{}'",
258-
schema, table_name, catalog_name
259-
)
260-
})?;
261-
=======
262250
let knn_key = format!("{}.{}.{}", catalog_name, schema, table_name);
263251
let table_provider = build_and_register_table(
264252
&read_pool,
@@ -276,7 +264,6 @@ async fn register_postgres_catalog(
276264
schema, table_name, catalog_name
277265
)
278266
})?;
279-
>>>>>>> b1fec0d (update postgres)
280267

281268
if catalog_provider.schema(schema).is_none() {
282269
catalog_provider
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
metadata:
2+
name: "vector-search-catalog"
3+
version: "1.0.0"
4+
description: >
5+
KNN similarity search against a pgvector column loaded as part of a catalog entry.
6+
In catalog mode the pg_knn registry key is "catalog.schema.table", so the first
7+
argument must use the fully-qualified three-part name.
8+
Pass a literal float array as {query_vector} — e.g. [0.6, 0.8, 0.0, 0.0].
9+
Score is cosine distance in [0, 2] — lower means more similar.
10+
11+
# Parameters:
12+
# {query_vector} - Float array to search against, e.g. [0.6, 0.8, 0.0, 0.0]
13+
# {limit} - Maximum number of results to return
14+
15+
query: |
16+
SELECT id, content, metadata, _score
17+
FROM pg_knn('mydb.public.documents', 'embedding',
18+
{query_vector},
19+
'<=>', 10)
20+
ORDER BY _score
21+
LIMIT {limit}

0 commit comments

Comments
 (0)