Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.3.2^2
zouap 4 years ago
parent
commit
0eef74dd60
1 changed files with 19 additions and 2 deletions
  1. +19
    -2
      routers/search.go

+ 19
- 2
routers/search.go View File

@@ -251,10 +251,9 @@ func dealLongText(text string, Key string, MatchedQueries []string) string {
}

textRune := []rune(text)
textRuneStr := string(textRune)
stringlen := len(textRune)
if isNeedToDealText && stringlen > 200 {
index := strings.Index(textRuneStr, "color=")
index := chineseIndex(textRune, []rune("color="))
if index > 0 {
start := index - 50
if start < 0 {
@@ -278,6 +277,24 @@ func dealLongText(text string, Key string, MatchedQueries []string) string {

}

func chineseIndex(text []rune, childText []rune) int {
for i, v := range text {
if v == childText[0] {
re := true
for j, k := range childText {
if k != text[i+j] {
re = false
break
}
}
if re {
return i
}
}
}
return -1
}

func searchUserOrOrg(ctx *context.Context, TableName string, Key string, Page int, PageSize int, IsQueryUser bool, OnlyReturnNum bool) {
/*
用户或者组织 ES名称: user-es-index


Loading…
Cancel
Save