Sha256: 51c178a628dfdc3c6a2b153d1c1b45d005a659736fc9e9ffe1b24427e00ad548
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
Indexes.define :products do mappings do properties :name, :category, :shop_id, :price, :currency, :product_suggestions _parent type: 'shop' end serialization do |record| extract record, :name, :category, :shop_id, :price, :currency product_suggestions do input [record.name, transliterate(record.name)].uniq output record.name context do shop_id [record.shop_id.to_s, 'all'].compact end end end search do |*args| options = args.extract_options! shop = options[:shop] term = args.first query do filtered do filter do bool do must do if shop term do _parent shop.id end end end end end query do if term.present? multi_match do query term type 'phrase_prefix' fields %w(name category) end else match_all end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
indexes-4.0.0.2 | test/dummy/app/indexes/products_index.rb |
indexes-4.0.0.1 | test/dummy/app/indexes/products_index.rb |
indexes-4.0.0.0 | test/dummy/app/indexes/products_index.rb |