Hi all,

SolrQuery provides all methods related to highlighting with Solrj client
such as setHighlight(), setHighlightFragSize(), etc.
But I didn’t find any way to set the hl.usePhraseHighlighter  = true to the
query. However, I can set the same in my solrconfig.xml but my aim is to
this attribute to “true” in case of “exact match” search.

One more question which I needed to rise is about “highlighting the
wildcard”.
I went through the mailing list and found out that we can do this by
prefixing the “*” with a “?” but it is not working for me.
In fact the wild card “?” instead of “*” itself does not give me any result.

My relevant schema.xml:

    <fieldType name="wild_card" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

    <field name="wildcard" type="wild_card" indexed="true" stored="false"
multiValued="true" omitNorms="true"/>
    <field name="highlightFields" type="text" indexed="true" stored="true"
multiValued="true"/>

    <defaultSearchField>all</defaultSearchField>

Note: I have other fields too but specifying only relevant. I am
copyfielding every field but not "wildcard" and "highlightFields". While
creating query, I'm doing - query.setQuery("wildcard: " + searchTerm);. Also 
I'm using the default requestHandler(standard)



My relevant solrconfig.xml

 <requestHandler name="standard" class="solr.StandardRequestHandler"
default="true">
  <lst name="defaults">
       <str name="echoParams">explicit</str>
       <int name="rows">10</int>
       <str name="fl">*</str>
       <str name="version">2.1</str>
           <str name="hl.fl">highlightFields</str>
       <str name="f.highlightFields.hl.fragsize">300</str>
    </lst>
  </requestHandler>


Please let me know where I'm going wrong. 

Thanks 
Sachit

-- 
View this message in context: 
http://www.nabble.com/Solrj-%2B-hl.usePhraseHighlighter-tp21492830p21492830.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to