Searching multiple tables

Hey,
I have three tables/models - stories, pictures, videos. I want to
be able to search all of these at once to find entries within a date
range. Currently I am searching each one and pushing the results onto
an array which I paginate and display. This doesn’t work correctly
because it doesn’t sort correctly and seems like a poor solution.

Additionally it would be helpful to be able to sort a date range and
if that fails to find the 10 most recently added entries. This seems
like a simple find but I’m not sure exactly how to do it.

Thanks for any help.
JB

Hi Jables,

There are no magic solution for what you’re trying to do.

What you can do is search each model and use a 4th model as the search
result… using that search result model to paginate and display your
page.

This way you should be able to sort in different fashion as made the
query much more efficient.

One question I have for you is how do you trigger the search?

Regards,

Jean-Marc