One of the most tedious things about search is that you have to go back to the search result after viewing a matching page before you can go to the next matching page.
Wouldn’t it be nice if you could click previous and next directly on the page of all the matching pages and thus browse through all the results without having to go back to the result page? Well - read on for the answer to how this is possible and so difficult to achieve.
Searching for real estate?
The above mentioned problem is especially obvious when searching for properties on a real estate web site or any other web site where it is unlikely that anyone result will be the “correct” match. On these sites it is a great feature to make it possible to browse the matching results from a search directly from the resulting pages.
Saving the query and not the result list
The problem facing developers is to make the results available in the correct order on the actual resulting (matching) pages. Initially you might think that the best option is to save a list of all the results in a long array and then look that up on the individual resulting pages, and that could be a way to do but not if you use pagination on your results pages.
Let us say that you have found 2000 matches - hopefully you will not show all 2000 results on one long page, but instead break the pages up with say 10 results per page (like Google). Now if you have done your SQL correctly you will have made a lookup with LIMIT in it so that SQL only returns a certain amount of results. This leaves us with the problem that we can not make an array with ALL the results in it - because they are simply not available.
Instead we should save the SQL QUERY and pass that on to the matching pages when viewed.
Using the query and the position of the result that was clicked on you can create your previous/next buttons on the details pages. It works really well and saves lots of time for the browser.
Example and what about Google?
You can see our implementation on http://www.livingstone-estate.com simply perform a search and view one of the results and then enjoy the page flipping.
I wonder how long it will be before someone creates this as a Firefox extension for Google? It would be great to be able to scroll the result without having to go back to Google? Wouldn’t it?