Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use full-text search under mysql+mybatis

Shulou Source: shulou.com Published: 2022-06-01 18:41:42 10月03日 Update

This article is about how to use full-text search under mysql+mybatis. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The first step is to click on the full-text search full text type index on your column that requires full-text search. Note that my example is that the column is of type longText.

The first step is to build the fulltext type index as follows

Select full text for index type

Step 2:

Verify whether full-text search sql works

Step 3:

I use the mybatis framework and change the automatically generated example condition settings and mapper.xml file contents

Page page = (Page) logMapper.selectByExample (tLogExample)

Finally, the sql statement generated by the mybatis framework basically uses the full-text search syntax.

Note that the premise of using the full-text search function in mysql is to establish a full text type index on the column to be searched.

Finally, the sql statement generated by the mybatis framework basically uses the full-text search syntax.

Select id, log_type, system_name, visit_time,message from t_log WHERE (MATCH (message) AGAINST ('* FA9X0D00000001*' IN BOOLEAN MODE))

Thank you for reading! This is the end of the article on "how to use full-text search under mysql+mybatis". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Full-text search type index content that is framework generation more articles sentences grammar good practical examples premises functions okay good files Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi MariaDB NVidia Shulou Tech Info