Welcome Guest, Not a member yet? Register   Sign In
Close Matches SQL
#1

[eluser]sqwk[/eluser]
I have a search function that pulls data from a database, with quite a few WHERE clauses already. However, I would like to show the user close matches as well, meaning results that don't meet all the conditions, but only a set of core-conditions and as many of the others as possible, sorted by how many are met.

Does it make sense to get the result-set that meets all of the core-conditions and do the rest of the filtering through php—manipulating a possibly very large dataset—or is there a way to do this natively through the query?
#2

[eluser]rogierb[/eluser]
If you have a MySQL innodb database, you could use match() against() for full-text searching.
Another approach is to do a regexp() in MySQL.

If you do use MySQL manipulating an large result can be done through a stored procedure rather then php.

A couple of techniques to filter data and get close matches is to create wordlists with matching terms like synonyms and typos. Another is regexp or filter through a script. The main problem is to get a first resultset large enough.




Theme © iAndrew 2016 - Forum software by © MyBB