Author |
Topic  |
|
frittjaaff
Starting Member
7 Posts |
Posted - 30 October 2001 : 01:57:17
|
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
|
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 |
 |
|
frittjaaff
Starting Member
7 Posts |
Posted - 30 October 2001 : 10:09:31
|
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 "
:)
|
 |
|
redbrad0
Advanced Member
    
USA
3725 Posts |
Posted - 30 October 2001 : 10:30:22
|
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 |
 |
|
frittjaaff
Starting Member
7 Posts |
Posted - 30 October 2001 : 12:55:43
|
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.
|
 |
|
frittjaaff
Starting Member
7 Posts |
Posted - 30 October 2001 : 16:21:58
|
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.
|
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 30 October 2001 : 19:27:28
|
Change OR to AND
====== Doug G ====== |
 |
|
frittjaaff
Starting Member
7 Posts |
Posted - 31 October 2001 : 14:38:31
|
thanks 
|
 |
|
|
Topic  |
|