Sha256: 3cdafa71ce34b81a1a2a7b67740b40c6ec49ed609ad7a7b0de5b3a0f7e1729ec

Contents?: true

Size: 549 Bytes

Versions: 107

Compression:

Stored size: 549 Bytes

Contents

module Picky
  module API
    module Search

      module Boost

        def extract_boosts thing
          if thing.respond_to?(:boost_for)
            thing
          else
            if thing.respond_to?(:[])
              Query::Boosts.new thing
            else
              raise <<-ERROR
boost options for a Search should be either
* for example a Hash { [:name, :surname] => +3 }
or
* an object that responds to #boost_for(combinations) and returns a boost float
ERROR
            end
          end
        end

      end

    end
  end
end

Version data entries

107 entries across 107 versions & 1 rubygems

Version Path
picky-4.31.3 lib/picky/api/search/boost.rb
picky-4.31.2 lib/picky/api/search/boost.rb
picky-4.31.1 lib/picky/api/search/boost.rb
picky-4.31.0 lib/picky/api/search/boost.rb
picky-4.30.0 lib/picky/api/search/boost.rb
picky-4.29.0 lib/picky/api/search/boost.rb
picky-4.28.1 lib/picky/api/search/boost.rb
picky-4.27.1 lib/picky/api/search/boost.rb
picky-4.27.0 lib/picky/api/search/boost.rb
picky-4.26.2 lib/picky/api/search/boost.rb
picky-4.26.1 lib/picky/api/search/boost.rb
picky-4.26.0 lib/picky/api/search/boost.rb
picky-4.25.3 lib/picky/api/search/boost.rb
picky-4.25.2 lib/picky/api/search/boost.rb
picky-4.25.1 lib/picky/api/search/boost.rb
picky-4.25.0 lib/picky/api/search/boost.rb
picky-4.24.0 lib/picky/api/search/boost.rb
picky-4.23.2 lib/picky/api/search/boost.rb
picky-4.23.1 lib/picky/api/search/boost.rb
picky-4.23.0 lib/picky/api/search/boost.rb