|
@@ -311,6 +311,9 @@ var SR = strings.Replace
|
|
func MakeQuery(query, order, fileds string, start, limit int) string {
|
|
func MakeQuery(query, order, fileds string, start, limit int) string {
|
|
res := AnalyQuery(query, "", QStr)
|
|
res := AnalyQuery(query, "", QStr)
|
|
if len(res) > 10 {
|
|
if len(res) > 10 {
|
|
|
|
+ if strings.Contains(res, "###剑鱼###") {
|
|
|
|
+ res = strings.ReplaceAll(res, "###剑鱼###", "\\\"")
|
|
|
|
+ }
|
|
res = SR(SR(SR(SR(res, ",$and", "", -1), "$and", "", -1), ",$or", "", -1), "$or", "", -1)
|
|
res = SR(SR(SR(SR(res, ",$and", "", -1), "$and", "", -1), ",$or", "", -1), "$or", "", -1)
|
|
if len(fileds) > 0 {
|
|
if len(fileds) > 0 {
|
|
//"_source":["account_number","balance"]
|
|
//"_source":["account_number","balance"]
|
|
@@ -1108,7 +1111,7 @@ func GetByNgramAll(index, itype string, query interface{}, mustquery, findfields
|
|
if start > -1 {
|
|
if start > -1 {
|
|
qstr = qstr[:len(qstr)-1] + `,"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(limit) + "}"
|
|
qstr = qstr[:len(qstr)-1] + `,"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(limit) + "}"
|
|
}
|
|
}
|
|
- //log.Println("ngram-find", qstr)
|
|
|
|
|
|
+ log.Println("ngram-find", qstr)
|
|
return Get(index, itype, qstr)
|
|
return Get(index, itype, qstr)
|
|
} else {
|
|
} else {
|
|
return nil
|
|
return nil
|