调整mysql 全文索引使用自然语言搜索模式

This commit is contained in:
wangliwen 2022-07-22 10:28:37 +08:00
parent fc66ef062b
commit 1ebd70df03
2 changed files with 10 additions and 10 deletions

View File

@ -245,7 +245,7 @@ public class CensusControllerV2 {
});
String sqlFormat = "SELECT COUNT( tda.data_resource_id ) FROM tb_data_attr tda JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id AND MATCH ( tda.attr_value) AGAINST ( '%s' IN BOOLEAN MODE) AND tda.attr_type = '组件类型' AND tda.del_flag = 0 AND tdr.del_flag = 0;";
String sqlFormat = "SELECT COUNT( tda.data_resource_id ) FROM tb_data_attr tda JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id AND MATCH ( tda.attr_value) AGAINST ( '%s' IN NATURAL LANGUAGE MODE) AND tda.attr_type = '组件类型' AND tda.del_flag = 0 AND tdr.del_flag = 0;";
CompletableFuture<Void> aiAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台智能算法组件服务数目
return jdbcTemplate.queryForObject(String.format(sqlFormat, "智能算法"), Long.class);

View File

@ -129,10 +129,10 @@
AND tdr.type != '赋能案例'
</if>
<if test="dto.type != null and dto.type != ''">
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN NATURAL LANGUAGE MODE)
</if>
<if test="dto.name != null and dto.name != ''">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN NATURAL LANGUAGE MODE)
</if>
<if test="dto.districtId != null and dto.districtId != ''">
AND tdr.district_id = #{dto.districtId}
@ -166,7 +166,7 @@
<foreach collection="dto.infoList" item="item" separator="union all">
SELECT data_resource_id FROM tb_data_attr
WHERE attr_type = #{item.attrType}
AND MATCH ( attr_value) AGAINST ( #{item.attrValue} IN BOOLEAN MODE)
AND MATCH ( attr_value) AGAINST ( #{item.attrValue} IN NATURAL LANGUAGE MODE)
AND del_flag = 0
</foreach>) tb
GROUP BY tb.data_resource_id
@ -244,11 +244,11 @@
AND tdr.del_flag = 0
<if test="type != null and type != ''">
<!-- AND tdr.type LIKE CONCAT('%',#{type},'%') -->
AND MATCH (tdr.type) AGAINST ( #{type} IN BOOLEAN MODE)
AND MATCH (tdr.type) AGAINST ( #{type} IN NATURAL LANGUAGE MODE)
</if>
<if test="name != null and name != ''">
<!--AND tdr.name LIKE CONCAT('%',#{name},'%') -->
AND MATCH (tdr.name) AGAINST ( #{name} IN BOOLEAN MODE)
AND MATCH (tdr.name) AGAINST ( #{name} IN NATURAL LANGUAGE MODE)
</if>
ORDER BY ${orderFiled} ${orderType}
LIMIT ${pageNum}, ${pageSize}
@ -383,7 +383,7 @@
AND tdr.type != '赋能案例'
</if>
<if test="dto.name != null and dto.name != ''">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN NATURAL LANGUAGE MODE)
</if>
<if test="dto.type != null and dto.type != '' ">
AND tdr.type = #{dto.type}
@ -433,7 +433,7 @@
1 = 1
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN NATURAL LANGUAGE MODE)
</if>
<if test="dto.type != null and dto.type != ''">
AND tdr.type = #{dto.type}
@ -465,7 +465,7 @@
1 = 1
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN NATURAL LANGUAGE MODE)
<!--AND tdr.name LIKE CONCAT('%',#{dto.name},'%') -->
</if>
<if test="dto.type != null and dto.type != ''">
@ -1035,7 +1035,7 @@
AND tdr.del_flag = 0
AND tda.del_flag = 0
AND tdr.id = tda.data_resource_id
AND MATCH (attr_value) AGAINST ( #{type} IN BOOLEAN MODE)
AND MATCH (attr_value) AGAINST ( #{type} IN NATURAL LANGUAGE MODE)
</select>
<select id="selectAppAreaCountList" resultType="java.util.Map">