Topic: Questions on How to Implement a Search
I've been lurking these forums for a bit, now, but am still unsure of exactly where this post should go. If it's in the wrong spot, please let me know and I'll try and rectify the problem.
So here's my question, with a bit of background first.
To put it in the most simple terms, I have a Users table, that will have many joins with other tables which will create the properties of that user (ie. address information, skills information, etc).
What I would like to do is create a textbox where a user of the website can search for other users by typing in various properties. These properties, of course, would be located in all of the join tables.
So say a user types in "Dallas Ruby on Rails C++". I would like to be able to take those properties and make intelligent searches on the database, to return intelligent results.
I thought of two solutions that I could do... one is not elegant, and one doesn't really make my database elegant.
1) I would take every phrase typed into the search and search through all of the properties of all users. It would require going through each table to find out if the keyword was found in those tables, and if so, get the users from that search... This is just not simple enough for me, though, and I feel there's a better solution.
2) When a user types in all of their information, I could save the information in the database as normal (So that I could still display it to someone in an intelligable manner), but also take all of those properties and create tags for the user based on those properties. Then, I'd simply make the User have acts_as_taggable, and use the User.find_tagged_with('SEARCH TERMS') ... That would make searching a bit more intuitive and simple to code, but I now have data in two places in my database... Which makes me itch a bit, heh.
I'm leaning towards solution two, but I'm wondering if there's a better way to do this. Any help would be greatly appreciated! If more information is needed, I'll gladly provide.
Thanks in advance!
Last edited by SilentSeraph (2006-11-28 13:42:31)