或者在Solr中查询不起作用

时间:2012-09-19 11:11:47

标签: solr

我的Solr服务器似乎只使用AND而不是OR,例如。

/solr/select?q=(marsden AND emma)&qt=yodl_handler works, but 
/solr/select?q=(marsden OR mackey)&qt=yodl_handler doesn't.

对于每个单独的查询,它会返回resutls,例如

/solr/select?q=marsden&qt=yodl_handler returns 2 results
/solr/select?q=mackey&qt=yodl_handler returns 3 results

任何建议都表示赞赏!

以下是yodl_handler的定义:

<requestHandler name="yodl_handler" class="solr.DisMaxRequestHandler">
    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <float name="tie">0.01</float>
      <str name="qf">
        dc.title^1 dc3.title^1 dc.type^1 vra2.logical.creator^1 vra2.image.agent.name^1 vra2.image.agent.role^1 vra2.image.agent.role^1 vra2.image.location.name^1 vra2.image.rights.rightsholder^1 vra2.image.source.refid^1 vra2.image.title^1 vra2.image.worktype^1 vra2.work.agent.attribution^1 vra2.work.agent.name^1 vra2.work.agent.role^1 vra2.work.culturalContext^1 vra2.work.description^1 vra2.work.location-type^1 vra2.logical.location.place^1 vra2.logical.location.name^1 vra2.work.location.refid^1 vra2.work.material^1 vra2.work.rights.rightsHolder^1 vra2.work.StylePeriod^1 vra2.work.subject.term.name^1 vra2.work.subject.term.place^1 vra2.work.subject.term.keyword^1 vra2.work.technique^1 vra2.work.title^1 vra2.work.worktype^1 iris2.instrument.instrumentType^1 iris2.instrument.primaryInstrumentType^1 iris2.instrument.secondaryInstrumentType^1 iris2.instrument.instrumentType.alltypes^1 iris2.instrument.author^1 iris2.references.allauthors^1 iris2.instrument.researchArea^1 iris2.instrument.typeOfFile^1 iris2.instrument.software^1 iris2.instrument.dataType^1 iris2.instrument.linguisticTarget^1 iris2.instrument.sourceLanguage^1 iris2.instrument.funder^1 iris2.instrument.licence^1 iris2.participants.participantType^1 iris2.participants.firstLanguage^1 iris2.participants.targetLanguage^1 iris2.participants.gender^1 iris2.participants.proficiencyLearner^1 iris2.participants.proficiencyStudentsTaught^1 iris2.participants.yearsOfTeachingExperience^1 iris2.participants.domainOfUse^1 iris2.references.publicationType^1 iris2.references.author^1 iris2.references.author.lastnames^1 iris2.references.booktitle^1 iris2.references.journal^1 iris2.references.publicationDate^1 iris2.references.publicationLatestDate^1 iris2.references.publisher^1 iris2.references.placeOfPublication^1 iris2.references.editor^1 iris2.references.conferenceName^1
      </str>
      <int name="ps">100</int>
      <str name="q.alt">*:*</str>
      <str name="hl.fl">text features name</str>
      <str name="f.name.hl.fragsize">0</str>
      <str name="f.name.hl.alternateField">name</str>
      <str name="f.text.hl.fragmenter">regex</str>
    </lst>
</requestHandler>

1 个答案:

答案 0 :(得分:1)

简单的答案是,Solr DisMax查询解析器在查询中不支持布尔逻辑。使用涉及“AND”的查询的外观可能是您的字段被索引(停用词?)或出现在基础数据中的方式的副作用。

如果你发送debugQuery参数,你可以更好地了解发生在幕后的情况,例如:

  

/ solr / select?q =(marsden AND emma)&amp; qt = yodl_handler&amp; debugQuery = true

关于Dismax解析器的Solr wiki还有其他文档:

  

Dismax查询解析器支持Lucene QueryParser语法的极简化子集。引号可用于对短语进行分组,+ / - 可用于表示强制和可选子句......但所有其他Lucene查询解析器特殊字符都被转义以简化用户体验。 (见DisMaxQParserPlugin

好消息是,如果您使用的是现代版本的Solr(3.1 +),则可以访问新的ExtendedDisMax解析器,该解析器支持布尔查询。 `