Sha256: 5a0adfe4a2333fa72ae93cdb58b607a6bae69523e227d8815c2d6c46c4263635

Contents?: true

Size: 1.74 KB

Versions: 53

Compression:

Stored size: 1.74 KB

Contents

module Sunspot
  module DSL #:nodoc:
    module Adjustable #:nodoc
      # <strong>Expert:</strong> Adjust or reset the parameters passed to Solr.
      # The adjustment will take place just before sending the params to solr,
      # after Sunspot builds the Solr params based on the methods called in the
      # DSL.
      #
      # Under normal circumstances, using this method should not be necessary;
      # if you find that it is, please consider submitting a feature request.
      # Using this method requires knowledge of Sunspot's internal Solr schema
      # and Solr query representations, which are not part of Sunspot's public
      # API; they could change at any time. <strong>This method is unsupported
      # and your mileage may vary.</strong>
      #
      # ==== Examples
      #
      #   Sunspot.search(Post) do
      #     adjust_solr_params do |params|
      #       params[:q] += ' AND something_s:more'
      #     end
      #   end
      #
      #   Sunspot.more_like_this(my_post) do
      #     adjust_solr_params do |params|
      #       params["mlt.match.include"] = true
      #     end
      #   end
      # 
      def adjust_solr_params( &block )
        @query.solr_parameter_adjustment = block
      end

      #
      # <strong>Expert:</strong> Use a custom request handler for this search.
      # The general use case for this would be a request handler configuration
      # you've defined in solrconfig that has different search components,
      # defaults, etc. Using this to point at an entirely different type of
      # request handler that Sunspot doesn't support probably won't get you very
      # far.
      #
      def request_handler(request_handler)
        @search.request_handler = request_handler
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 11 rubygems

Version Path
sunspot-2.2.5 lib/sunspot/dsl/adjustable.rb
sunspot-2.2.4 lib/sunspot/dsl/adjustable.rb
sunspot-2.2.3 lib/sunspot/dsl/adjustable.rb
sunspot-2.2.2 lib/sunspot/dsl/adjustable.rb
sunspot-2.2.1 lib/sunspot/dsl/adjustable.rb
sunspot-2.2.0 lib/sunspot/dsl/adjustable.rb
sunspot-2.1.1 lib/sunspot/dsl/adjustable.rb
sunspot-2.1.0 lib/sunspot/dsl/adjustable.rb
sunspot-2.0.0 lib/sunspot/dsl/adjustable.rb
sunspot-2.0.0.pre.130115 lib/sunspot/dsl/adjustable.rb
gojee-sunspot-2.0.5 lib/sunspot/dsl/adjustable.rb
sunspot-2.0.0.pre.120925 lib/sunspot/dsl/adjustable.rb
sunspot_solr-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/adjustable.rb
sunspot_rails-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/adjustable.rb
sunspot-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/adjustable.rb
gojee-sunspot-2.0.4 lib/sunspot/dsl/adjustable.rb
gojee-sunspot-2.0.2 lib/sunspot/dsl/adjustable.rb
sunspot-2.0.0.pre.120720 lib/sunspot/dsl/adjustable.rb
sunspot-1.3.3 lib/sunspot/dsl/adjustable.rb
sunspot-1.3.2 lib/sunspot/dsl/adjustable.rb