问答功能优化-初始化表
parent
fd4641cc48
commit
2ea04d7325
@ -0,0 +1,56 @@
|
||||
package com.supervision.pdfqaserver.config;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.postgresql.util.PGobject;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class VectorTypeHandler extends BaseTypeHandler<float[]> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i,
|
||||
float[] parameter, JdbcType jdbcType) throws SQLException {
|
||||
// 将float数组转换为PostgreSQL vector格式字符串
|
||||
PGobject vector = new PGobject();
|
||||
vector.setType("vector");
|
||||
vector.setValue(arrayToVectorString(parameter));
|
||||
ps.setObject(i,vector); ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return vectorStringToArray(rs.getString(columnName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return vectorStringToArray(rs.getString(columnIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return vectorStringToArray(cs.getString(columnIndex));
|
||||
}
|
||||
|
||||
private String arrayToVectorString(float[] array) {
|
||||
StringBuilder sb = new StringBuilder("[");
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) sb.append(",");
|
||||
sb.append(array[i]);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private float[] vectorStringToArray(String vector) {
|
||||
if (vector == null || vector.isEmpty()) return null;
|
||||
String cleaned = vector.replace("[", "").replace("]", "");
|
||||
String[] parts = cleaned.split(",");
|
||||
float[] result = new float[parts.length];
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
result[i] = Float.parseFloat(parts[i].trim());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.supervision.pdfqaserver.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 问题分类表
|
||||
* @TableName question_category
|
||||
*/
|
||||
@TableName(value ="question_category")
|
||||
@Data
|
||||
public class QuestionCategory implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 分类名
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 父级id
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.supervision.pdfqaserver.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 问题分类意图关联表
|
||||
* @TableName question_category_intention
|
||||
*/
|
||||
@TableName(value ="question_category_intention")
|
||||
@Data
|
||||
public class QuestionCategoryIntention implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 问题分类id
|
||||
*/
|
||||
private String categoryId;
|
||||
|
||||
/**
|
||||
* 意图id
|
||||
*/
|
||||
private String intentId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.supervision.pdfqaserver.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 问题处理器映射表
|
||||
* @TableName question_handler_mapping
|
||||
*/
|
||||
@TableName(value ="question_handler_mapping")
|
||||
@Data
|
||||
public class QuestionHandlerMapping implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 问题分类id
|
||||
*/
|
||||
private String questionCategoryId;
|
||||
|
||||
/**
|
||||
* 处理器
|
||||
*/
|
||||
private String handler;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.supervision.pdfqaserver.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.supervision.pdfqaserver.config.VectorTypeHandler;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 文本向量表
|
||||
* @TableName text_vector
|
||||
*/
|
||||
@TableName(value ="text_vector", autoResultMap = true)
|
||||
@Data
|
||||
public class TextVector implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文本内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 向量值
|
||||
*/
|
||||
@TableField(typeHandler = VectorTypeHandler.class)
|
||||
private float[] embedding;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
private String categoryId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.supervision.pdfqaserver.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TextVectorDTO {
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
private double similarityScore;
|
||||
|
||||
/**
|
||||
* 文本内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
private String categoryId;
|
||||
|
||||
|
||||
/**
|
||||
* 向量值
|
||||
*/
|
||||
private float[] embedding;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.supervision.pdfqaserver.mapper;
|
||||
|
||||
import com.supervision.pdfqaserver.domain.QuestionCategoryIntention;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_category_intention(问题分类意图关联表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
* @Entity com.supervision.pdfqaserver.domain.QuestionCategoryIntention
|
||||
*/
|
||||
public interface QuestionCategoryIntentionMapper extends BaseMapper<QuestionCategoryIntention> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.supervision.pdfqaserver.mapper;
|
||||
|
||||
import com.supervision.pdfqaserver.domain.QuestionCategory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_category(问题分类表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
* @Entity com.supervision.pdfqaserver.domain.QuestionCategory
|
||||
*/
|
||||
public interface QuestionCategoryMapper extends BaseMapper<QuestionCategory> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.supervision.pdfqaserver.mapper;
|
||||
|
||||
import com.supervision.pdfqaserver.domain.QuestionHandlerMapping;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_handler_mapping(问题处理器映射表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
* @Entity com.supervision.pdfqaserver.domain.QuestionHandlerMapping
|
||||
*/
|
||||
public interface QuestionHandlerMappingMapper extends BaseMapper<QuestionHandlerMapping> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.supervision.pdfqaserver.mapper;
|
||||
|
||||
import com.supervision.pdfqaserver.domain.TextVector;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.supervision.pdfqaserver.dto.TextVectorDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【text_vector(文本向量表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-11 16:40:57
|
||||
* @Entity com.supervision.pdfqaserver.domain.TextVector
|
||||
*/
|
||||
public interface TextVectorMapper extends BaseMapper<TextVector> {
|
||||
|
||||
List<TextVectorDTO> findSimilarByCosine(@Param("embedding")float[] embedding, @Param("threshold") double threshold, @Param("limit")int limit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.supervision.pdfqaserver.service;
|
||||
|
||||
import com.supervision.pdfqaserver.domain.QuestionCategoryIntention;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_category_intention(问题分类意图关联表)】的数据库操作Service
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
*/
|
||||
public interface QuestionCategoryIntentionService extends IService<QuestionCategoryIntention> {
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.supervision.pdfqaserver.service;
|
||||
|
||||
import com.supervision.pdfqaserver.domain.QuestionCategory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_category(问题分类表)】的数据库操作Service
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
*/
|
||||
public interface QuestionCategoryService extends IService<QuestionCategory> {
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.supervision.pdfqaserver.service;
|
||||
|
||||
import com.supervision.pdfqaserver.domain.QuestionHandlerMapping;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_handler_mapping(问题处理器映射表)】的数据库操作Service
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
*/
|
||||
public interface QuestionHandlerMappingService extends IService<QuestionHandlerMapping> {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.supervision.pdfqaserver.service;
|
||||
|
||||
import com.supervision.pdfqaserver.domain.TextVector;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.supervision.pdfqaserver.dto.TextVectorDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【text_vector(文本向量表)】的数据库操作Service
|
||||
* @createDate 2025-06-11 16:40:57
|
||||
*/
|
||||
public interface TextVectorService extends IService<TextVector> {
|
||||
|
||||
List<TextVectorDTO> findSimilarByCosine(float[] embedding, double threshold , int limit);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.supervision.pdfqaserver.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.supervision.pdfqaserver.domain.QuestionCategoryIntention;
|
||||
import com.supervision.pdfqaserver.service.QuestionCategoryIntentionService;
|
||||
import com.supervision.pdfqaserver.mapper.QuestionCategoryIntentionMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_category_intention(问题分类意图关联表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
*/
|
||||
@Service
|
||||
public class QuestionCategoryIntentionServiceImpl extends ServiceImpl<QuestionCategoryIntentionMapper, QuestionCategoryIntention>
|
||||
implements QuestionCategoryIntentionService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.supervision.pdfqaserver.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.supervision.pdfqaserver.domain.QuestionCategory;
|
||||
import com.supervision.pdfqaserver.service.QuestionCategoryService;
|
||||
import com.supervision.pdfqaserver.mapper.QuestionCategoryMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_category(问题分类表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
*/
|
||||
@Service
|
||||
public class QuestionCategoryServiceImpl extends ServiceImpl<QuestionCategoryMapper, QuestionCategory>
|
||||
implements QuestionCategoryService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.supervision.pdfqaserver.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.supervision.pdfqaserver.domain.QuestionHandlerMapping;
|
||||
import com.supervision.pdfqaserver.service.QuestionHandlerMappingService;
|
||||
import com.supervision.pdfqaserver.mapper.QuestionHandlerMappingMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【question_handler_mapping(问题处理器映射表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-13 11:29:01
|
||||
*/
|
||||
@Service
|
||||
public class QuestionHandlerMappingServiceImpl extends ServiceImpl<QuestionHandlerMappingMapper, QuestionHandlerMapping>
|
||||
implements QuestionHandlerMappingService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.supervision.pdfqaserver.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.supervision.pdfqaserver.domain.TextVector;
|
||||
import com.supervision.pdfqaserver.dto.TextVectorDTO;
|
||||
import com.supervision.pdfqaserver.service.TextVectorService;
|
||||
import com.supervision.pdfqaserver.mapper.TextVectorMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【text_vector(文本向量表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-11 16:40:57
|
||||
*/
|
||||
@Service
|
||||
public class TextVectorServiceImpl extends ServiceImpl<TextVectorMapper, TextVector>
|
||||
implements TextVectorService{
|
||||
|
||||
@Override
|
||||
public List<TextVectorDTO> findSimilarByCosine(float[] embedding, double threshold , int limit) {
|
||||
return super.getBaseMapper().findSimilarByCosine(embedding, threshold,limit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.supervision.pdfqaserver.mapper.QuestionCategoryIntentionMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.supervision.pdfqaserver.domain.QuestionCategoryIntention">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="categoryId" column="category_id" jdbcType="VARCHAR"/>
|
||||
<result property="intentId" column="intent_id" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,category_id,intent_id,
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.supervision.pdfqaserver.mapper.QuestionCategoryMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.supervision.pdfqaserver.domain.QuestionCategory">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="categoryName" column="category_name" jdbcType="VARCHAR"/>
|
||||
<result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,category_name,parent_id,
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.supervision.pdfqaserver.mapper.QuestionHandlerMappingMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.supervision.pdfqaserver.domain.QuestionHandlerMapping">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="questionCategoryId" column="question_category_id" jdbcType="VARCHAR"/>
|
||||
<result property="handler" column="handler" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,question_category_id,handler,
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.supervision.pdfqaserver.mapper.TextVectorMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.supervision.pdfqaserver.domain.TextVector">
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="embedding" column="embedding" jdbcType="OTHER" typeHandler="com.supervision.pdfqaserver.config.VectorTypeHandler"/>
|
||||
<result property="categoryId" column="category_id" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,content,embedding,
|
||||
category_id,create_time,update_time
|
||||
</sql>
|
||||
<select id="findSimilarByCosine" resultType="com.supervision.pdfqaserver.dto.TextVectorDTO">
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
id,
|
||||
content,
|
||||
embedding,
|
||||
category_id,
|
||||
1 - (embedding <![CDATA[<=>]]> #{embedding, typeHandler=com.supervision.pdfqaserver.config.VectorTypeHandler}) AS similarityScore
|
||||
FROM text_vector
|
||||
) t
|
||||
WHERE t.similarityScore > #{threshold}
|
||||
ORDER BY t.similarityScore DESC
|
||||
LIMIT #{limit}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue