0

I want to make a plural search on my table but i don't want to use FULLTEXT.I tried FULLTEXT but my table doesn't support it.My query is like:

SELECT
     *
FROM
     items
WHERE
     LOWER(items.`name`) LIKE '%parameter%'
OR LOWER(items.brand) LIKE '%parameter%'
OR LOWER(items.sku) LIKE '%parameter%'

When i search 'shirt' it returns good results when i search shirts i doesn't.Is there a way to make plural search without fulltext

Antonio Papa
  • 1,596
  • 3
  • 20
  • 38

2 Answers2

1

I suggest you to create separate table items with MyIsam Engine for items with fields you want to perform search and primary id.

Now you can do full-text search on new table and retrieve ID and based on ID you can retrieve result of fields from main items table.

The additional table for "items" needs to be updated regularly, may be though trigger or automated script.

Minesh
  • 2,284
  • 1
  • 14
  • 22
  • 2 Tables? i don't know is there an easier way? – Antonio Papa Jan 24 '13 at 10:29
  • @AntonioPapa if you don't have any restriction you can just convert existing table to MyIsam and have full-text search. – Minesh Jan 25 '13 at 06:48
  • Is apache lucene a solution for this problem? – Antonio Papa Jan 25 '13 at 09:28
  • I have good experience working with Sphinx full-text search engine instead, best suited for MySql. It uses the Porter Stemmer algorithm which means some other kinds of suffixes are also handled, like "running" and "run" will both normalized to "run". – Minesh Jan 25 '13 at 10:33
0

it will match all those beginning with parameter passed.

SELECT
     *
FROM
     items
WHERE
     LOWER(items.`name`) LIKE 'parameter%'
OR LOWER(items.brand) LIKE 'parameter%'
OR LOWER(items.sku) LIKE 'parameter%'
Arpit
  • 12,767
  • 3
  • 27
  • 40