Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 search
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

frittjaaff
Starting Member

7 Posts

Posted - 30 October 2001 :  01:57:17  Show Profile  Send frittjaaff an ICQ Message
i am making a search enegine to my site. now i have this:

making the variables ready
if instr(request("keyword"), ",") then
x = Split(request("keyword"), ",")
else
x = Split(request("keyword"), " ")
end if

select it for the database
for i = 0 to UBOUND(x)
SQL = SQL & "artist LIKE '%" & x(i) & "%' OR "
SQL = SQL & "tittel LIKE '%" & x(i) & "%' OR "
next

this matches everything that have the searchwords in it. if you search for "i" will all records that have an i be displayed. not only i's alone, i's inside word too.

i want to let it be possible to search for a phrase and only whole words. if you search for i will only the records that have an i alone be dislayed.

how can i do that?



Edited by - frittjaaff on 30 October 2001 10:01:31

redbrad0
Advanced Member

USA
3725 Posts

Posted - 30 October 2001 :  07:47:42  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
well you are searching for "'" why not search for " i " which will only find the whole word " i " because of the space at the begining and the end.

Brad
Go to Top of Page

frittjaaff
Starting Member

7 Posts

Posted - 30 October 2001 :  10:09:31  Show Profile  Send frittjaaff an ICQ Message
becaue if "i" is the first, last or only letter in the field. if not could i have use this:

SQL = SQL & "artist LIKE '%" & " " & x(i) & " " & "%' OR "
SQL = SQL & "tittel LIKE '%" & " " & x(i) & " " & "%' OR "

:)

Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 30 October 2001 :  10:30:22  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
if you are worried about i being the first or last word then you can not use that. im not sure how much search engines work now days (havent been to one in awhile). Do they pull up only the whole word, or if you search for "app" would it pull up "applications"?

Brad
Go to Top of Page

frittjaaff
Starting Member

7 Posts

Posted - 30 October 2001 :  12:55:43  Show Profile  Send frittjaaff an ICQ Message
the most field have only one, two or there words in it. one solution is to add a space before and after the record when it is added, and remove them when they are displayed, but it have to be easier ways to do it. it is many sites that have the function i want, but all free search script i have checked do not have it. i think this forum have it, but it was so many include files with many functions so i did not find it.

Go to Top of Page

frittjaaff
Starting Member

7 Posts

Posted - 30 October 2001 :  16:21:58  Show Profile  Send frittjaaff an ICQ Message
okay. i will make a space before and after all records, and automaticly put a space bafore and after when new records are added. the only question that is again is how i can only display the records that have all search word in it. the first one display all records that have one or more of the search word in it, but now want i only the reocrds that have them all to be displayed.

Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 30 October 2001 :  19:27:28  Show Profile
Change OR to AND


======
Doug G
======
Go to Top of Page

frittjaaff
Starting Member

7 Posts

Posted - 31 October 2001 :  14:38:31  Show Profile  Send frittjaaff an ICQ Message
thanks

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07