Hello folks..
I run a site called bibleclicks.com which allows a powerful reference and study system through a bible search engine..
I'm able to enter Jesus & Christ.. and it will show me every single verse that contains "Jesus" AND "Christ"
Now tonight.. I wanted to create the ability to search (Jesus / Christ) & (Moses / God) or such similar things.. and guess what? didn't work.. the outputted code is correct.. I know because when I place the outputted string as the static WHERE statement.. all works pretty well..
Would someone mind helping me turn this code around into the proper code? (Searctext=the search text entered by the user...)
If this code is just so far off what needs to be written let me explain that all I'm trying to do is replace "{" with "(" and "}" with "
".. but the parentheses need to act as search term groupings in the actual sql...
<CFSET CompileSR="#Replace(Replace(CompileSR,"'%{","('%","ALL"
,"}%'","%')","ALL"
#">
<CFIF left(searctext,1) is "{">
<CFSET CompileSR="#Right(CompileSR,len(compileSR)-1)#">
<CFSET CompileSR="(#CompileSR#">
</CFIF>
<CFSET compileSR="%#ReReplaceNoCase(ReReplaceNoCase(ReReplaceNoCase(searctext,"Qnot","%' And NOT Textdata like '%","ALL"
,"Qor","%' OR Textdata like '%","ALL"
,"Qand","%' AND Textdata like '%","ALL"
#%">
<CFSET CompileSR="#Replace(CompileSR,"%%","%","ALL"
#">
<CFSET CompileSR="#Replace(CompileSR," %","%","ALL"
#">
<CFSET CompileSR="#Replace(CompileSR,"% ","%","ALL"
#">
And the query...
<CFLOCK scope="Session" timeout="30" type="Exclusive">
<CFQUERY name="caselist" datasource="thebible">
SELECT BookTitle, book, chapter, verse, textdata From #table#
WHERE 0=0
<CFIF searctext NEQ "">
AND (textData like '%#CompileSR#%')
</CFIF>
<CFIF bookTitle NEQ "">
AND (Book='#Replace(bookTitle,",","' OR Book='","ALL"
#')
</CFIF>
<CFIF chapter NEQ "">
AND Chapter='#chapter2#'
</CFIF>
<CFIF verse NEQ "">
AND verse='#verse2#'
</CFIF>
ORDER BY book ASC, chapter ASC, verse ASC
</CFQUERY>
</CFLOCK>
I run a site called bibleclicks.com which allows a powerful reference and study system through a bible search engine..
I'm able to enter Jesus & Christ.. and it will show me every single verse that contains "Jesus" AND "Christ"
Now tonight.. I wanted to create the ability to search (Jesus / Christ) & (Moses / God) or such similar things.. and guess what? didn't work.. the outputted code is correct.. I know because when I place the outputted string as the static WHERE statement.. all works pretty well..
Would someone mind helping me turn this code around into the proper code? (Searctext=the search text entered by the user...)
If this code is just so far off what needs to be written let me explain that all I'm trying to do is replace "{" with "(" and "}" with "

<CFSET CompileSR="#Replace(Replace(CompileSR,"'%{","('%","ALL"


<CFIF left(searctext,1) is "{">
<CFSET CompileSR="#Right(CompileSR,len(compileSR)-1)#">
<CFSET CompileSR="(#CompileSR#">
</CFIF>
<CFSET compileSR="%#ReReplaceNoCase(ReReplaceNoCase(ReReplaceNoCase(searctext,"Qnot","%' And NOT Textdata like '%","ALL"



<CFSET CompileSR="#Replace(CompileSR,"%%","%","ALL"

<CFSET CompileSR="#Replace(CompileSR," %","%","ALL"

<CFSET CompileSR="#Replace(CompileSR,"% ","%","ALL"

And the query...
<CFLOCK scope="Session" timeout="30" type="Exclusive">
<CFQUERY name="caselist" datasource="thebible">
SELECT BookTitle, book, chapter, verse, textdata From #table#
WHERE 0=0
<CFIF searctext NEQ "">
AND (textData like '%#CompileSR#%')
</CFIF>
<CFIF bookTitle NEQ "">
AND (Book='#Replace(bookTitle,",","' OR Book='","ALL"

</CFIF>
<CFIF chapter NEQ "">
AND Chapter='#chapter2#'
</CFIF>
<CFIF verse NEQ "">
AND verse='#verse2#'
</CFIF>
ORDER BY book ASC, chapter ASC, verse ASC
</CFQUERY>
</CFLOCK>