Perform a full text search for partial matches where shortest match has the highest relevance in MySQL? -
i'd perform fulltext search against column, looking partial word match (ie: against('fra*' in boolean mode)
). receive results assign higher relevancy shorter words match.
so, example, if perform search 'fra' , results 'frank', 'fran' , 'frankfurter', them ordered in terms of relevancy this: 'fran', 'frank', 'frankfurter'.
is there someway can achieved?
select token tokentable token '%fra' order char_length(token) asc
to fullfill example, fast due btree indexing. can do:
select document documents document '%frankfurter%' , document '%würstel%' order char_length(document) asc
but nonsense of relevancy calculation.
simple answer: if autosuggestion based on prefix, method above fine. theres no need use match against. if want search fulltext search cant such criteria, should @ lucene/solr
Comments
Post a Comment