From c2b3f184df4a60a872eea77971cd83ea6d8297b0 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 26 Jun 2026 22:11:52 +0200 Subject: Enable full-text search via PostgreSQL tsvector on page_translations - Restore search vector migration (was parked in doc/ pending PostgreSQL upgrade) - Restore Node.search using plainto_tsquery with simple dictionary - Cross-locale keyword search, no stemming, works for both de and en content --- app/models/node.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app/models/node.rb') diff --git a/app/models/node.rb b/app/models/node.rb index 41c3867..a3ef23a 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -211,11 +211,13 @@ class Node < ApplicationRecord self.created_at < new_id_format_date ? unique_path : id end - # TODO: restore full-text search once PostgreSQL is upgraded. - # The tsvector/plpgsql approach requires PostgreSQL 10+ with plpgsql available. - # For now, search is disabled to unblock the Rails 7.2 upgrade. + # Full-text search across all locale translations using PostgreSQL tsvector. + # Uses 'simple' dictionary (no stemming, no stopwords) so queries work + # across German and English content without language detection. def self.search(term, _ = {}) - none + joins(head: :translations) + .where("page_translations.search_vector @@ plainto_tsquery('simple', ?)", term) + .distinct end protected -- cgit v1.3