Skip to content

Instantly share code, notes, and snippets.

@jumph4x
Created August 31, 2012 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jumph4x/3558901 to your computer and use it in GitHub Desktop.
Save jumph4x/3558901 to your computer and use it in GitHub Desktop.
Undoing hardcoded acts_as_solr_reloaded Dismax Request type
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
@jumph4x
Copy link
Author

jumph4x commented Sep 2, 2012

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.

@jumph4x
Copy link
Author

jumph4x commented Sep 4, 2012

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