精确搜索
This commit is contained in:
		@@ -462,13 +462,11 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
				
			|||||||
				if args.Text != "" {
 | 
									if args.Text != "" {
 | 
				
			||||||
					resp, err := models.ZincSearch(map[string]interface{}{
 | 
										resp, err := models.ZincSearch(map[string]interface{}{
 | 
				
			||||||
						"query": map[string]interface{}{
 | 
											"query": map[string]interface{}{
 | 
				
			||||||
							//"term": map[string]interface{}{
 | 
					 | 
				
			||||||
							//	"text": args.Text,
 | 
					 | 
				
			||||||
							//},
 | 
					 | 
				
			||||||
							"bool": map[string]interface{}{
 | 
												"bool": map[string]interface{}{
 | 
				
			||||||
								"must": []map[string]interface{}{
 | 
													"must": []map[string]interface{}{
 | 
				
			||||||
									{
 | 
														{
 | 
				
			||||||
										"query_string": map[string]string{"query": "text:" + args.Text},
 | 
															//"query_string": map[string]string{"query": "text:" + args.Text},
 | 
				
			||||||
 | 
															"match_phrase": map[string]string{"text": args.Text},
 | 
				
			||||||
									},
 | 
														},
 | 
				
			||||||
								},
 | 
													},
 | 
				
			||||||
							},
 | 
												},
 | 
				
			||||||
@@ -476,8 +474,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
				
			|||||||
						"sort": []string{
 | 
											"sort": []string{
 | 
				
			||||||
							"_score",
 | 
												"_score",
 | 
				
			||||||
						},
 | 
											},
 | 
				
			||||||
						"from": 0,
 | 
											//"from": 0,
 | 
				
			||||||
						"size": 200,
 | 
											"size": 1000,
 | 
				
			||||||
					})
 | 
										})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if err != nil {
 | 
										if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user