Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat: add question_id to search result

kumfo1b242a182c21
diff --git a/docs/docs.go b/docs/docs.go
index 8bba4a20..1d83ff74 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -5714,6 +5714,9 @@ const docTemplate = `{
"id": {
"type": "string"
},
+ "question_id": {
+ "type": "string"
+ },
"status": {
"description": "Status",
"type": "string"
diff --git a/docs/swagger.json b/docs/swagger.json
index 4439bf32..02eef704 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -5702,6 +5702,9 @@
"id": {
"type": "string"
},
+ "question_id": {
+ "type": "string"
+ },
"status": {
"description": "Status",
"type": "string"
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index ddc1f8a3..f55c3f47 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1025,6 +1025,8 @@ definitions:
type: string
id:
type: string
+ question_id:
+ type: string
status:
description: Status
type: string
diff --git a/internal/repo/search_common/search_repo.go b/internal/repo/search_common/search_repo.go
index 1157b6bd..cc055677 100644
--- a/internal/repo/search_common/search_repo.go
+++ b/internal/repo/search_common/search_repo.go
@@ -450,6 +450,7 @@ func (sr *searchRepo) parseResult(ctx context.Context, res []map[string][]byte)
object = schema.SearchObject{
ID: string(r["id"]),
+ QuestionID: string(r["question_id"]),
Title: string(r["title"]),
Excerpt: htmltext.FetchExcerpt(string(r["parsed_text"]), "...", 240),
CreatedAtParsed: tp.Unix(),
diff --git a/internal/schema/search_schema.go b/internal/schema/search_schema.go
index 143a93c1..5f40046e 100644
--- a/internal/schema/search_schema.go
+++ b/internal/schema/search_schema.go
@@ -10,6 +10,7 @@ type SearchDTO struct {
type SearchObject struct {
ID string `json:"id"`
+ QuestionID string `json:"question_id"`
Title string `json:"title"`
Excerpt string `json:"excerpt"`
CreatedAtParsed int64 `json:"created_at"`