【问题标题】:Escape colon in a Scorched/Sunburnt/Solr search在 Scorched/Sunburnt/Solr 搜索中转义冒号
【发布时间】:2021-04-08 14:51:39
【问题描述】:

我正在使用 scorched 将我的 Django 代码与我的 Solr 实例接口:

response = si.query(DismaxString(querydict.get('q')).execute()

在我正在搜索的数据中,我有冒号(例如 Col: Mackay's Reel),我不希望 Solr 将该冒号解释为“字段”查询:

   "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"undefined field Col"

如何转义用户在查询中输入的所有冒号?

即使直接在 Solr 查询界面上,我也会收到错误消息。

【问题讨论】:

    标签: django solr sunburnt


    【解决方案1】:

    目前我的解决方法是在发送表单之前通过 JavaScript 为每个冒号添加一个反斜杠,以便冒号作为“:”发送。

    【讨论】:

      猜你喜欢
      • 2016-01-12
      • 2018-11-07
      • 2016-11-03
      • 2013-01-30
      • 1970-01-01
      • 2015-12-09
      • 2017-06-04
      • 2015-08-21
      • 1970-01-01
      相关资源
      最近更新 更多