Created
March 13, 2010 14:09
-
-
Save outoftime/331335 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), 'spec_helper') | |
describe 'function query' do | |
it "should send query to solr with function query from a block" do | |
session.search Post do | |
keywords('pizza') do | |
boost(function { :ratings_average }) | |
end | |
end | |
connection.should have_last_search_including(:bq => 'average_rating_f^2.0') | |
end | |
it "should handle arbitrary functions in a function query block" do | |
session.search Post do | |
keywords('pizza') do | |
boost(function { product(:ratings_average, 10) }) | |
end | |
end | |
connection.should have_last_search_including(:bq => 'product(average_rating_f,10)') | |
end | |
it "should handle nested functions in a function query block" do | |
session.search Post do | |
keywords('pizza') do | |
boost(function { product(:ratings_average, sum(:ratings_average, 20)) }) | |
end | |
end | |
connection.should have_last_search_including(:bq => 'product(average_rating_f,sum(average_rating_f,10))') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment