Page 1 of 1

search Text area boxes is it possible

Posted: Fri Apr 13, 2007 4:04 am
by mohson
Normally when I search for a record I simply search a field that contains a single value - like so:

Code: Select all

foreach($HTTP_POST_VARS as $varname => $value)
        $formVars[$varname]=$value;

 $query = 	"SELECT 
		 orgname, web_url,sector,org_id,person_id, 
		 notes 
		 
		 FROM organisations 
		 

		WHERE orgname LIKE '$formVars[orgname]%'";
But I am planning on using some large text areas to make genereal notes, I understand that the data will still be inserted into a normal field BUT

How difficult will it be to search for any text in this field, when I say 'any text' I mean any word,number,value which is stored in the fiield.

Maybe I am making this more complex than what it is. Please advise

Posted: Fri Apr 13, 2007 6:08 am
by JayBird

Posted: Fri Apr 13, 2007 7:09 am
by mohson
From looking at some of the articles, this seems to be refering to indexing and speeding up your searches.

What I am asking is , from your experience (or anyone elses) if they have a field which contains more than one item of data (perhaps quite a bit more) is it possible / have you searched for any of the items in that field

Example

Filed = Notes

values = Person x worked for us in 2007, he then went on to work for company x etc etc


Would it then be possible to run a query where you search for the value 'person x ' or 'company x' from this field.

The values 'person x' and 'company x' as well as others could be anything so the key search will be the word the user inputs in the search box.

Have you done this before, would it be sone similar to the search quesry I run in my original post?

Thanks

Posted: Fri Apr 13, 2007 7:57 am
by JayBird
...which is EXACTLY what FULLTEXT searching is.

Read the links again

Posted: Fri Apr 13, 2007 7:59 am
by JayBird
i.e. If you had a table with a list of names.

Create a FULLTEXT index on the name field

then your query would look like this

Code: Select all

SELECT * FROM `users` WHERE MATCH(`name`) AGAINST('yourSearchCriteria' IN BOOLEAN MODE)