I have a table in a MySQL Database which has this structure:
CREATE TABLE `papers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(1000) COLLATE utf8_bin DEFAULT NULL,
`booktitle` varchar(300) COLLATE utf8_bin DEFAULT NULL,
`journal` varchar(300) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`id`),
FULLTEXT KEY `title_fulltext` (`title`),
FULLTEXT KEY `booktitle_fulltext` (`booktitle`),
FULLTEXT KEY `journal_fulltext` (`journal`)
) ENGINE=MyISAM AUTO_INCREMENT=1601769 DEFAULT CHARSET=utf8 COLLATE=utf8_bin
Now I know that in the column title, somewhere within the millions of rows, there is a row which contains the string
nFOIL: Integrating Naïve Bayes and FOIL.
I want to look for
my_string = "nFOIL: integrating Naïve Bayes and FOIL"
and find the right row. You see it has to be a case insensitive search and the dot at the end is missing in the query. How do I implement this?
I tried
SELECT id FROM papers WHERE UPPER(title) LIKE %s
and converted my_string to upper case in python and put a “%” at the end of my_string but this doesn’t seam a good way of handling this. It did not work too. =)
Thanks for any suggestions!
I see you have added FULLTEXT indexes, I though you already knew about MATCH AGAINST syntax of MySQL.
You should try