简体   繁体   English

Solr pdf搜索突出显示问题

[英]solr pdf search highlighting issue

solr v6.5:- I have 2 pdf files indexed in a solr core. solr v6.5:-我在solr核心中建立了2个pdf文件索引。 When I search for a keyword it is getting found in the document, however, the highlighting works for one document and not the other. 但是,当我搜索关键字时,会在文档中找到它,但突出显示仅适用于一个文档,而不适用于另一个文档。 For ex: when I search for "panic" which is there in one of the documents. 例如:当我搜索其中一个文档中的“ panic”时。 I get the search result with highlighting. 我得到突出显示的搜索结果。 But when I search for "epsilon", I get a result that says it has been found with the document information etc, however, the highlighting for this document is not working. 但是,当我搜索“ epsilon”时,得到的结果表明已在文档信息等中找到它,但是,此文档的突出显示不起作用。 Heres whats been added/changed in managed_schema.xml: 以下是在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_"/>

And, solrconfig.xml snippet is as follows: 并且,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>
.
.

Used the 使用了

hl.maxAnalyzedChars=aLargeEnoughValue hl.maxAnalyzedChars = aLargeEnoughValue

parameter in the query and it gives me highlighting for search words which are farther down the doc. 查询中的参数,它使我可以突出显示文档远处的搜索词。 The default value for this parameter is 51200. 此参数的默认值为51200。

Take-away: Large docs when indexed in Solr would give +ve results for SEARCH, however, highlighting could be null/nothing. 要点:在Solr中建立索引的大型文档将为SEARCH提供+ ve的结果,但是,突出显示可能为空/全无。 This happens if the word searched for is farther down the document. 如果搜索的单词在文档的更下方,则会发生这种情况。 Simply increasing the value of hl.maxAnalyzedChars does the job. 只需增加hl.maxAnalyzedChars的值即可完成工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM