Great. Thank you. And since I have your ear and I can not figure out how to start my own question, I am making an internal search of my database from inputted keyword(s). I am trying to use LIKE in a query that checks each field of each table:
<cfquery name="checkindexes"
datasource="myDb"
dbtype="ODBC">select * from <cfoutput>#getindexes.table#</cfoutput> where <cfoutput>#getindexes.field#</cfoutput> Like '%'+keyword+'%'</cfquery>
<cfoutput>
If my field contains only say two words and the keyword entered is one of them I get a result. However, if the word is in a larger field, it is not found. I have tried words such as "the" which were present many times.
Would appreciate any advice. Well, preferably some that pertains to the question.
<cfquery name="checkindexes"
datasource="myDb"
dbtype="ODBC">
select * from #getindexes.table#
WHERE #getindexes.field# Like '#keyword#'
</cfquery>
Should work!
You may have some problem with the variable table names...
Thanks and if this helpls, please click the "Click here to mark this post as a helpful or expert post!" after your through on my reply...
Just a warning... searching a database like this can really kill performance. Where you're searching for text inside the contents of database columns, especially where you're using the LIKE operator, you're likely to see significant performance improvements by searching a Verity collection of a query against the database.
Oh, boy. SOmething else I do not know about. I assume a verity collection is static information which contains all the database info in some organized fashion?
I have always relied upon the kindness of strangers.
Exactly. You execute a regular query against the database that returns all the data you might want to search, and then index that data using the Verity Search Engine. Verity organizes and optimizes the data for searching. Then, when you want to search, instead of querying the database, you search the Verity index. Depending on how much data you're querying, you may need to then go back to the database to query it for all the data -- but this time, your Verity search has armed you with the primary keys for the rows you want, so this database query is much faster and less resource-intensive on the database server.
For more information, look in your documentation at the tags <cfindex> and <cfsearch>, specifically as they pertain to indexing a query.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.