close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DA Search not finding exact phrases

Thread began 7/21/2011 1:24 pm by ccooper309155 | Last modified 7/21/2011 2:22 pm by ccooper309155 | 721 views | 4 replies |

ccooper309155

DA Search not finding exact phrases

I've recently implemented DA search on a site and it works except for exact phrases.

For instance, if I search using "Light Jungle", the results return an empty recordset even though that phrase is in the database.

If I search using Light Jungle I get every record that has Light or Jungle in it.

If I search using Light, Jungle I get every record that has Light and Jungle in it.

I have implemented DA Search many times before and not had this problem.

Using ASP VB and MS-SQL.


Here is the code from the results page:

<%
'WA Database Search (Copyright 2005, WebAssist.com)
'Recordset: rsRuleBook;
'Searchpage: ASL.asp;
'Form: frmSearch;
dim WADbSearch1_DefaultWhere
WADbSearch1_DefaultWhere = ""
if (cStr(Request.Form("WADbSearch1")) <> "") then
dim WADbSearch1_whereClause, WADbSearch1_dateSeparator, WADbSearch1_wildCard
WADbSearch1_wildCard = "%"
WADbSearch1_dateSeparator = "'"

if ("SQL SERVER" = "ACCESS") then
WADbSearch1_dateSeparator="#"
end if
if ("SQL SERVER" = "ORACLE") then
WADbSearch1_dateSeparator="TO_DATE('"
end if
if ("SQL SERVER" = "MYSQL") then
WADbSearch1_dateSeparator="MYSQL"""
end if

'keyword array declarations
Dim WADbSearch1_KeyArr0
WADbSearch1_KeyArr0 = Array("Chapter","RuleNum","RuleCopy")

'comparison list additions
WADbSearch1_whereClause=BuildKeyword(WADbSearch1_KeyArr0,"" & cStr(Request.Form("SearchBox")) & "","","Includes",",%20","%20","%22","%22",0,WADbSearch1_wildCard,WADbSearch1_dateSeparator,WADbSearch1_whereClause)


if (1 = 1) then
Session("WADbSearch1_ASLRB_Searched")=WADbSearch1_whereClause
end if
else
if (1 = 1) then
if (cStr(Session("WADbSearch1_ASLRB_Searched")) <> "") then
WADbSearch1_whereClause = cStr(Session("WADbSearch1_ASLRB_Searched"))
else
WADbSearch1_whereClause = WADbSearch1_DefaultWhere
end if
else
WADbSearch1_whereClause = WADbSearch1_DefaultWhere
end if
end if
%>


What is the problem?

Any help much appreciated!

Sign in to reply to this post

Ray BorduinWebAssist

The solution is probably to change the implied OR from the default which is a space. In the code it would be this line:
WADbSearch1_whereClause=BuildKeyword(WADbSearch1_K eyArr0,"" & cStr(Request.Form("SearchBox")) & "","","Includes",",%20","%20","%22","%22",0,WADbSe arch1_wildCard,WADbSearch1_dateSeparator,WADbSearc h1_whereClause)

to:
WADbSearch1_whereClause=BuildKeyword(WADbSearch1_K eyArr0,"" & cStr(Request.Form("SearchBox")) & "","","Includes",",%20","%20OR%20","%22","%22",0,WADbSe arch1_wildCard,WADbSearch1_dateSeparator,WADbSearc h1_whereClause)

Sign in to reply to this post

ccooper309155

Thanks, Ray but that did not work.

Your suggested code returned errors of: Microsoft VBScript compilation error '800a03ee'

when I searched either "Light Jungle" or Light OR Jungle.

Sign in to reply to this post

Ray BorduinWebAssist

The problem is that if you copied and pasted this forum is adding spaces into the code to make it wrap. Try this:

WADbSearch1_whereClause=BuildKeyword(WADbSearch1_KeyArr0,"" & cStr(Request.Form("SearchBox")) & "","","Includes",",%20","%20OR%20","%22","%22",0,WADbSearch1_wildCard,WADbSearch1_dateSeparator,WADbSearch1_whereClause)
Sign in to reply to this post

ccooper309155

You're probably right - I did copy and paste.

But your theory led me to the solution.

I am now using + for AND and , for OR

Thus Light+Jungle is now returning all the records which contain both Light and Jungle

Light,Jungle is returning all the records which contain either Light or Jungle

And "Light Jungle" is returning all the records that contain that exact phrase.

Thanks for your prompt help!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...