Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

chore(types): add internal only ContentRevision to types.SearchResult

MidoriKuragee2a75db67f74
diff --git a/internal/application/service/chat_pipeline/search_entity.go b/internal/application/service/chat_pipeline/search_entity.go
index 90415e3ae..85cecd40b 100644
--- a/internal/application/service/chat_pipeline/search_entity.go
+++ b/internal/application/service/chat_pipeline/search_entity.go
@@ -211,6 +211,7 @@ func chunk2SearchResult(chunk *types.Chunk, knowledge *types.Knowledge) *types.S
return &types.SearchResult{
ID: chunk.ID,
Content: chunk.Content,
+ ContentRevision: chunk.ContentRevision,
KnowledgeID: chunk.KnowledgeID,
ChunkIndex: chunk.ChunkIndex,
KnowledgeTitle: knowledge.Title,
diff --git a/internal/application/service/knowledgebase_search_results.go b/internal/application/service/knowledgebase_search_results.go
index 9c8e068c1..549479bd9 100644
--- a/internal/application/service/knowledgebase_search_results.go
+++ b/internal/application/service/knowledgebase_search_results.go
@@ -309,6 +309,7 @@ func (s *knowledgeBaseService) buildSearchResult(chunk *types.Chunk,
return &types.SearchResult{
ID: chunk.ID,
Content: chunk.Content,
+ ContentRevision: chunk.ContentRevision,
KnowledgeID: chunk.KnowledgeID,
ChunkIndex: chunk.ChunkIndex,
KnowledgeTitle: knowledge.Title,
diff --git a/internal/types/search.go b/internal/types/search.go
index e9009beac..2f7d9ab12 100644
--- a/internal/types/search.go
+++ b/internal/types/search.go
@@ -207,6 +207,11 @@ type SearchResult struct {
// KnowledgeBaseID is the ID of the knowledge base this result belongs to
KnowledgeBaseID string `json:"knowledge_base_id,omitempty"`
+
+ // ContentRevision is the chunk edit revision at retrieval time.
+ // Internal only: used by the merge pipeline to decide whether source
+ // coordinates are still trustworthy.
+ ContentRevision int `json:"-"`
}
// SearchParams represents the search parameters