Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
freezer9 #1
Boolean Searches
I am trying to implement a boolean type search . The current search that I have
searches for exact matches, if the input has multiple words. I want the search
to take the multiple words and ouput all those records that have all those
words, irrepective of the order in which they occur in each record. Here's the
code that I have - can anyone spot a mistake, because it is not working, and it
is too late and I am getting a headache ;-)
<cfif search_category is "DESCRIPTION">
<cfset temp_query = Replace(TRIM(UCASE(query))," ","+","ALL")> <!-- Replace
all spaces with + to creat a list-->
<cfif ListLen(temp_query,'+') gt 1> <!-- Check to see List has more than one
element -->
<cfloop index="i" from="1" to="#ListLen(temp_query,'+')#">
<cfset temp_query_i = ListGetAt(temp_query,i,'+')>
</cfloop>
</cfif>
</cfif>
<cfif search_category is "DESCRIPTION">
<cfif ListLen(temp_query,'+') gt 1>
<cfloop index="i" from="1" to="#ListLen(temp_query,'+')#">
upper(DESCRIPTION) like '%#TRIM(UCASE(temp_query_i))#%' <cfif i lt
ListLen(temp_query,'+')>AND</cfif>
</cfloop>
<cfelse>
upper(DESCRIPTION) like '%#TRIM(UCASE(query))#%'
</cfif>
</cfif>
freezer9 Guest
-
Using Boolean Operators in Searches
Problem: Other than searching for single words or using the "Exact Phrase Match," I can't get the searches of documents to return the proper results,... -
doing searches - need help really quickly
hello, a client im doing a webpage for wants me to add a search type thing on the site - the site is fully flash. what the search is for is for... -
Keyword Searches
Hi everyone, Does anyone know how to add a keyword search to a site? Daniel Park Executive Director La Paz International -
Full-text searches and ASP.NET
Hi. I have to implement a search mechanism for the site I am developing. The choosen option for the project was to use full-text searches in our... -
Help with speeding up searches
"Jeroen Braun" <jnjbraun@euronet.nl> wrote in message news:<3e72995a$0$57483$1b62eedf@news.euronet.nl>... The table was not built by me. I was... -
freezer9 #2
Re: Boolean Searches
Never mind - got a simple solution from [url]http://tutorial234.easycfm.com/[/url] Works
like a charm! <CFQUERY NAME='searchresults' DATASOURCE='yourdatasource'>
SELECT * FROM table WHERE 0=0 AND ( <cfloop index='i'
list='#form.searchkeyword#' delimiters=' '> <cfoutput>fieldname LIKE
'%#i#%' AND </cfoutput> </cfloop> '%%') </CFQUERY>
freezer9 Guest



Reply With Quote

