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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Removed multi_search aliases scheduled for removal in 6.0 (#14795)
Damian Legawiec3dcc8e9b66b8
diff --git a/.changeset/dashboard-search-param.md b/.changeset/dashboard-search-param.mdnew file mode 100644index 0000000000..1a582ed07f--- /dev/null+++ b/.changeset/dashboard-search-param.md@@ -0,0 +1,5 @@+---+"@spree/dashboard": patch+---++The orders and products tables now search with the `search` filter, since the old `multi_search` alias was removed from the Admin API.diff --git a/docs/api-reference/admin-api/querying.mdx b/docs/api-reference/admin-api/querying.mdxindex 55ffb323f3..dee135c3fe 100644--- a/docs/api-reference/admin-api/querying.mdx+++ b/docs/api-reference/admin-api/querying.mdx@@ -131,7 +131,7 @@ Some resources expose convenience search scopes:|---|---|---|| Customers | `search` | Full-text over email + first/last name || Customers | `with_min_total_spent` | Filter by lifetime spend |-| Orders | `multi_search` | Number + email full-text |+| Orders | `search` | Number, purchase order and customer name (partial match); email (exact match) |<CodeGroup>diff --git a/docs/developer/upgrades/5.6-to-6.0.mdx b/docs/developer/upgrades/5.6-to-6.0.mdxindex 32d58addb7..48d41dcd05 100644--- a/docs/developer/upgrades/5.6-to-6.0.mdx+++ b/docs/developer/upgrades/5.6-to-6.0.mdx@@ -494,6 +494,7 @@ These were deprecated in 5.x and are **gone now** — there is no bridge, so cal| `Spree::Image::Configuration::ActiveStorage` | deleted — an empty no-op module; all logic lives in `Spree::Asset` || `Spree::OrderRouting::Strategy::Legacy` | `Spree::OrderRouting::Strategy::Rules` (see below) || `private_metafields` association | read `custom_fields` and filter, or query `Spree::CustomField.admin_only` |+| `multi_search` (`Product`, `Variant`, `Order`, customers; also `q[multi_search]` in the Admin API) and `Searchable.sanitize_query_for_multi_search` / `.multi_search_condition` | `search` / `q[search]`, `sanitize_query_for_search` / `search_condition`. Saved exports or links still using `multi_search` lose their filter |### Custom fields replace metafieldsdiff --git a/docs/plans/6.0-admin-spa.md b/docs/plans/6.0-admin-spa.mdindex 9434c23036..1613874340 100644--- a/docs/plans/6.0-admin-spa.md+++ b/docs/plans/6.0-admin-spa.md@@ -236,7 +236,7 @@ import { formatRelativeTime } from '@/lib/formatters'defineTable('orders', {title: 'Orders',- searchParam: 'multi_search',+ searchParam: 'search',searchPlaceholder: 'Search orders...',defaultSort: { field: 'completed_at', direction: 'desc' },emptyMessage: 'No orders found',diff --git a/packages/dashboard/src/tables/orders.tsx b/packages/dashboard/src/tables/orders.tsxindex 8df9bcc0fe..13688d1a88 100644--- a/packages/dashboard/src/tables/orders.tsx+++ b/packages/dashboard/src/tables/orders.tsx@@ -22,7 +22,7 @@ defineTable('orders', {title: i18n.t('admin.nav.orders'),docsPath: 'orders/processing-orders',description: i18n.t('admin.table_descriptions.orders'),- searchParam: 'multi_search',+ searchParam: 'search',searchPlaceholder: i18n.t('admin.orders.table.search_placeholder'),defaultSort: { field: 'completed_at', direction: 'desc' },emptyIcon: <ShoppingCartIcon className="size-8 text-muted-foreground" />,diff --git a/packages/dashboard/src/tables/products.tsx b/packages/dashboard/src/tables/products.tsxindex 4233ab369e..71260ca5e9 100644--- a/packages/dashboard/src/tables/products.tsx+++ b/packages/dashboard/src/tables/products.tsx@@ -13,7 +13,7 @@ defineTable('products', {docsPath: 'products/creating-products',description: i18n.t('admin.table_descriptions.products'),title: i18n.t('admin.nav.products'),- searchParam: 'multi_search',+ searchParam: 'search',searchPlaceholder: i18n.t('admin.common.search_placeholder'),defaultSort: { field: 'updated_at', direction: 'desc' },emptyIcon: <PackageIcon className="size-8 text-muted-foreground" />,diff --git a/spree/core/app/models/concerns/spree/customer_methods.rb b/spree/core/app/models/concerns/spree/customer_methods.rbindex 7a41f0a4f7..1addd60536 100644--- a/spree/core/app/models/concerns/spree/customer_methods.rb+++ b/spree/core/app/models/concerns/spree/customer_methods.rb@@ -184,13 +184,10 @@ module Spreewhere(conditions.reduce(:or))end- # Backward compatibility alias — remove in Spree 6.0- def self.multi_search(query) = search(query)-self.whitelisted_ransackable_associations = %w[bill_address ship_address addresses tags spree_roles orders customer_groups]self.whitelisted_ransackable_attributes = %w[id email first_name last_name phone accepts_email_marketingcreated_at updated_at last_sign_in_at]- self.whitelisted_ransackable_scopes = %w[search multi_search with_min_total_spent with_standing_for_company+ self.whitelisted_ransackable_scopes = %w[search with_min_total_spent with_standing_for_companyanonymized]# Two-state scope: see Spree::Base.ransack_flag? for why the cast isdiff --git a/spree/core/app/models/concerns/spree/searchable.rb b/spree/core/app/models/concerns/spree/searchable.rbindex d34c0d7781..53e10f91c0 100644--- a/spree/core/app/models/concerns/spree/searchable.rb+++ b/spree/core/app/models/concerns/spree/searchable.rb@@ -25,10 +25,6 @@ module Spreemodel_class.arel_table[attribute.to_sym].lower.matches("%#{escaped}%", '\\')endend-- # Backward compatibility aliases — remove in Spree 6.0- def self.sanitize_query_for_multi_search(query) = sanitize_query_for_search(query)- def self.multi_search_condition(model_class, attribute, query) = search_condition(model_class, attribute, query)endendenddiff --git a/spree/core/app/models/spree/order.rb b/spree/core/app/models/spree/order.rbindex d11cd787f5..6f91e6c45a 100644--- a/spree/core/app/models/spree/order.rb+++ b/spree/core/app/models/spree/order.rb@@ -150,7 +150,7 @@ module Spreetotal item_total total_quantity considered_risky channel_id currency coupon_code customer_id seller_idorder_group_id po_number]- self.whitelisted_ransackable_scopes = %w[complete incomplete refunded partially_refunded search multi_search]+ self.whitelisted_ransackable_scopes = %w[complete incomplete refunded partially_refunded search]# A seller never sees the buyer's email, and a company member filtering the# company's orders must not learn a colleague's; the risk flag and coupon# are back-office data. `search` matches on the email too.@@ -159,8 +159,8 @@ module Spreeseller: %w[email considered_risky coupon_code]}self.private_ransackable_scopes = {- store: %w[search multi_search],- seller: %w[search multi_search]+ store: %w[search],+ seller: %w[search]}# Set to false on admin-initiated flows to suppress customer-facing emails.@@ -353,9 +353,6 @@ module Spreeleft_joins(:bill_address).where(arel_table[:email].lower.eq(query.downcase)).or(where(conditions.reduce(:or)))end- # Backward compatibility alias — remove in Spree 6.0- def self.multi_search(query) = search(query)-# Find an order by prefixed ID first, falling back to number, then integer id for backwards compatibility# @param param [String] the prefixed ID, number, or integer id to search for# @return [Spree::Order, nil] the found order or nildiff --git a/spree/core/app/models/spree/product.rb b/spree/core/app/models/spree/product.rbindex dd2a1a6f9a..938c8fe3d7 100644--- a/spree/core/app/models/spree/product.rb+++ b/spree/core/app/models/spree/product.rb@@ -302,9 +302,6 @@ module Spreewhere(id: (product_ids + custom_field_ids).uniq.compact)}- # Backward compatibility alias — remove in Spree 6.0- scope :multi_search, ->(*args) { search(*args) }-scope :archivable, -> { where(status: %w[active draft]) }scope :by_source, ->(source) { send(source) }scope :published, -> { where(status: 'active') }@@ -375,7 +372,7 @@ module Spreeself.storefront_ransackable_associations = %w[tags categories collections]self.whitelisted_ransackable_scopes = %w[not_discontinued search_by_name in_taxon in_category in_categories in_collection price_betweenprice_lte price_gte- search multi_search in_stock out_of_stock with_option_value_ids+ search in_stock out_of_stock with_option_value_idsascend_by_price descend_by_price]diff --git a/spree/core/app/models/spree/variant.rb b/spree/core/app/models/spree/variant.rbindex 07db524c82..bb127f7d47 100644--- a/spree/core/app/models/spree/variant.rb+++ b/spree/core/app/models/spree/variant.rb@@ -289,9 +289,6 @@ module Spreerelation.where(conditions.reduce(:or)).distinctend- # Backward compatibility alias — remove in Spree 6.0- scope :multi_search, ->(*args) { search(*args) }-# FIXME: cost price should be represented with DisplayMoney classLOCALIZED_NUMBERS = %w(cost_price weight depth width height)diff --git a/spree/core/spec/models/concerns/spree/ransackable_attributes_spec.rb b/spree/core/spec/models/concerns/spree/ransackable_attributes_spec.rbindex d6d0e72adf..6d3c64571d 100644--- a/spree/core/spec/models/concerns/spree/ransackable_attributes_spec.rb+++ b/spree/core/spec/models/concerns/spree/ransackable_attributes_spec.rb@@ -31,7 +31,7 @@ RSpec.describe Spree::RansackableAttributes doit "drops the buyer's email and the searches that match on it" doexpect(Spree::Order.ransackable_attributes(:seller)).not_to include('email')- expect(Spree::Order.ransackable_scopes(:seller)).not_to include('search', 'multi_search')+ expect(Spree::Order.ransackable_scopes(:seller)).not_to include('search')endendenddiff --git a/spree/core/spec/models/spree/export_spec.rb b/spree/core/spec/models/spree/export_spec.rbindex fa622000d5..3eb99c6a26 100644--- a/spree/core/spec/models/spree/export_spec.rb+++ b/spree/core/spec/models/spree/export_spec.rb@@ -307,7 +307,7 @@ RSpec.describe Spree::Export, :job, type: :model doit 'exports a searched product list' docreate(:product, name: 'Findable Widget')product_export = Spree::Exports::Products.create!(- store: store, user: user, format: 'csv', search_params: { multi_search: 'Findable' }.to_json+ store: store, user: user, format: 'csv', search_params: { search: 'Findable' }.to_json)expect { product_export.generate }.to change(product_export.attachment, :attached?).from(false).to(true)