I'm using the thinking-sphinx gem (3.1.0), to implement a search function. I'd like to use a text attribute of my model to order the results, eg: rows with the property attribute set to 'smiley' first. This is the syntax I'm using:
Model.search(query,
select: "*, (SELECT COUNT(*) FROM models WHERE models.property = 'smiley') AS prop",
order: "prop desc, created_at desc")
It all looks nice to me, yet the machine is always right, and it gives this error message:
sphinxql: syntax error, unexpected SELECT, expecting IDENT (or 11 other tokens) near 'SELECT COUNT(*) FROM etc.
Where is my syntax wrong?