问题
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