mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +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:
@@ -1,6 +1,7 @@
|
||||
package com.tencent.supersonic.chat.api.pojo;
|
||||
|
||||
import com.tencent.supersonic.semantic.api.query.enums.FilterOperatorEnum;
|
||||
import java.util.Objects;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@@ -17,4 +18,23 @@ public class Filter {
|
||||
private Object value;
|
||||
|
||||
private Long elementID;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Filter filter = (Filter) o;
|
||||
return Objects.equals(bizName, filter.bizName) && Objects.equals(name, filter.name)
|
||||
&& operator == filter.operator && Objects.equals(value, filter.value) && Objects.equals(
|
||||
elementID, filter.elementID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(bizName, name, operator, value, elementID);
|
||||
}
|
||||
}
|
||||
@@ -8,17 +8,17 @@ import lombok.ToString;
|
||||
public class SchemaElementMatch {
|
||||
|
||||
SchemaElementType elementType;
|
||||
|
||||
int elementID;
|
||||
|
||||
double similarity;
|
||||
|
||||
String detectWord;
|
||||
|
||||
String word;
|
||||
|
||||
Long frequency;
|
||||
|
||||
public SchemaElementMatch() {
|
||||
}
|
||||
|
||||
public SchemaElementMatch(SchemaElementType schemaElementType, int elementID, double similarity, String word) {
|
||||
this.elementID = elementID;
|
||||
this.elementType = schemaElementType;
|
||||
this.similarity = similarity;
|
||||
this.word = word;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,8 @@ public class SchemaMapInfo {
|
||||
domainElementMatches.put(domain, elementMatches);
|
||||
}
|
||||
|
||||
public void setDomainElementMatches(
|
||||
Map<Integer, List<SchemaElementMatch>> domainElementMatches) {
|
||||
this.domainElementMatches = domainElementMatches;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.common.pojo.Order;
|
||||
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;
|
||||
|
||||
@Data
|
||||
@@ -17,11 +19,11 @@ public class SemanticParseInfo {
|
||||
Long domainId = 0L;
|
||||
String domainName;
|
||||
Long entity = 0L;
|
||||
List<SchemaItem> metrics = new ArrayList<>();
|
||||
List<SchemaItem> dimensions = new ArrayList<>();
|
||||
List<Filter> dimensionFilters = new ArrayList<>();
|
||||
List<Filter> metricFilters = new ArrayList<>();
|
||||
private List<Order> orders = new ArrayList<>();
|
||||
Set<SchemaItem> metrics = new LinkedHashSet();
|
||||
Set<SchemaItem> dimensions = new LinkedHashSet();
|
||||
Set<Filter> dimensionFilters = new LinkedHashSet();
|
||||
Set<Filter> metricFilters = new LinkedHashSet();
|
||||
private Set<Order> orders = new LinkedHashSet();
|
||||
private DateConf dateInfo;
|
||||
private Long limit;
|
||||
private Boolean nativeQuery = false;
|
||||
|
||||
@@ -11,5 +11,5 @@ import com.tencent.supersonic.chat.api.request.QueryContextReq;
|
||||
*/
|
||||
public interface SchemaMapper {
|
||||
|
||||
void map(QueryContextReq searchCtx);
|
||||
void map(QueryContextReq queryContext);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user