MySQL: something is wrong with full-text search - return NO results

I have a places(name vachar(50), address text, description text) engine = MYISAM table places(name vachar(50), address text, description text) engine = MYISAM and several records.

I am trying to make an example in here ! and look for the "full text problem", but I don’t understand the full text search.

First, I add a full-text index:

 ALTER TABLE places ADD FULLTEXT(name, address, description); 

and try mySQL:

 SELECT * FROM places WHERE MATCH(name,address,description) AGAINST('my search key'); 

I tried some “my search key” that the content is in many areas, but there are some cases when I received:

  • now the selected row.

  • if I try to add option "IN BOOLEAN MODE" in AGAINST() , the result is obtained with result = 1, it makes no sense when I sort it.

  • it simply shows the result when the “search key” has content in the (name) field.

I tried a lot, but I don’t remember all the cases

Any answer can help!

Thanks in advance!

+7
source share
3 answers

Make sure your keyword is not stopping the word . To disable or change the stop word list , you need to access the system variables and restart the server.

Also, make sure the keyword matches the minimum length of a full text word . The default minimum length is 4.

Finally, make sure that the word appears in less than 50% of the entries. MySQL will not return results where the word is displayed in 50% or more records.

+6
source

In addition to Marcus's answer:

When I first started with FULLTEXT indexes in MySQL, I had problems with empty results - I avoided stop words and also used long enough words, so I scratched my head a bit until I found that it was buried in the MySQL Documentation :

The 50% threshold is essential the first time you try full-text search to see how it works: if you create a table and insert only one or two lines of text into it, each word in the text occurs in at least 50% of the lines. As a result, no searches return any results. Be sure to insert at least three rows, and preferably many more. Users who need to bypass the 50% limit can use logical search mode

It also explains why you got the results (but with a "pointless" score) when you asked for a job in BOOLEAN MODE

+2
source

select an identifier, sb_date_india_export, hs_code_india_export, product_description_india_export, indian_exporter_name_india_export, foreign_importer_name_india_export, foreign_country_india_export, indian_port_india_export, mode_india_export from wtindiaexport wherein (sb_date_india_export between '1528223400' or '1531420199') and ((hs_code_india_export, as the '10% ') and (MATCH (product_description_india_export) AGAINST ('' + non "+ rice * 'IN BOOLEAN MODE)) and (indian_port_india_export as'% jnpt%')) sort by sb_date_india_export desc limit 0.50

In some entries, "NON" does not exist. Why so far shows the record. Help me please.

enter image description here

0
source

Source: https://habr.com/ru/post/915325/


All Articles