【问题标题】:Azure Search throwing an error when an apostrophe is included包含撇号时 Azure 搜索引发错误
【发布时间】:2019-10-30 01:44:37
【问题描述】:

执行包含撇号的 Azure 搜索时 - 在本例中为 l'expedition - Azure 会引发错误,

  "Invalid expression: ')' or ',' expected at position 53 in '((search.ismatchscoring('navigation_title_s:(/.*\\\"l\\'expedition\\\".*/)',null, 'full', null))))'.\r\nParameter name: $filter"

这是正在生成的搜索:

$filter=((search.ismatchscoring('navigation_title_s:(/.*\"l\'expedition\".*/)',null, 'full', null)))

感谢您的帮助!

【问题讨论】:

    标签: azure-cognitive-search


    【解决方案1】:

    您可以通过将单引号加倍来转义 OData 中的单引号。在你的情况下:

    $filter=((search.ismatchscoring('navigation_title_s:(/.*\"l''expedition\".*/)',null, 'full', null)))

    会起作用的。

    【讨论】:

    • 谢谢,这最终是答案。不幸的是,这是在 Sitecore 内部的某个地方构建的。此时正则表达式正在我们代码控制之外的某个地方转义......
    • @Giallo 在这种情况下,这是 Sitecore 中的一个错误。如果您还没有,请向他们报告。
    猜你喜欢
    • 2018-12-30
    • 1970-01-01
    • 2011-04-21
    • 1970-01-01
    • 1970-01-01
    • 2014-03-29
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    相关资源
    最近更新 更多