Querying words instead of phrases

C

Cubicle Intern

Hi,

My website's search function looks up entire phrases instead of
individual words. For example, if I query "Google Groups," I would
like my search to come up with everything in my database that has the
words "Google" and "Groups," not just the phrase "Google Groups." I
would want my search to bring back "Google-tastic Search" or "Group
Compu-Google." Right now it only brings back "Google Groups #1,"
"Google Group #2," etc.

I'm at a loss at how to begin implementing this change. Any
suggestions? I'm working with ASP files, Javascript and HTML. Thanks
in advance for any help.

tyv
 
E

endangeredmassa

Hi,

My website's search function looks up entire phrases instead of
individual words. For example, if I query "Google Groups," I would
like my search to come up with everything in my database that has the
words "Google" and "Groups," not just the phrase "Google Groups." I
would want my search to bring back "Google-tastic Search" or "Group
Compu-Google." Right now it only brings back "Google Groups #1,"
"Google Group #2," etc.

I'm at a loss at how to begin implementing this change. Any
suggestions? I'm working with ASP files, Javascript and HTML. Thanks
in advance for any help.

tyv

You could split the search phrase by spaces, then query each word
individually. Then, merge the lists in such a way that items that
appear in both lists appear at the top of your results page.
 
T

Tom de Neef

Cubicle Intern said:
Hi,

My website's search function looks up entire phrases instead of
individual words. For example, if I query "Google Groups," I would
like my search to come up with everything in my database that has the
words "Google" and "Groups," not just the phrase "Google Groups." I
would want my search to bring back "Google-tastic Search" or "Group
Compu-Google." Right now it only brings back "Google Groups #1,"
"Google Group #2," etc.

I'm at a loss at how to begin implementing this change. Any
suggestions? I'm working with ASP files, Javascript and HTML. Thanks
in advance for any help.

If you want to display only those results that match all words in the search
text, you would proceed as follows:
search the database for all matches on the first word
search the results for all matches on the second word
etc

In pseudo code:
resultList = match(database,words[0])
n = 1
while (n<words.length) { resultList = match(resultList,words[n]); n++ }

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top