Professional Web Applications Themes

how to match any character or part of a word in a fulltext search - MySQL

hello, i'm experimenting with fulltext searches and came across a problem. my table is in unicode and includes names from different languages. is it possible to to implement a fulltext search that would allow me to find rows with an entry including characters i may not know or at least may not know how to type? what i have in mind is something similar to "... where name like 'honor_'", or parts of words (to include different cases), like 'kritik%', that matches 'kritika', 'kritike', 'kritiki' and so on. because of this i am seriously considering using a search technique without ...

  1. #1

    Default how to match any character or part of a word in a fulltext search

    hello,

    i'm experimenting with fulltext searches and came across a problem.

    my table is in unicode and includes names from different languages. is
    it possible to to implement a fulltext search that would allow me to
    find rows with an entry including characters i may not know or at least
    may not know how to type? what i have in mind is something similar to
    "... where name like 'honor_'", or parts of words (to include different
    cases), like 'kritik%', that matches 'kritika', 'kritike', 'kritiki'
    and so on.

    because of this i am seriously considering using a search technique
    without the fulltext index.

    thanks.

    omeldoid@gmail.com Guest

  2. #2

    Default Re: how to match any character or part of a word in a fulltext search

    Try using the BOOLEAN MODE.

    http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html

    This has the ability to do partial words by ending the word with a star
    (*)

    e.g. 'honor*'

    you can't do wild character matches though, and its not keen on special
    characters.

    I got round this by having a search field with all the words processed
    by stripping out all characters it doesn't like. I then search against
    that field with search words processed in the same way.

    Tigger

    com wrote: 

    Tigger Guest

  3. #3

    Default Re: how to match any character or part of a word in a fulltext search

    Tigger wrote: 

    thanks for this, i must have missed it.
     

    that's a pitty. but special characters aren't ignored (at least not in
    my version). this makes it impossible to find words that have any such
    character anywhere but at the very end. another solution i've come
    across was to put the most important of those characters onto a web
    page right next to the search form. i found it useful but you cannot
    have the entire unicode set pasted there ...

    i reverted to `where ... like ... ' as my tables will never grow to
    millions of rows. still, i didn't want to use poor code.

    andrej

    omeldoid@gmail.com Guest

Similar Threads

  1. partial word search with FULLTEXT
    By creadcdd in forum MySQL
    Replies: 0
    Last Post: August 31st, 07:02 PM
  2. Whoops -- character limit per line in Mysql or dodgy debugging on my part?
    By speralta@progressivetrail.org in forum MySQL
    Replies: 3
    Last Post: July 18th, 04:05 AM
  3. Tune performance of fulltext search
    By jens.bertheau@gmx.de in forum MySQL
    Replies: 3
    Last Post: February 13th, 08:59 AM
  4. How to match all characters in a Character Class
    By Eric Schwartz in forum PERL Miscellaneous
    Replies: 4
    Last Post: July 22nd, 08:44 AM
  5. MySQL UNION on 2 Fulltext search queries
    By André Nęss in forum PHP Development
    Replies: 0
    Last Post: July 21st, 11:55 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