Merge branch 'feat/backyard-search' into 'main'

Feat/backyard search

See merge request opensource/answer!152
This commit is contained in:
杨光富 2022-11-01 09:30:41 +00:00
commit aa9ba8a3f6
3 changed files with 6 additions and 6 deletions

View File

@ -234,9 +234,9 @@ func (ar *answerRepo) CmsSearchList(ctx context.Context, search *entity.CmsAnswe
id = ""
)
if strings.Contains(search.Query, "id:") {
if strings.Contains(search.Query, "answer:") {
idSearch = true
id = strings.TrimSpace(strings.TrimPrefix(search.Query, "id:"))
id = strings.TrimSpace(strings.TrimPrefix(search.Query, "answer:"))
for _, r := range id {
if !unicode.IsDigit(r) {
idSearch = false

View File

@ -256,9 +256,9 @@ func (qr *questionRepo) CmsSearchList(ctx context.Context, search *schema.CmsQue
idSearch = false
id = ""
)
if strings.Contains(search.Query, "id:") {
if strings.Contains(search.Query, "question:") {
idSearch = true
id = strings.TrimSpace(strings.TrimPrefix(search.Query, "id:"))
id = strings.TrimSpace(strings.TrimPrefix(search.Query, "question:"))
for _, r := range id {
if !unicode.IsDigit(r) {
idSearch = false

View File

@ -95,9 +95,9 @@ func (ur *userBackyardRepo) GetUserPage(ctx context.Context, page, pageSize int,
id = ""
)
if strings.Contains(query, "id:") {
if strings.Contains(query, "user:") {
idSearch = true
id = strings.TrimSpace(strings.TrimPrefix(query, "id:"))
id = strings.TrimSpace(strings.TrimPrefix(query, "user:"))
for _, r := range id {
if !unicode.IsDigit(r) {
idSearch = false