I wonder if this can be done in asp search function.
I wrote a search tool (I mean, copied and integrated from somewhere) workx perfect but...
- let's say I am searching for the word considering , result comes up, fine...
- when I search for sidering (which is nonsense but this is sample.) results comes up same because considering also includes sidering
What I really need is, I just want it to find only the word sidering not the words includes sidering. When I type just onsi it also brings me the page includes considering.
I've googled it and results were not helpfull, is this too difficult? Am i trying to create another google ?
this is my code:
form:
Code:<form action="search-v2.asp"> <input type="hidden" name="boo" value="AND" /> <p align="right"> <input type="text" name="q" size="22" /> </p> </form>
result page:
Code:<% page = request.querystring("page") query = request.querystring("q") boo = request.querystring("boolean") If page = "" Then page = 1 else page = cint(page) End If query = replace(query, "'" , "''") if query = "" then strRsp = " " else if boo = "AND" then SQL = SQL & " pages.title LIKE '%" & query & "%' OR " SQL = SQL & " pages.keywords LIKE '%" & query & "%' OR " SQL = SQL & " pages.pageDesc LIKE '%" & query & "%' OR " SQL = SQL & " pages.pageDesc2 LIKE '%" & query & "%' OR " else q = split(query, " ") for e = 0 to ubound(q) SQL = SQL & " pages.title LIKE '%" & q(e) & "%' OR " SQL = SQL & " pages.keywords LIKE '%" & q(e) & "%' OR " SQL = SQL & " pages.pageDesc LIKE '%" & q(e) & "%' OR " SQL = SQL & " pages.pageDesc2 LIKE '%" & q(e) & "%' OR " next end if SQL = Left(SQL, (LEN(SQL)-3)) DisplayNum = 0 Set oCon = Server.CreateObject ("ADODB.Connection") Set Rec = Server.CreateObject ("ADODB.Recordset") oCon.Open strCon Rec.PageSize = 10 Rec.CursorLocation = adUseClient SQL = "SELECT pageID, title, pageDesc, pageDesc2, url FROM pages WHERE active = 0 AND " & SQL SQL = SQL & " order by title asc" Rec.Open SQL, oCon if Rec.EOF OR Rec.BOF Then strRsp = strRsp & "<br><br>" strRsp = strRsp & "<p align=center><b>Sorry, There is no result ... </b></p>" response.write " Sorry, There is no result ..." else ipage = Rec.PageCount if page = 0 or page > ipage Then Rec.AbsolutePage = ipage else Rec.AbsolutePage = page end if response.write "<blockquote>" Do While Not Rec.EOF AND DisplayNum < 10 response.write "<b><a href="""& Rec("url") & """>"& Rec("title") & "</a></b><br>" & rec("pageDesc") & "<br><br>" DisplayNum = DisplayNum + 1 Rec.MoveNext Loop response.write "</blockquote>" end if If ipage > 1 Then showpages = " More Pages : " For z = 1 to ipage If z = page then showpages = showpages & " [" & page & "] " Else showpages = showpages & " <a href=search-v2.asp?page=" & z &"&q="&server.urlencode(query)& "&boolean="& boo &">" & z & "</a>" & " " End If Next response.write showpages & " " if ipage > 1 And page > 1 Then response.write "<a href=search-v2.asp?page="& page - 1 &"&q="& server.urlencode(query) & "&boolean="& boo &">Previous</a> " end if strLine = strLine & " " If ipage > 1 And page < ipage Then response.write "<a href=search-v2.asp?page="& page + 1 &"&q="& server.urlencode(query) & "&boolean="& boo &">Next Page</a> " end if End If Rec.Close oCon.Close set Rec = nothing set oCon = nothing end if %>


) workx perfect but...
Reply With Quote



Bookmarks