Search words and sessions

Hi All,

I am implementing a search for my blog. I have it as you can type in tags and words, and I keep them as session variables. I was just thinking if this was a good idea ?

I saw on learning ruby on rails, that Ryan put such a search in a model and kept it in a database.

My site is hardly anything like twitter. So I would really like to hear what you have to say about this.


This may depend on what you want to do with those keywords:

1) Nothing:
When why keep them at all? Run the search and forget them
Or redisplay in the searchbox for next search, for that you can
still get them from the params at this stage.

2) Keep the actual search for redisplay next time the user comes back
You could keep them in the session, but would lose them if the user
logs out.

3) Run statistics what users are searching
Then you must keep them in the database

So I think there is not that much use in keeping them in the session.
Keeping them in the database makes sense if you store every single

My idea is that as soon as the user leaves the website it should go away. No need to keep the query around.

This just ends up in an array and will be run with :conditions on the query.