Highlighting issue with solr 8.2

101 views Asked by At

Partial highlighting for solr 8.2 is not working fine for me. I am able to do a partial search by using NGramTokenizerFactory. But the highlight dosen't seems to be working now.

Here is Field type defination:

 <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
    <tokenizer class="solr.NGramTokenizerFactory" maxGramSize="15" minGramSize="1"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
      <filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
      <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
  </fieldType>

Here is my Field:

<field name="title" type="text_general" multiValued="true" indexed="true" stored="true"/>

Query:

http://10.232.208.141:8986/solr/up1/select?df=title&hl.fl=title%2Ccontent &hl.simple.post=%3C%2Fb%3E&hl.simple.pre=%3Cb%3E&hl=on&q=digi&rows=1

Expected highlight:

"title":["AgencyPortal <b>Digi</b>tal Engagement Solution Integration—Case Study | Cognizant"]}},

Current output Highlight:

"title":["AgencyPortal Digital Engagement Solution Integration—Case Study | Cognizant"]}},
1

There are 1 answers

0
Abhijit Bashetti On BEST ANSWER

Add termVectors="true" termPositions="true" termOffsets="true" attributes to your field.

Your field will look like.

<field name="title" type="text_general" indexed="true" stored="true" required="true" multiValued="true"  termVectors="true" termPositions="true" termOffsets="true"/>

Try by adding the the below to the query.

&hl.q="queryTerm"&hl.usePhraseHighlighter=true&hl.useFastVectorHighlighter=true

Here is the Documentation in detail for the Highlighting.. Solr Highlighting Page