Sha256: daff2f811d60843960c48da2a9c7016d799a3d001de3b72de7596aa5e6bc67a0

Contents?: true

Size: 433 Bytes

Versions: 3

Compression:

Stored size: 433 Bytes

Contents

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

  mappings do
    properties :name
  end

  serialization do |record|
    name 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

3 entries across 3 versions & 1 rubygems

Version Path
indexes-4.0.0.2 test/dummy/app/indexes/shops_index.rb
indexes-4.0.0.1 test/dummy/app/indexes/shops_index.rb
indexes-4.0.0.0 test/dummy/app/indexes/shops_index.rb