Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Querying words instead of phrases

Reply
Thread Tools

Querying words instead of phrases

 
 
Cubicle Intern
Guest
Posts: n/a
 
      02-29-2008
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
 
Reply With Quote
 
 
 
 
endangeredmassa@gmail.com
Guest
Posts: n/a
 
      02-29-2008
On Feb 29, 12:58 pm, Cubicle Intern <vyts...@gmail.com> wrote:
> 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.
 
Reply With Quote
 
 
 
 
Tom de Neef
Guest
Posts: n/a
 
      02-29-2008
"Cubicle Intern" <> schreef
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Querying multiple words Cubicle Intern ASP .Net 1 02-29-2008 09:30 PM
Klingon Phrases =?Utf-8?B?SVQtTU9ORVk=?= MCSE 5 10-03-2006 01:17 PM
Romulan Phrases =?Utf-8?B?SVQtTU9ORVk=?= MCSE 4 10-02-2006 05:28 PM
Does a resource have to have all phrases in it? =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= ASP .Net 4 02-03-2006 08:58 AM
Regex help: Split string into words AND double-quoted phrases Robert Oschler Javascript 2 08-02-2005 11:01 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57