Hi Simone,

I'm sorry for the slow response.

It sounds like you may have already found the `:sql` option for search calls to 
pass through a limited set of SQL-based options as part of populating the 
search results:
https://freelancing-gods.com/thinking-sphinx/v5/searching.html#advanced

Granted, that's quite old, and the syntax was inspired by ActiveRecord's pre v3 
approach. 😓 But there isn't anything else of this manner in Thinking Sphinx.

I realise it may not be ideal, but I would recommend instead querying Sphinx 
for the instance ids (using Article.search_for_ids instead of Article.search), 
and then - as/when needed - perform the SQL query using those ids. This avoids 
the initial SQL query to populate the search results as ActiveRecord objects. 
Would this be feasible in your situation?

Kind regards,

--
Pat
On 7 Nov 2022 at 9:51 PM +1100, Simone Miller <[email protected]>, wrote:
> Hi Pat
>
> Hope you're keeping well.
>
> We're using a thinking sphinx search and we'd like to chain additional sql 
> generating active record queries on to the search. Ideally, we wouldn't want 
> to run the query or load the models immediately, so that we can maintain a 
> consistent code flow to instances where a search is not applied.
>
> We've seen we can define sphinx scopes and provide options within the search 
> itself - e.g. sql, select, with etc. Would there be a way to do this from the 
> outside - e.g. Article.search('pancakes').any_further_queries (that weren't 
> sphinx scopes)?
>
> Many thanks
> Simone
> --
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/thinking-sphinx/d2a693ca-6169-444c-a7bf-5ca23c7f590cn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/thinking-sphinx/f2d4ed46-4914-416c-84e4-34a9f940023a%40Spark.

Reply via email to