Jump to content

Search Box


Orionsbelter

Recommended Posts

Hi

 

Yes, a like. However you might want to search for items the both start with what is typed and contain what is typed (ie, put the ones it starts with first).

 

Something like:-

 

SELECT phrase, "Begins" AS fred FROM some_table WHERE phrase like "searchstring%"

UNION

SELECT phrase, "Contains" AS fred FROM some_table WHERE phrase like "%_searchstring%"

ORDER BY fred

 

All the best

 

Keith

 

Link to comment
Share on other sites

Hi

 

Do you mean if you have a search table containing all the possible phrases? Possible (and how the search works for single words in some forum software), but likely to mean a massive table.

 

For example say you had a phrase "she sells sea shells" and wanted a list of all the possible phrases in that to search. Just that simple 4 word phrase would give you:-

 

she

she sells

she sells sea

she sells sea shells

sells

sells sea

sells sea shells

sea

sea shells

shells

 

The number of possible phrases would rapidly massively increase.

 

All the best

 

Keith

Link to comment
Share on other sites

Hi

 

There is an algorithm called Soundex to match up words phonetically, although it is meant to be used with names (not sure it would work as well with normal words). Think the word equivalent is called Metaphone.

 

Probably best to have Google for those. There is a php function to calculate the metaphone.

 

All the best

 

Keith

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.