for small , simple search tool on site use mysql's match against find relevant rows based on search term. use query:
select * mytable match (name,description) against ('".$term."*' in boolean mode)
if i, instance, search 'sys' query gives me results words system or systems. problem i'm having , thing achieve when search term 'systems' results exact word 'systems', results word 'system' well.
i checked docs can't seem find solution. did run before?
this bit long comment.
what asking implemented in 1 of 2 ways in full text search engine. more common method list of synonyms terms. these allow "system" , "systems" same thing.
as far know, mysql not support synonym lists. can implement them yourself, in cumbersome manner, pre-processing data or queries substitute synonym values.
the second approach called stemming. transforms words "root" form, "systems" recognized plural of "system" , 2 match. stemming can applied in query. or, ambitious, can applied on document storage side well. problem there ambiguity. english (and other languages) filled exceptions stemming doesn't make sense.
Comments
Post a Comment