Sha256: a51386639d7010d6e2679f32739ca88789b90fd931182056d3149e0a80a8d8f7
Contents?: true
Size: 1.1 KB
Versions: 6
Compression:
Stored size: 1.1 KB
Contents
module Gummi module Document module Search module Searching extend ActiveSupport::Concern included do include Virtus.model attribute :type, String attribute :index, String, default: lambda {|search, attr| Gummi::DefaultIndex.name} attribute :page, Gummi::Fields::PositiveInteger, default: 1 attribute :per_page, Gummi::Fields::PositiveInteger, default: 300 attribute :options, Hash, default: {} end def size per_page end def from per_page * (page - 1) end def execute Gummi::Document::Search::Result.new client.search(to_client_args) end def to_client_args args = {} args[:index] = index args[:type] = type if type args[:from] = from args[:size] = size args.merge options end private def client Gummi::API.client end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems