mirror of https://gitee.com/answerdev/answer.git
fix: search, question add title search
This commit is contained in:
parent
158abbef42
commit
53910b80ab
|
@ -2150,7 +2150,7 @@ const docTemplate = `{
|
|||
}
|
||||
},
|
||||
"/answer/api/v1/question/page": {
|
||||
"post": {
|
||||
"get": {
|
||||
"description": "SearchQuestionList \u003cbr\u003e \"order\" Enums(newest, active,frequent,score,unanswered)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
|
|
|
@ -2138,7 +2138,7 @@
|
|||
}
|
||||
},
|
||||
"/answer/api/v1/question/page": {
|
||||
"post": {
|
||||
"get": {
|
||||
"description": "SearchQuestionList \u003cbr\u003e \"order\" Enums(newest, active,frequent,score,unanswered)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
|
|
|
@ -2656,7 +2656,7 @@ paths:
|
|||
tags:
|
||||
- api-question
|
||||
/answer/api/v1/question/page:
|
||||
post:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: SearchQuestionList <br> "order" Enums(newest, active,frequent,score,unanswered)
|
||||
|
|
|
@ -70,7 +70,8 @@ func (sr *searchRepo) SearchContents(ctx context.Context, words []string, tagID,
|
|||
|
||||
for i, word := range words {
|
||||
if i == 0 {
|
||||
b.Where(builder.Like{"original_text", word})
|
||||
b.Where(builder.Like{"title", word}).
|
||||
Or(builder.Like{"original_text", word})
|
||||
ub.Where(builder.Like{"`answer`.original_text", word})
|
||||
} else {
|
||||
b.Or(builder.Like{"original_text", word})
|
||||
|
@ -137,7 +138,8 @@ func (sr *searchRepo) SearchQuestions(ctx context.Context, words []string, limit
|
|||
|
||||
for i, word := range words {
|
||||
if i == 0 {
|
||||
b.Where(builder.Like{"original_text", word})
|
||||
b.Where(builder.Like{"title", word}).
|
||||
Or(builder.Like{"original_text", word})
|
||||
} else {
|
||||
b.Or(builder.Like{"original_text", word})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue