avo
avo copied to clipboard
[RFC] Remove the `includes` statement from the search query
Context
Some don't need the whole includes statement in the search and that can bring overhead to that particular query.
Proposal
Removing the includes statement from the search[:query] API.
Users will still be able to add their own includes statement in the searc[:query] section.
@adrianthedev At first sight it seems that self.includes aren't being included in the search query.
Oh, OK I had a pairing session with @pjmuller and found some eager loading in the logs and thought it was that. Ok. Thanks for checking. I'll close it for now.
@adrianthedev & @Paul-Bob: just to clarify, I'm not using the self.includes but the index_query where I'm applying query.includes(). Is that one being used in search?
If not I'll further dig deeper in my codebase why I do see this in my project and create a reproduceable code snippet
Yes @pjmuller the index_query is used on search as the base query and it makes sense.
You are in control of index_query and you can do an early return for the search controller:
self.index_query = -> do
return query if controller_name == "search"
query.order(last_name: :asc)
end
I'm reopening this issue until you confirm that this works for you.
This issue has been marked as stale because there was no activity for the past 15 days.
@pjmuller any updates on this one?
This issue has been marked as stale because there was no activity for the past 15 days.
Closing this because there was no activity for the past 15 days. Feel free to reopen if new information pops up ✌️
Apologies for not getting back, I decided to do the searching in a different way so this ticket is not relevant anymore