CodeIgniter Forums
Making a search page. POST, GET, TOKEN? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Making a search page. POST, GET, TOKEN? (/showthread.php?tid=23228)



Making a search page. POST, GET, TOKEN? - El Forum - 10-04-2009

[eluser]RS71[/eluser]
Hello,

I'm trying to make a search page and I was wondering what would be the best approach for this. At the moment, I save search filters to a session and use them when doing queries. The thing is, although I haven't given it much thought, I'd probably like for users to be able to send and bookmark links. What do you guys think I do? GET would probably work but I might end up with a very long url like:

Quote:http://localhost/search/gallery/1/?price_min=50000&price=max=10000000&location=citytown&color=red&shape=square&size_min=750&size_max=890&types=12-45-76-82-48&order=2&types2=85-84-87-23

and so forth..

I came across this page,

http://stackoverflow.com/questions/297470/use-get-or-post-for-a-search-form/298089#298089

which talks about using Tokens. A system similar to TinyURL's where fields/parameters are saved and retrieved from the DB using a token before making the actual 'search' query.

What do you guys think? Would it slow down my search pages too much, having to

- SELECT fields using token
- SELECT results
- SELECT count for pagination

if changing filters:

- INSERT fields using token
- SELECT results
- SELECT count for pagination

Please let me know what you think.
Thanks in advance,
RS71


Making a search page. POST, GET, TOKEN? - El Forum - 10-05-2009

[eluser]Damien K.[/eluser]
Myself, being the so non-performance concerned guy, don't see how this can slow your site to a crawl (i.e., affect performance). I see why TinyURL would do that because it is their service model to provide, err, tiny urls. But for search parameters, I see that as an unnecessary overhead unless you have a similar service model. One question to ask yourself is whether you plan to persist the seach parameters indefinitely. If yes, then the approach is rather obvious. If not, I would stick with some sort of GET method. Another question is how necessary is to have "pretty" urls?