【问题标题】:Solr returns incomplete search resultsSolr 返回不完整的搜索结果
【发布时间】:2016-07-09 05:08:01
【问题描述】:

我是 solr 的新手,并且创建了一个通过 xml 文件搜索的核心。搜索工作正常,但似乎并不完整。当我搜索我的索引文件时,例如使用“A”我得到一个结果,当我使用“U”时,即使有与搜索字符串匹配的记录,我也没有得到结果。你能告诉我在哪里检查这个问题吗?在我看来,schema.xml 和 data-config.xml 似乎定义正确。

提前感谢您的任何建议!

fieldType 是“text”,我这里附上了schema.xml:

`<?xml version="1.0" encoding="UTF-8"?>
<schema name="example" version="1.5">
  <uniqueKey>id</uniqueKey>
  <fieldType name="date" class="solr.TrieDateField"             positionIncrementGap="0" precisionStep="0"/>
  <fieldType name="int" class="solr.TrieIntField"     positionIncrementGap="0" precisionStep="0"/>
  <fieldType name="long" class="solr.TrieLongField"     positionIncrementGap="0" precisionStep="0"/>
  <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
  <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
    <analyzer>
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
  </fieldType>
  <field name="_version_" type="long" indexed="true" stored="true"/>
  <field name="idauftrunters" type="string" indexed="true" required="true" stored="true"/>
  <field name="id" type="int" indexed="true" stored="true"/>
  <field name="patientname" type="text" indexed="true" stored="true"/>
</schema>`

萨宾

【问题讨论】:

  • 该字段使用什么fieldType?它有什么标记器和过滤器?
  • Solr Admin 下的“分析”页面与查询字符串相比,索引内容显示什么?
  • 你能告诉你正在搜索哪个特定字段以及在 schema.xml 中该字段是如何分析的
  • 您是否希望“U”在一个术语内匹配?或者匹配一个特定的词?
  • 是的,我希望它与所有包含“U”的患者姓名匹配

标签: xml solr


【解决方案1】:

对于名为 Johnny U Dawg 的人,您的查询应该返回结果。

对于名为 Johnny U. Dawg 的人,您可能需要添加 ClassicFilterFactoryLetterTokenizerFactory,它应该会返回结果。

但是,据我了解,您希望在使用 U

进行查询时显示“Jesus Gamez”

这在 SOLR 中并不简单,最接近此功能的是 EdgeNGramFilterFactory,但它仅将第一个字母作为您期望的标记。

实现此目的的一种方法是编写 scriptTransformer(在您的数据配置 xml 中)并将名称拆分为每个字母,例如 this,但使用 Javascript。 并将其存储在与您的名称字段(例如命名空间)不同的字段中,并使用 copyField 将此命名空间添加到您的文本字段中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多