CodeIgniter Forums
similar rows with mysql - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: similar rows with mysql (/thread-31138.html)



similar rows with mysql - El Forum - 06-07-2010

[eluser]stuffradio[/eluser]
So say I have a table with the field called title.

I want to select all the instances where the title is similar.

Quote:Title:
title 1
John
John 2
This is John 2 the third

How can I do this:
Quote:Title | Count
title 1 | 1
John | 1
John 2 | 2
Of course as you can see, I want to get the similar instances of anything with that remotely resembles John 2.

I'm using this as a way to calculate the most instances of a title.


similar rows with mysql - El Forum - 06-07-2010

[eluser]pam81[/eluser]
Hi, well there is a formal way to do this name as inverted index http://en.wikipedia.org/wiki/Inverted_index
it's not very easy! I dont' try it at code igniter or php, but maybe could be some library to work with it.

I hope this helps.


similar rows with mysql - El Forum - 06-08-2010

[eluser]Burak Guzel[/eluser]
For finding similar text in MySQL, you can look into this:
http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html#function_match


similar rows with mysql - El Forum - 06-08-2010

[eluser]pickupman[/eluser]
A library written by Jelmer on the boards, has MP_Search that might help get you closer.