Created
August 31, 2012 20:58
-
-
Save jumph4x/3558901 to your computer and use it in GitHub Desktop.
Undoing hardcoded acts_as_solr_reloaded Dismax Request type
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
Solr::Request::Dismax.class_eval do | |
def to_hash | |
hash = super | |
#hash[:defType] = 'edismax' # Kill this little hardcoded gem in acts_as_solr_reloaded | |
hash[:tie] = @params[:tie_breaker] | |
hash[:mm] = @params[:minimum_match] | |
hash[:qf] = @params[:query_fields] | |
hash[:pf] = @params[:phrase_fields] | |
hash[:ps] = @params[:phrase_slop] | |
hash[:bq] = @params[:boost_query] | |
hash[:boost] = @params[:boost_functions] | |
hash["q.alt"] = @params[:alternate_query] | |
return hash | |
end | |
end |
The correct approach in acts_as_solr_reloaded is to use filter_queries that were previously your standard query and pass user input directly as the main query.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not entirely correct, as we still are using Dismax instead of Standard, but this dirty hack might help your existing project get up and running quicker.