Sha256: 66a209ccb182da24d0fb7e5688d1919bdd6dbd6e0959c2d8c0325d58d219e299
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
Indexes.define :products do mappings do properties :name, :category, :shop_id, :price, :currency, :product_suggestions _parent type: 'shop' end serializer do |record| set 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
indexes-0.0.1 | test/dummy/app/indexes/products_index.rb |