pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 470 forks source link

Setting sql_mode for indexer #1154

Closed atomical closed 4 years ago

atomical commented 4 years ago

Is there a way to set additional options, like sql_mode, for the indexer? Something like init_command with mysql2?

atomical commented 4 years ago

We solved it by using _setproperty in the index definition.

  set_property :sql_query_pre => ["SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"]
pat commented 4 years ago

This is the solution I would have suggested as well :) Glad to see you got it figured out.