You see, this has proven quite interesting for me... I'll explain myself:
What you want wouldn't be too expensive in terms of time waiting for results if we were talking just about generic searches in regions or cities (i.e "show me all ads in Boston"), just one additional query to count all results.
The real issue resides in searches with pattern (keywords). With a big database you search for a very common term like "job" and every related query including that pattern (three per page of results) takes a big while. Adding yet another query to count all the occurences in the database wouldn't be an option.
But, what if we could make
only that expensive additional search query, store its results (a lot of ads id's) for the rest of the normal queries use them with no need to repeat fulltext pattern searching
thrice for
every page produced by the search?
A lot to change in the core code, but I think at first glance the idea seems very attractive. If someone knowledgeable enough reads this and find some flaw, please let me know. I'm going to work on this because I happen to be working right now with a database such as like that and this issue of searches taking so long I would like to find a solution within Osclass itself.
Regards