mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(backend): set search_path for vector type visibility in hybrid search
- Add SET LOCAL search_path TO platform, public; to queries using vector types - This ensures the vector type is found while keeping operators working - Fixes hybrid search on databases using platform schema Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -108,8 +108,10 @@ async def store_embedding(
|
||||
embedding_str = "[" + ",".join(str(x) for x in embedding) + "]"
|
||||
|
||||
# Upsert the embedding
|
||||
# Set search_path to include public for vector type visibility
|
||||
await client.execute_raw(
|
||||
"""
|
||||
SET LOCAL search_path TO platform, public;
|
||||
INSERT INTO platform."StoreListingEmbedding" (
|
||||
"id", "storeListingVersionId", "embedding",
|
||||
"searchableText", "contentHash", "createdAt", "updatedAt"
|
||||
|
||||
@@ -147,7 +147,9 @@ async def hybrid_search(
|
||||
# Build hybrid search query with weighted scoring
|
||||
# The semantic score is (1 - cosine_distance), normalized to [0,1]
|
||||
# The lexical score is ts_rank_cd, normalized by max value
|
||||
# Set search_path to include public for vector type visibility
|
||||
sql_query = f"""
|
||||
SET LOCAL search_path TO platform, public;
|
||||
WITH search_scores AS (
|
||||
SELECT
|
||||
sa.*,
|
||||
@@ -224,6 +226,7 @@ async def hybrid_search(
|
||||
|
||||
# Count query - must also filter by min_score
|
||||
count_query = f"""
|
||||
SET LOCAL search_path TO platform, public;
|
||||
WITH search_scores AS (
|
||||
SELECT
|
||||
sa.slug,
|
||||
|
||||
Reference in New Issue
Block a user