Sha256: bef985fab4a05d4b7c4d83a95ad94a5e6614c091d1606b0f9967535ca88493dd

Contents?: true

Size: 794 Bytes

Versions: 16

Compression:

Stored size: 794 Bytes

Contents

module Scrivito
class ObjSearchEnumerator
  class QueryExecutor
    def initialize(workspace)
      @workspace = workspace
    end

    def call(query, continuation=nil, fetched_ids=[])
      query['continuation'] = continuation if continuation
      response = Scrivito::CmsBackend.search_objs(workspace, query)

      Scrivito::ObjSearchEnumerator::Batch.new(
        build_objs(response),
        response['total'].to_i,
        response['continuation'],
        response['facets'],
        fetched_ids
      )
    end

    private

    attr_reader :workspace

    def build_objs(response)
      obj_ids = response['results'].map { |result| result['id'] }
      if obj_ids.present?
        workspace.objs.find_including_deleted(obj_ids)
      else
        []
      end
    end
  end
end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
scrivito_sdk-1.18.0 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.18.0.rc1 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.17.0 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.17.0.rc3 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.17.0.rc2 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.17.0.rc1 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.16.0 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.16.0.rc2 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.16.0.rc1 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.15.0 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.15.0.rc2 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.15.0.rc1 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.14.0 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.14.0.rc3 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.14.0.rc2 app/cms/scrivito/obj_search_enumerator/query_executor.rb
scrivito_sdk-1.14.0.rc1 app/cms/scrivito/obj_search_enumerator/query_executor.rb