Professional Web Applications Themes

plural name searching - MySQL

I have a column entry with the value 'widget' I want people to be able to find the value searching under 'widget' or 'widgets'. Does this mean I should remove any 's' chars at the end of a word before creating the query, or is there another way to handle this problem? Thanks...

  1. #1

    Default plural name searching

    I have a column entry with the value 'widget'
    I want people to be able to find the value searching under 'widget' or
    'widgets'.
    Does this mean I should remove any 's' chars at the end of a word
    before creating the query, or is there another way to handle this
    problem?
    Thanks

    ron1972 Guest

  2. #2

    Default Re: plural name searching

    On 2 Feb 2006 13:57:27 -0800, "ron1972" <ron1972> wrote:
    >I have a column entry with the value 'widget'
    >I want people to be able to find the value searching under 'widget' or
    >'widgets'.
    >Does this mean I should remove any 's' chars at the end of a word
    >before creating the query, or is there another way to handle this
    >problem?
    Not all plural words just have the singular with "s" appended. To do it
    properly, you need to store both the singular and the plural forms somewhere.

    --
    Andy Hassall :: [email]andyandyh.co.uk[/email] :: [url]http://www.andyh.co.uk[/url]
    [url]http://www.andyhsoftware.co.uk/space[/url] :: disk and FTP usage ysis tool
    Andy Hassall Guest

  3. #3

    Default Re: plural name searching

    >
    > Not all plural words just have the singular with "s" appended. To do it
    > properly, you need to store both the singular and the plural forms somewhere.
    >
    You could do this. It's easier to work out plurals in English according
    to a set of rules, (add s, unless noun ends in x or ch or, then add es,
    unless the noun happens to be potato in which case you don't...),
    certainly easier than going backwards from the plural to the singuler.
    (I mean, given the word buses, the singular could be buse!)

    The trouble is you could go to the effort of writing a great singular -
    plural converter,but your public will spell it wrong when they search.

    I'd go go for the first few letters of the word myself.

    richselby Guest

  4. #4

    Default Re: plural name searching


    "ron1972" <ron1972> wrote in message
    news:1138917447.667551.220640z14g2000cwz.googlegr oups.com...
    >I have a column entry with the value 'widget'
    > I want people to be able to find the value searching under 'widget' or
    > 'widgets'.
    > Does this mean I should remove any 's' chars at the end of a word
    > before creating the query, or is there another way to handle this
    > problem?
    > Thanks
    >
    there are special search functions in MySQL and PHP. in MySQL there is a
    MATCH() function [url]http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html[/url]
    and FULLTEXT indexes for searching (if you really want to use that). in PHP
    there is soundex() or more appriately, preg_match('/widgets?/', $string),
    but only if you are willing to do a SELECT with LIKE 'widget%'.


    Jim Michaels Guest

Similar Threads

  1. WE KNOW EXACTLY WHAT YOU'RE SEARCHING FOR!
    By Broadway_Rose in forum Macromedia Shockwave
    Replies: 1
    Last Post: August 2nd, 03:41 AM
  2. name searching
    By JD in forum MySQL
    Replies: 4
    Last Post: May 19th, 02:05 PM
  3. Searching Dates
    By Supercyberal in forum Coldfusion Database Access
    Replies: 2
    Last Post: May 26th, 06:25 AM
  4. searching files
    By Seph webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 11
    Last Post: January 22nd, 06:39 AM
  5. Searching for a pattern
    By Sven Dzepina in forum PHP Development
    Replies: 2
    Last Post: October 13th, 12:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139