Sha256: 78edf7a5207c3cb800502f406b92ee4c0aefbf22c99d899a86a179a123fc42b7
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
Indexers.define :product do mappings do properties :name, :category, :shop_id, :price, :currency, :product_suggestions _parent type: 'shop' end serialize 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 traits :filter 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 trait :filter do filter do bool do must do if shop term do _parent shop.id end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
indexers-4.1.0.1 | test/dummy/app/indexers/product_indexer.rb |
indexers-4.1.0.0 | test/dummy/app/indexers/product_indexer.rb |