Welcome Guest, Not a member yet? Register   Sign In
Approach to building a (site)search function, the actual query
#1

[eluser]packetfox[/eluser]
Hello there,

i have a data table consisting out of about 25 fields (age,height,weight,bmi,gender,...,). I am in need of developing a decent search function that allows me to run one or more query against that table(eg: 110+female). On the Web including this Forum i have seen many different approaches to building search functions; some neat and cool, some pretty strange or quite complicated.

The query part usually involves splitting up the search string into multiple pieces, and then iterating over each field in the table to retrieve data.

Can i make my life and at least the query part of the search function easier if: I make an extra field into my table that holds the concatenated values of all of my individual field data once more, and perform simple select queries against that? I know its not the most performance or elegant solution possibly, and it involves work updating that field when changes to the data is made. That aside, would there be any inherent flaws with doing it like that?

Code:
INSERT INTO data (age,height,gender,searchdata) VALUES ('20','180','male','20,180,male');

Or am i better of making use of the mysql fulltext search capabilities while creating my table, and build a massive index of all my attribute fields?

Code:
ALTER TABLE data ADD FULLTEXT(age,height,gender,...,...,);

I guess much of it depends of how much data is stored, and how many rows, and how many searches are performed by how many users. Lets say about ten thousand rows, maybe 3 searches a minute.

Many thanks for shared thoughts regarding building a good search function or coming up with good ways to search.




Theme © iAndrew 2016 - Forum software by © MyBB