Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search with "Any words" "All words" "Exact phrase"

Status
Not open for further replies.

mayamanako

Technical User
Aug 31, 2005
113
GB
Hi guys, do you know how to incorporate to a search textfield the radio buttons of "Any words","All words", "Exact phrase" so that the user can further choose how to filter more their search?

Do you know of a link for this kind of search application that I could have a look?

Thanks for any info.
 
In very broad terms would you want to check the user input field, manipulate it with sting functions to capture and store the individual words in the entry, then build the SQL query statement on that?

If radio button 1 any words is checked use SQL1 for the query. SQL1 becomes select whatever from whereever where thing1 like userthing1 OR thing1 like Userthing2 up to the number of previously identified words

If radio button 2 all words is checked SQL1 becomes select whatever where thing1 like userthing AND thing1 like userthing2

If radio button 3 exact match then SQL1 is thing1 = userthing

Is that the sort of thing you had in mind?
 
Hi BigRed1212, thanks for your reply.

Can you give a more specific example/code please?

Again many thanks.

Regards
 
Well, I think the thing to do would be to break it down in pieces.

The first thing to do might be to take whatever comes in from the user textbox and do something with it.

Other people are a lot better at coding things than I am and I hope they will chime in. Forging on, however...

Maybe something like:

Code:
dim searchwordloop, searchwords()
'check the querystring
if request.querystring("user_entered_search_terms").count=0 then 
response.write "You need to enter a search term, dummy!"
else
'loop through the querystring
for searchwordloop = 1 to request.querystring("user_entered_search_terms").count 
'attempt to load an array with the query string
'guessing on this part
searchwords(searchwordloop) = request.querystring("user_entered_search_terms")(searchwordloop)
next
end if

Then maybe if somebody entered "pictures of the navel of Megan Fox" as their search term you might end up with a searchwords array that looked like
searchwords(1) = "pictures"
searchwords(2) = "of"
searchwords(3) = "the"
searchwords(4) = "navel"
searchwords(5) = "of"
searchwords(6) = "Megan"
searchwords(7) = "Fox"

You would need to do something with the "of's" and the "the's" but that might give you something to start building some SQL statements on.

Don't know. Untested so it probably doesn't work.

 
/


any sample,real code guys?

i've been trying to find something on the web but no luck yet.

thnx for any help.



/
 
Hi BigRed1212, thanks very much for your help. I look into that.

Have a nice day!

All the best
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top