in reply to Re: Inefficient search algorithm?
in thread Inefficient search algorithm?

Yes, there is. The SQL gets a little squirrely and it takes longer to execute, but it shouldn't be too bad. You're also going to have to specify your columns for this. Something along the lines of:
SELECT foo_count.num ,foo.first_col ,foo.second_col FROM foo ,(SELECT description ,COUNT(*) as num FROM foo WHERE description LIKE '%?%' GROUP BY description ) foo_count WHERE foo.description = foo_count.description ORDER BY 1,2,3 LIMIT ?, ?

This is untested, but should work. Essentially, you're using the results of a search as a table for your second search. It's advanced SQL, but not absolutely nuts.

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.