Sha256: 5dd7c9d8f9482a892cb30d02e2650f76f59c1c7901ecce50ae34c50da1c887eb

Contents?: true

Size: 431 Bytes

Versions: 1

Compression:

Stored size: 431 Bytes

Contents

Indexes.define :other, class_name: 'Shop' do

  mappings do
    properties :name
  end

  serializer do |record|
    set record, :name
  end

  search do |*args|
    options = args.extract_options!
    term = args.first
    query do
      if term.present?
        match do
          name do
            query term
            type 'phrase_prefix'
          end
        end
      else
        match_all
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
indexes-0.0.1 test/dummy/app/indexes/shops_index.rb