Hi,

I have been doing some research on highlighting partial matches, there are
some information on google but is far from complete and I just can't get it
to work.

*I have highlighting working but it highlights complete words, example:*


*http://localhost:8983/solr/pcsearch/select?indent=on&q=comput&wt=json
<http://localhost:8983/solr/pcsearch/select?indent=on&q=comput&wt=json>*

*will produce:*

{
  "responseHeader":{
    "status":0,
    "QTime":1,
    "params":{
      "q":"comput",
      "indent":"on",
      "wt":"json"}},
  "response":{"numFound":1,"start":0,"docs":[
      {
        "_text_":["Some Fancy Description and Features"],
        "id":"9332346275143077",
        "name":["Fancy Computer"],
        "type":"product",
        "_version_":1547871793506680832}]
  },
  "highlighting":{
    "9332346275143077":{
      "name":["Fancy <em>Computer</em>"]}}}


*What I'm trying to get is something like  "name":["Fancy
<em>Comput</em>er" only the partial match.*

*I have tried a few things but I keep missing something, my requestHandler
in  solrconfig.xml looks like this:*

<requestHandler name="/select" class="solr.SearchHandler">
    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <int name="rows">10</int>
      <str name="hl">on</str>
      <str name="hl.fl">name,city,state</str>
      <str name="hl.useFastVectorHighlighter">true</str>
      <str name="hl.snippets">100</str>
      <str name="hl.usePhraseHighlighter">true</str>
      <str name="hl.fragsize">100</str>
    </lst>
</requestHandler>


*The name field in schema.xml:*

<field name="name" type="text_basic" indexed="true" stored="true"
multiValued="true" termVectors="true" termPositions="true"
termOffsets="true"/>


*And finally where I'm almost sure the error lies:*

      <fieldType name="text_basic" class="solr.TextField"
positionIncrementGap="100">
          <analyzer type="index">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.WordDelimiterFilterFactory" catenateAll="1"
preserveOriginal="1" generateWordParts="1" />
            <filter class="solr.EdgeNGramFilterFactory" minGramSize="1"
maxGramSize="25" />
          </analyzer>

          <analyzer type="query">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.EdgeNGramFilterFactory" minGramSize="1"
maxGramSize="25" />
          </analyzer>
      </fieldType>

*I don't need stemming for my final application.*

Any help or pointer in the right direction you can provide will be
appreciated.

Thanks!

--Juan Fernando

Reply via email to