|
 |
asp_web_howto thread: asp/access2k multi word search query=no results???? help stuck
Message #1 by "frog" <frog@p...> on Wed, 23 May 2001 17:09:30
|
|
I'm working on a search engine that looks for knowledge base records in an
Access2000 database, based on a query passed to a results page from an asp
form. I use the wildcard statement but I have a problem, the search engine
doesn't search more than one keyword.
For example, I can search for a word in a database table
called "keywords" and/or "problem" using just one word, like "vision", I
get loads of results. But, if I search for "vision prox" or something
more specific using two or more keywords (that are also in the database) I
get no matches.
code snippet:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/cnKB.asp" -->
<%
Dim rs_search__varKeyword
rs_search__varKeyword = "%"
if (request.QueryString("keywords") <> "") then rs_search__varKeyword
= request.QueryString("keywords")
%>
<%
set rs_search = Server.CreateObject("ADODB.Recordset")
rs_search.ActiveConnection = MM_cnKB_STRING
rs_search.Source = "SELECT * FROM kb WHERE keywords like '%" + Replace
(rs_search__varKeyword, "'", "''") + "%' OR problem like '%" + Replace
(rs_search__varKeyword, "'", "''") + "%'"
What am I doing wrong?
Message #2 by MIKE BYNDAS <MBYNDA@h...> on Wed, 23 May 2001 16:03:44 -0400
|
|
You could split on the space and add another constraint into the where
clause.
ie: where keyword like '%vision%' and keyword like '%prox%'..........
-----Original Message-----
From: frog [mailto:frog@p...]
Sent: Wednesday, May 23, 2001 1:10 PM
To: ASP Web HowTo
Subject: [asp_web_howto] asp/access2k multi word search query=3Dno
results???? help stuck
I'm working on a search engine that looks for knowledge base records in
an
Access2000 database, based on a query passed to a results page from an
asp
form. I use the wildcard statement but I have a problem, the search
engine
doesn't search more than one keyword.
For example, I can search for a word in a database table
called "keywords" and/or "problem" using just one word, like "vision",
I
get loads of results. But, if I search for "vision prox" or something
more specific using two or more keywords (that are also in the
database) I
get no matches.
code snippet:
<%@LANGUAGE=3D"VBSCRIPT"%>
<!--#include file=3D"../Connections/cnKB.asp" -->
<%
Dim rs_search__varKeyword
rs_search__varKeyword =3D "%"
if (request.QueryString("keywords") <> "") then
rs_search__varKeyword
=3D request.QueryString("keywords")
%>
<%
set rs_search =3D Server.CreateObject("ADODB.Recordset")
rs_search.ActiveConnection =3D MM_cnKB_STRING
rs_search.Source =3D "SELECT * FROM kb WHERE keywords like '%" +
Replace
(rs_search__varKeyword, "'", "''") + "%' OR problem like '%" + Replace
(rs_search__varKeyword, "'", "''") + "%'"
What am I doing wrong?
|
|
 |