mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 14:36:47 +00:00
[improvement](chat) support query/search filter by web domainId and mapping add frequency/detectWord in mapping and metric dimensions orders filter duplicates
This commit is contained in:
@@ -11,11 +11,11 @@ class HanlpSchemaMapperTest extends ContextTest {
|
||||
|
||||
@Test
|
||||
void map() {
|
||||
QueryContextReq searchCtx = new QueryContextReq();
|
||||
searchCtx.setChatId(1);
|
||||
searchCtx.setDomainId(2);
|
||||
searchCtx.setQueryText("supersonic按部门访问次数");
|
||||
QueryContextReq queryContext = new QueryContextReq();
|
||||
queryContext.setChatId(1);
|
||||
queryContext.setDomainId(2);
|
||||
queryContext.setQueryText("supersonic按部门访问次数");
|
||||
HanlpSchemaMapper hanlpSchemaMapper = new HanlpSchemaMapper();
|
||||
hanlpSchemaMapper.map(searchCtx);
|
||||
hanlpSchemaMapper.map(queryContext);
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,14 @@ class TimeSemanticParserTest {
|
||||
void parse() {
|
||||
TimeSemanticParser timeSemanticParser = new TimeSemanticParser();
|
||||
|
||||
QueryContextReq searchCtx = new QueryContextReq();
|
||||
QueryContextReq queryContext = new QueryContextReq();
|
||||
ChatContext chatCtx = new ChatContext();
|
||||
SchemaMapInfo schemaMap = new SchemaMapInfo();
|
||||
searchCtx.setQueryText("supersonic最近30天访问次数");
|
||||
queryContext.setQueryText("supersonic最近30天访问次数");
|
||||
|
||||
boolean parse = timeSemanticParser.parse(searchCtx, chatCtx);
|
||||
boolean parse = timeSemanticParser.parse(queryContext, chatCtx);
|
||||
|
||||
DateConf dateInfo = searchCtx.getParseInfo().getDateInfo();
|
||||
DateConf dateInfo = queryContext.getParseInfo().getDateInfo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,9 @@ import com.tencent.supersonic.common.enums.AggregateTypeEnum;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.common.pojo.SchemaItem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
|
||||
public class SemanticParseObjectHelper {
|
||||
@@ -29,9 +31,9 @@ public class SemanticParseObjectHelper {
|
||||
|
||||
private static SemanticParseInfo getSemanticParseInfo(SemanticParseJson semanticParseJson) {
|
||||
Long domain = semanticParseJson.getDomain();
|
||||
List<SchemaItem> dimensionList = new ArrayList<>();
|
||||
List<SchemaItem> metricList = new ArrayList<>();
|
||||
List<Filter> chatFilters = new ArrayList<>();
|
||||
Set<SchemaItem> dimensionList = new LinkedHashSet();
|
||||
Set<SchemaItem> metricList = new LinkedHashSet();
|
||||
Set<Filter> chatFilters = new LinkedHashSet();
|
||||
|
||||
if (semanticParseJson.getFilter() != null && semanticParseJson.getFilter().size() > 0) {
|
||||
for (List<String> filter : semanticParseJson.getFilter()) {
|
||||
|
||||
Reference in New Issue
Block a user