[eluser]jepotski[/eluser]
[quote author="mddd" date="1275399453"]There are different methods. You could put the search term(s) in the url, then you would get a url like
Code:
example.com/search/searchterms/2
where 2 is the page number for pagination. Another method is to do what the CI forum does: on the initial search, save the result set somewhere and make a reference to it. This would give you something like
Code:
example.com/search/6fceb89ff38bab0bcb18e7241eea0efa/2
Or you could do something in between: save the result set and link it to the search parameters. That way you keep a nice url, that people can bookmark, but still have the advantage of quick page switching because you have the results saved already. In that case, the system knows that there already was a search for "searchterms" and it can get the results back for quick access.
You should consider the circumstances too. How long do you want to keep the results cached. For instance, on a busy forum there can quickly be new messages containing the keywords. So you should not cache the information for too long. Or keep a result set for every user separately. That way user A can browse their results for some time, and user B who searches the same terms 10 minutes later still gets a new set of results. This takes more queries on the database but has the advantage of a fresh, up-to-date query for every new search a user does.[/quote]
Where should I save the searchterms, to the database or session? how do you get the characters:
Quote:6fceb89ff38bab0bcb18e7241eea0efa
is it encoded? Is it applicable if i have to search many fields? thanks