2
I am looking to perform a search in a table containing the name of the products. I created a FULLTEXT to optimize the performance of the queries.
SELECT * FROM tabela WHERE MATCH (campo) AGAINST ('Picant*Defumad*' IN BOOLEAN MODE);
Upshot:
1 LOMBO DEFUMADO PICANTE FATIADO PRIETO BANDEJA
2 CAFÉ PICANTE
3 BISC TAP SNACK CURCUMA E PAPPRICA DEFUMADA 25G
In this search I already obtained an improvement of not being considered the order that the words were typed, as in the first result presented. But I also need that if the user type "PICATE"
, it seeks records that are similar as in the case of PICANTE
.
I have tried to use other forms of HOW as in the case of IN NATURAL LANGUAGE MODE
, but did not solve the problem.
"But I also need the case or user to type "SPICY"" I didn’t quite understand the doubt, it would be like mouthing "PICANT*", but in this case "PICANTE*"
– Ricardo Pontual
In this case, I need to search for similar words, : "PICATE", where the N, he searches every record I have "SPICY".
– Hellton Lacerda
there is a resource called
SOUNDEX
, look into it– Ricardo Pontual
The SOUNDEX function does not fit my search form, because it uses a phonetic algorithm, and in this case I have a typo that can compromise the phonetics of the text. .
– Hellton Lacerda
in this case there is nothing ready to help you, you will need to create dictionaries of similar words and move to the query
– Ricardo Pontual
The problem that the table even contains more than 1 million record. In the application I use PHP, and I was able to do a search that already returns to me what I need, but I allocate all the values of the BD in memory so I can handle and it consumes a lot of machine resource.
– Hellton Lacerda
I’m seeing a way to replicate PHP code for a Mysql function.
– Hellton Lacerda
No Oracle já fiz por Jaro-Winkler e edit_distance combinadas , achei para Mysql https://gist.github.com/TheHiddenHaku/7229861 doc Oracle https://docs.oracle.com/cd/E11882_01/appdev.112/e40758/u_match.htm#ARPLS352
– Motta
pq do not use REGEX?
– Lucas