索引服务查询语言返回的项目多于预期
我们使用索引服务查询语言(又名方言 2) 和以下查询,
@TaxCategory "\Areas\Technology\" AND @XmlConfigId = 14
它意外地匹配以下两项,而不仅仅是第一项:
Technology
Technology, Media & Entertainment
我们预计结尾斜杠会将搜索限制为仅该项;然而,它似乎会抓取字符串开头具有给定文本的任何内容。
我们如何编写查询来独立定位第一个和第二个项目?
更新: 索引服务实际索引的内容分别是:
<ekttaxcategory>#eksep# \Areas\Technology #eksep#</ekttaxcategory>
和
<ekttaxcategory>#eksep# \Areas\Technology, Media & Entertainment#eksep#</ekttaxcategory>
。
We're using Indexing Service Query Language (a.k.a. Dialect 2) and the following query,
@TaxCategory "\Areas\Technology\" AND @XmlConfigId = 14
it unexpectedly matches the following two items instead of just the first:
Technology
Technology, Media & Entertainment
We expected the ending slash would constrain the search to just that item; however it appears to grab anything having the given text at the beginning of the string.
How do we write queries to target the first and second items independently?
Update: The content actually indexed by indexing service is this:
<ekttaxcategory>#eksep# \Areas\Technology #eksep#</ekttaxcategory>
and
<ekttaxcategory>#eksep# \Areas\Technology, Media & Entertainment#eksep#</ekttaxcategory>
respectively.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于子字符串
#eksep#
始终出现在我们要查找的内容的末尾,请参阅问题中索引项的示例,我们最终使用此查询解决了问题:我们还考虑使用 <查询中的 href="http://msdn.microsoft.com/en-us/library/ms690430%28v=VS.85%29.aspx" rel="nofollow">UNIX 样式模式匹配句点
.
作为字符串终止符,但在上述查询工作后永远不需要尝试。如果其他人使用不同的方式或模式匹配解决了类似的问题,请使用示例查询发布另一个答案。谢谢。
Because the substring
#eksep#
always appears at the end of what we're seeking, seen the example of indexed items in the question, we ended up solving the issue using this query:We also considered using UNIX style pattern matching in the query and the period
.
as a string terminator, but never needed to try that after the above query worked.If somebody else solves a similar problem using a different way or with pattern matching, please post another answer with sample query. Thanks.