Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Improve product full text search (#11646)

Damian Legawiec6d3ffefd6282
diff --git a/core/app/models/concerns/spree/product_scopes.rb b/core/app/models/concerns/spree/product_scopes.rb
index 0fc4ad70c2..5634d761df 100644
--- a/core/app/models/concerns/spree/product_scopes.rb
+++ b/core/app/models/concerns/spree/product_scopes.rb
@@ -297,9 +297,9 @@ module Spree
include PgSearch::Model
if defined?(SpreeGlobalize)
- pg_search_scope :search_by_name, associated_against: { translations: :name }, using: :tsearch
+ pg_search_scope :search_by_name, associated_against: { translations: :name }, using: { tsearch: { any_word: true, prefix: true } }
else
- pg_search_scope :search_by_name, against: :name, using: :tsearch
+ pg_search_scope :search_by_name, against: :name, using: { tsearch: { any_word: true, prefix: true } }
end
else
def self.search_by_name(query)