【发布时间】:2017-12-28 07:59:41
【问题描述】:
我正在将 Amazon Cloudsearch 与 API Gateway 集成。一切正常,除非我尝试进行结构化查询短语搜索。
我在 Cloudsearch 测试搜索中使用此语法:(phrase field=title 'search'),效果很好。我查看了他们的 JSON,他们这样发送:
CloudSearchAPI/search?q=(phrase+field%3Dcontent+'search')&q.parser=structured
我的 API 与 Cloudsearch http 端点集成以匹配该格式,但是当我尝试执行完全相同的查询时,我收到以下错误
APIURL/(phrase+field%3Dcontent+'search')&q.parser%3Dstructured
[已弃用:使用外部消息字段]
就好像“=”符号在发送到 cloudsearch 端点之前被解码。有没有人知道如何克服这个问题?
另外,我正在使用 javascript 来发送 AJAX 请求。这是我对短语搜索进行编码的方式:
encodeURIComponent("(phrase field=content '" + term + "')") //turns in to: phrase%20field%3Dcontent%20'search'
如果我不包含 field=content 部分,它会起作用
谢谢!
【问题讨论】:
-
这是 HTTP 还是 HTTP_PROXY 集成?
-
这是http集成
-
好的,您在 API Gateway 中将“q.parser”定义为查询字符串参数,对吧?另外,你能澄清一下
APIURL/(phrase+field%3Dcontent+'search')&q.parser%3Dstructured是否真的是APIURL/?q=(phrase+field%3Dcontent+'search')&q.parser%3Dstructured
标签: json amazon-web-services aws-api-gateway urlencode amazon-cloudsearch