Sha256: 746d225a3364bd74be8b48d966e690731aff59b2a6230cba5ce90a977c8dc573

Contents?: true

Size: 561 Bytes

Versions: 126

Compression:

Stored size: 561 Bytes

Contents

module Ddr::Index
  class QueryParams

    attr_reader :query

    def initialize(query)
      @query = query
    end

    def params
      { q:    q_param,
        fq:   filter_queries,
        fl:   fields,
        sort: sort,
        rows: rows,
      }.select { |k, v| v.present? }
    end

    def q_param
      query.q.to_s
    end

    def filter_queries
      query.filter_clauses.map(&:to_s)
    end

    def fields
      query.fields.join(",")
    end

    def sort
      query.sort.join(",")
    end

    def rows
      query.rows
    end

  end
end

Version data entries

126 entries across 126 versions & 2 rubygems

Version Path
ddr-core-1.17.0 lib/ddr/index/query_params.rb
ddr-core-1.16.0 lib/ddr/index/query_params.rb
ddr-core-1.15.0 lib/ddr/index/query_params.rb
ddr-core-1.14.0 lib/ddr/index/query_params.rb
ddr-core-1.13.2 lib/ddr/index/query_params.rb
ddr-core-1.13.1 lib/ddr/index/query_params.rb
ddr-core-1.13.0 lib/ddr/index/query_params.rb
ddr-core-1.12.2 lib/ddr/index/query_params.rb
ddr-core-1.12.1 lib/ddr/index/query_params.rb
ddr-core-1.12.0 lib/ddr/index/query_params.rb
ddr-core-1.11.0 lib/ddr/index/query_params.rb
ddr-core-1.10.0 lib/ddr/index/query_params.rb
ddr-core-1.9.0 lib/ddr/index/query_params.rb
ddr-core-1.8.0 lib/ddr/index/query_params.rb
ddr-core-1.7.0 lib/ddr/index/query_params.rb
ddr-core-1.6.6 lib/ddr/index/query_params.rb
ddr-core-1.6.5 lib/ddr/index/query_params.rb
ddr-core-1.6.4 lib/ddr/index/query_params.rb
ddr-core-1.6.3 lib/ddr/index/query_params.rb
ddr-core-1.6.2 lib/ddr/index/query_params.rb