如何通过AWS CloudSearch使用结构化前缀运算符进行通配符搜索 [英] How to do wildcard search using structured prefix operator with AWS CloudSearch

查看:66
本文介绍了如何通过AWS CloudSearch使用结构化前缀运算符进行通配符搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在迁移到2013 Cloudsearch API(从2011 API开始).以前,我一直在搜索中使用通配符前缀,例如:

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.

我使用2013引擎创建了一个新的cloudsearch实例并对其进行了索引. bq 参数现在不见了,因此我必须将 q 参数与 q.parser = structured 参数一起使用才能获得相同的功能.当我这样查询时:

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?

我刚刚意识到,如果我使用2013 API对单词 firs 进行前缀搜索,则前缀搜索似乎可以正常工作.但是如果我在查询中有多个词,例如第一个secon ,然后前缀搜索不起作用.那么,如何使用结构化前缀运算符来完成此操作?

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?

推荐答案

您需要为每个单独的查询词指定前缀运算符,例如:

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

q =(或(前缀'firs')(前缀'secon'))& q.parser =结构化

这篇关于如何通过AWS CloudSearch使用结构化前缀运算符进行通配符搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆