0

solr v6.5:- 我在 solr 核心中有 2 个 pdf 文件索引。但是,当我搜索一个关键字时,它会在文档中找到,突出显示适用于一个文档,而不适用于另一个文档。例如:当我在其中一个文档中搜索“恐慌”时。我得到突出显示的搜索结果。但是当我搜索“epsilon”时,我得到一个结果,表明它已与文档信息等一起找到,但是,该文档的突出显示不起作用。以下是 managed_schema.xml 中添加/更改的内容:

    .
    .
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
        <!-- in this example, we will only use synonyms at query time
        <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
        -->
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>
.
. 
    <field name="_text_" type="text_general" multiValued="true" indexed="true" stored="true"/>
    <field name="content" type="text_general" multiValued="true" indexed="true" stored="true"/>
    .
    .
    <copyField source="content" dest="_text_"/>

并且,solrconfig.xml 片段如下:

.
.
<requestHandler name="/update/extract"
                  startup="lazy"
                  class="solr.extraction.ExtractingRequestHandler" >
    <lst name="defaults">
      <str name="lowernames">true</str>
      <str name="fmap.meta">ignored_</str>
      <str name="fmap.content">_text_</str>
    </lst>
  </requestHandler>
.
.
4

1 回答 1

0

用过

hl.maxAnalyzedChars=aLargeEnoughValue

查询中的参数,它让我突出显示文档中更远的搜索词。此参数的默认值为 51200。

要点:在 Solr 中索引的大型文档将为 SEARCH 提供 +ve 结果,但是,突出显示可能为空/无。如果搜索的单词位于文档的更远位置,则会发生这种情况。只需增加 hl.maxAnalyzedChars 的值就可以了。

于 2017-04-25T13:43:28.313 回答