i'm working on project involving php , mysql. admit i'm pretty new both.
i have table has company names, let's cocacola, if user searches cocacola, have read info table. question is, how can make work if user writes cocacola company, or else matches?
i implemented soundex gives basic error handling, i'd allows me check if name that's inside table (cocacola) matches string coming user ("cocacola company" includes "cocacola").
i found "like" statement
name %$name% but seems works way around, can detect if user writes less, how detect if he/she writes more? (something
where %name% $name if exists).
if want check user writing less why not create clause checks search string length , if 12 or more characters, use substring function search first 8 characters input user.
where name concat('%', substring($searchstring, 8), '%') it sounds project benefit robust search library. have tried looking @ library or plugin similar apache lucene? know lucene written in java looking may find powerful plugin written in language appropriate project.
Comments
Post a Comment