Sha256: 20abbf9dfe83a2430134d4642478b9985a2a1ea32bb8b5c6a74905cb0129ab6c

Contents?: true

Size: 886 Bytes

Versions: 20

Compression:

Stored size: 886 Bytes

Contents

module Europeana
  module Blacklight
    class SearchBuilder
      ##
      # Search builder methods for more like this queries
      module MoreLikeThis
        extend ActiveSupport::Concern

        included do
          default_processor_chain.unshift :add_mlt_to_api
        end
        
        def add_mlt_to_api(api_parameters)
          return unless blacklight_params[:mlt]
          repository = blacklight_config.repository_class.new(blacklight_config)
          if blacklight_params[:mlt].respond_to?(:more_like_this_query)
            doc = blacklight_params[:mlt]
          else
            doc_response = repository.find(blacklight_params[:mlt])
            doc = doc_response.documents.first
          end
          query = doc.more_like_this_query(blacklight_params[:mltf])
          append_to_query_param(api_parameters, query)
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
europeana-blacklight-1.2.2 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-1.2.1 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-1.2.0 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-1.1.0 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-1.0.0 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.5.2 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.5.1 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.5.0 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.9 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.8 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.7 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.6 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.5 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.4 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.3 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.2 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.1 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.4.0 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.3.3 lib/europeana/blacklight/search_builder/more_like_this.rb
europeana-blacklight-0.3.2 lib/europeana/blacklight/search_builder/more_like_this.rb