Search code examples
herokusphinxthinking-sphinx

Support of HAVING for Sphinx running in Heroku


I have the following query:

  search(params[:query],
    with: { tag_id: params[:filter].values.flatten },
    group_by: :technology_id,
    having: "COUNT(*)=#{params[:filter].size}"
  )

This is working locally, but when I deploy to heroku it throws:

ActionView::Template::Error (sphinxql: syntax error, unexpected IDENT, expecting $end 
near 'HAVING COUNT(*)=1 LIMIT 0, 20; SHOW META' - SELECT *, groupby() AS 
sphinx_internal_group, id AS sphinx_document_id, count(DISTINCT sphinx_document_id) AS 
sphinx_internal_count FROM `technology_core` WHERE MATCH('cancer') AND `tag_id` IN (1) AND 
`sphinx_deleted` = 0 GROUP BY `technology_id` HAVING COUNT(*)=1 LIMIT 0, 20; SHOW META):

The sphinx version is specified as follows:

# config/thinking_sphinx.yml
test:
  mysql41: 9307
production:
  version: '2.2.6'

Anyone knows what else could be?


Solution

  • At this point in time, the latest Sphinx version available on Flying Sphinx servers is 2.2.3 - can you change the version in your thinking_sphinx.yml, deploy and run rebuild/regenerate, and see if HAVING works?