feat: 实体召回支持模糊匹配
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -20,6 +20,7 @@ spring-*/src/main/java/META-INF/MANIFEST.MF
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea
|
||||
.smarttomcat
|
||||
out
|
||||
test-output
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
import static com.shuwen.data.entity.manage.common.entity.constant.GraphConstants.SearchMode.COMPLEX;
|
||||
import static com.shuwen.data.entity.manage.service.chat.utils.RelationRephraseUtils.SNOWFLAKE_EXTEND_REL;
|
||||
|
||||
/**
|
||||
@@ -75,6 +76,7 @@ public class GraphChatRetrievalService {
|
||||
searchDto.setQueryString(queryString);
|
||||
if (StringUtils.isNotEmpty(query)) {
|
||||
searchDto.setQuery(query);
|
||||
searchDto.setMode(COMPLEX);
|
||||
}
|
||||
searchDto.setSize(size);
|
||||
Set<String> extFields = new HashSet<>();
|
||||
|
||||
@@ -722,15 +722,20 @@ public class GraphChatService implements IGraphChatService {
|
||||
return;
|
||||
}
|
||||
//获取多个重名的
|
||||
String query = "";
|
||||
String query = slots.getSubject();
|
||||
String queryString = "";
|
||||
if (AwardUtils.isAward(slots.getSubject())) {
|
||||
query = slots.getSubject();
|
||||
} else {
|
||||
queryString = "(name:" + slots.getSubject() + " OR alias:" + slots.getSubject() + ") AND summary:*";
|
||||
if (slots.getSubject().contains(":") || slots.getSubject().contains(":")) {
|
||||
queryString = "(name:" + "\"" + slots.getSubject() + "\"" + " OR alias:" + "\"" + slots.getSubject() + "\"" + ") AND summary:*";
|
||||
}
|
||||
// if (AwardUtils.isAward(slots.getSubject())) {
|
||||
// query = slots.getSubject();
|
||||
// } else {
|
||||
// queryString = "(name:" + slots.getSubject() + " OR alias:" + slots.getSubject() + ") AND summary:*";
|
||||
// if (slots.getSubject().contains(":") || slots.getSubject().contains(":")) {
|
||||
// queryString = "(name:" + "\"" + slots.getSubject() + "\"" + " OR alias:" + "\"" + slots.getSubject() + "\"" + ") AND summary:*";
|
||||
// }
|
||||
// queryString = "summary:*";
|
||||
// }
|
||||
//奖项信息不在summary中
|
||||
if (!AwardUtils.isAward(slots.getSubject())) {
|
||||
queryString = "summary:*";
|
||||
}
|
||||
if (slots.getSubjectType().equals("creative_work")) {
|
||||
restrict = "";
|
||||
|
||||
Reference in New Issue
Block a user