How to do wildcard search using structured prefix operator with AWS CloudSearch

☆樱花仙子☆ 提交于 2019-12-12 22:16:30

问题


I've currently migrating to the 2013 Cloudsearch API (from the 2011 API). Previously, I had been using a wildcard prefix with my searches, like this:

bq=(and 'first secon*')  

My queries sometimes include facet options, which is why I use the boolean query syntax and not the simple version.

I've created a new cloudsearch instance using the 2013 engine and indexed it. The bq parameter is gone now, so I have to use the q parameter with the q.parser=structured parameter to get the same functionality. When I query with something like this:

q.parser=simple&q=first secon*

...I get back a load of results. But when I query with this:

q.parser=structured&q=(prefix 'first secon')

...I get no hits. I don't get an error, just no results found. Am I doing something wrong?

I've just realized that if I do a prefix search for the word firs with the 2013 API, the prefix search seems to be working. But if I have any more than a single term in the query e.g. first secon then the prefix search does not work. So how is this accomplished using the structured prefix operator?


回答1:


You need to specify the prefix operator for each separate query term, eg:

q=(or (prefix 'firs') (prefix 'secon'))&q.parser=structured



来源:https://stackoverflow.com/questions/31970512/how-to-do-wildcard-search-using-structured-prefix-operator-with-aws-cloudsearch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!