renzheng 8 years ago
parent
commit
9ed8d2a00e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      common/src/qfw/util/elastic/elasticutil.go

+ 2 - 1
common/src/qfw/util/elastic/elasticutil.go

@@ -1128,6 +1128,7 @@ func GetResForJY(index, itype string, keys []KeyConfig, allquery, findfields, So
 	if len(keys) > 0 {
 	if len(keys) > 0 {
 		qstr := ""
 		qstr := ""
 		new_minq := fmt.Sprintf(minq, "%s", findfields)
 		new_minq := fmt.Sprintf(minq, "%s", findfields)
+		not_new_minq := fmt.Sprintf(minq, "%s", `"title"`) //排除词只查询标题
 		musts := []string{}
 		musts := []string{}
 		for _, qs_words := range keys {
 		for _, qs_words := range keys {
 			mq := []string{}
 			mq := []string{}
@@ -1136,7 +1137,7 @@ func GetResForJY(index, itype string, keys []KeyConfig, allquery, findfields, So
 				mq = append(mq, fmt.Sprintf(new_minq, ReplaceYH(qs_word)))
 				mq = append(mq, fmt.Sprintf(new_minq, ReplaceYH(qs_word)))
 			}
 			}
 			for _, qs_word := range qs_words.NotKeys {
 			for _, qs_word := range qs_words.NotKeys {
-				notmq = append(notmq, fmt.Sprintf(new_minq, ReplaceYH(qs_word)))
+				notmq = append(notmq, fmt.Sprintf(not_new_minq, ReplaceYH(qs_word)))
 			}
 			}
 			if len(qs_words.Areas) > 0 {
 			if len(qs_words.Areas) > 0 {
 				mq = append(mq, fmt.Sprintf(`{"terms":{"area":["%s"]}}`, strings.Join(qs_words.Areas, `","`)))
 				mq = append(mq, fmt.Sprintf(`{"terms":{"area":["%s"]}}`, strings.Join(qs_words.Areas, `","`)))