Sha256: 122645470ec8728a6bb6cbe51abed15960db07d30f7a7b85dcd1e3ffce86df8f

Contents?: true

Size: 544 Bytes

Versions: 9

Compression:

Stored size: 544 Bytes

Contents

module Trestle
  module Search
    module SunspotAdapter
      def merge_scopes(scope, other)
        other
      end

      def count(search)
        search.execute.hits.total_count
      end

      def sort(search, field, order)
        search.build do
          order_by(field, order)
        end
      end

      def paginate(search, params)
        search.build do
          paginate(page: params[:page], per_page: 25)
        end
      end

      def finalize_collection(search)
        search.execute.results
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
trestle-search-0.5.1 lib/trestle/search/adapters/sunspot_adapter.rb
trestle-search-0.5.0 lib/trestle/search/adapters/sunspot_adapter.rb
trestle-search-0.5.0.pre lib/trestle/search/adapters/sunspot_adapter.rb
trestle-search-0.4.3 lib/trestle/search/adapters/sunspot_adapter.rb
trestle-search-0.4.2 lib/trestle/search/adapters/sunspot_adapter.rb
trestle-search-0.4.1 lib/trestle/search/adapters/sunspot_adapter.rb
trestle-search-0.4.0 lib/trestle/search/adapters/sunspot_adapter.rb
trestle-search-0.3.0 lib/trestle/search/adapters/sunspot_adapter.rb
trestle-search-0.2.1 lib/trestle/search/adapters/sunspot_adapter.rb