From b41c5cc31cb39d012900cbbd2511f18ffca29cca Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Tue, 30 Jan 2024 15:50:26 -0300 Subject: [PATCH] FIX: Add table name to remove ambiguous column reference in SQL (#449) --- lib/embeddings/semantic_search.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/embeddings/semantic_search.rb b/lib/embeddings/semantic_search.rb index 0e6131df..2af2e7d1 100644 --- a/lib/embeddings/semantic_search.rb +++ b/lib/embeddings/semantic_search.rb @@ -75,7 +75,7 @@ module DiscourseAi .public_posts .where("topics.visible") .where(topic_id: candidate_topic_ids, post_number: 1) - .order("array_position(ARRAY#{candidate_topic_ids}, topic_id)") + .order("array_position(ARRAY#{candidate_topic_ids}, posts.topic_id)") query_filter_results = search.apply_filters(semantic_results)