And so I am rewriting my entire website with all of these concepts in mind.
One thing I’m working on right now requires a search with OR functionality. Constraints on a search are AND so therefore I need to use a filter with an advanced search (which allows for the OR functionality). However, after reading the above book, advanced searches are basically last ditch resorts as they are performed complete client side (especially in my case because I have to do this advanced search on the ENTIRE user dataset which will be super taxing on the user’s device).
So, I have been googling and it seems like the way to do OR searches is to use “merged with” but in the book it says “merged with” is done client-side.
HOWEVER, I’m thinking that this is still better than the advanced search filter because I get to add the constraints to each of the searches, which I’m assuming (?) is done server on both searches.
Here are my two searches that get merged together:
given that I have a merged with, do both searches still happen server side and the merging is done client side?
or is the first search done server side and then everything after the merge with is done client side?
My main goal is user perceived performance (as discussed in the book)
If both searches are done server side, then I should be able to do this search in a hidden group that runs unbeknownst to the user and then I call upon that group’s value when I’m ready for it
If the second search is done client side, that’s not going to be that much better than just running the filter with the advanced search. So is there a better option?
I know the question is long but it’s a difficult one to explain.
Thanks,
Paul
My suspicion is that the underlying searches in merged with will execute server side. However, think of it this way… We know an advanced filter will definitely happen 100% client side. However, some portion of a “merged with” search may happen server side, so it should only be better.
Since this search looks simple to construct, try duplicating the page and running the search both ways. You can compare the speed and also check Google dev tools to see what’s being downloaded to the page.
If the search is hidden, it will only run if the results are called by something on the page. So you’d have to somehow ask for the value upon load, which may slow down the page load time. It’s better to try to fix the root issue if possible.
One final observation is whether there’s a way to rethink your database construction or privacy rules to avoid this situation in the first place. From the screenshots it looks like, for example, admins are supposed to see everything. This should be set up as a privacy rule rather than a search constraint, since search constraints aren’t secure. Likewise if a user is only supposed to see their own stuff.
I did set up both and indeed, the merged with is faster than the advanced search.
Also, very good point about the privacy rules and you’re 100% correct that that’s the approach that should be taken here. I was thinking that I would apply the privacy rules once I had gone through and cleaned up my app but this example makes me realize that that approach is incorrect and I need to be doing both in tandem.