feat: 支持FAQ两级优先级标签过滤
添加FAQ搜索支持两级优先级标签过滤功能,新增first_priority_tag_ids和second_priority_tag_ids字段,更新各检索器实现以支持按标签ID过滤,优化搜索结果排序确保优先级标签结果优先展示。
This commit is contained in:
@@ -21,6 +21,7 @@ type pgVector struct {
|
||||
ChunkID string `json:"chunk_id" gorm:"column:chunk_id"`
|
||||
KnowledgeID string `json:"knowledge_id" gorm:"column:knowledge_id"`
|
||||
KnowledgeBaseID string `json:"knowledge_base_id" gorm:"column:knowledge_base_id"`
|
||||
TagID string `json:"tag_id" gorm:"column:tag_id;index"`
|
||||
Content string `json:"content" gorm:"column:content;not null"`
|
||||
Dimension int `json:"dimension" gorm:"column:dimension;not null"`
|
||||
Embedding pgvector.HalfVector `json:"embedding" gorm:"column:embedding;not null"`
|
||||
@@ -37,6 +38,7 @@ type pgVectorWithScore struct {
|
||||
ChunkID string `json:"chunk_id" gorm:"column:chunk_id"`
|
||||
KnowledgeID string `json:"knowledge_id" gorm:"column:knowledge_id"`
|
||||
KnowledgeBaseID string `json:"knowledge_base_id" gorm:"column:knowledge_base_id"`
|
||||
TagID string `json:"tag_id" gorm:"column:tag_id;index"`
|
||||
Content string `json:"content" gorm:"column:content;not null"`
|
||||
Dimension int `json:"dimension" gorm:"column:dimension;not null"`
|
||||
Embedding pgvector.HalfVector `json:"embedding" gorm:"column:embedding;not null"`
|
||||
@@ -62,6 +64,7 @@ func toDBVectorEmbedding(indexInfo *types.IndexInfo, additionalParams map[string
|
||||
ChunkID: indexInfo.ChunkID,
|
||||
KnowledgeID: indexInfo.KnowledgeID,
|
||||
KnowledgeBaseID: indexInfo.KnowledgeBaseID,
|
||||
TagID: indexInfo.TagID,
|
||||
Content: common.CleanInvalidUTF8(indexInfo.Content),
|
||||
IsEnabled: true, // Default to enabled
|
||||
}
|
||||
@@ -92,6 +95,7 @@ func fromDBVectorEmbeddingWithScore(embedding *pgVectorWithScore, matchType type
|
||||
ChunkID: embedding.ChunkID,
|
||||
KnowledgeID: embedding.KnowledgeID,
|
||||
KnowledgeBaseID: embedding.KnowledgeBaseID,
|
||||
TagID: embedding.TagID,
|
||||
Content: embedding.Content,
|
||||
Score: embedding.Score,
|
||||
MatchType: matchType,
|
||||
|
||||
Reference in New Issue
Block a user