扩展Dismax查询解析器避免使用单个空格替换多个空格

时间:2016-02-23 11:21:00

标签: solr edismax

我在设置中使用Extended Dismax Query解析器。我正在运行以下查询以获取与某个公司相关的文档

_query_:"{!edismax qf='company' q.op='OR'}(\"the procter  & gamble company\")"

对于我们的索引逻辑的某些问题,我们在此公司名称中有多个空格 the procter&赌博公司

当我运行上面的查询时,它没有给出任何结果,因为edismax解析器正在用单个空格替换多个空格。以下是调试输出的片段

"rawquerystring": "_query_:\"{!edismax qf='company' q.op='OR'}(\\\"the procter  & gamble company\\\")\"",
    "querystring": "_query_:\"{!edismax qf='company' q.op='OR'}(\\\"the procter  & gamble company\\\")\"",
    "parsedquery": "(+DisjunctionMaxQuery((company:the procter & gamble company)))/no_coord",
    "parsedquery_toString": "+(company:the procter & gamble company)",
    "QParser": "LuceneQParser",
    "explain": {}

我对字段公司使用filetype作为 lower_string 。以下是分析仪的定义。

<fieldType name="lower_string" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.KeywordTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.KeywordTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

有关如何告诉edisMax解析器不要替换多个空格的任何建议?

0 个答案:

没有答案
相关问题