Creating custom PassageFormatter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating custom PassageFormatter

Damjan Cvetan
Dear all,

For our highlighting of search hits we are moving from Original Highlighter
to Unified Highlighter but we have the need to create our own
custom PassageFormatter.

Under Original Highlighter we already have our own formatter
which implements Formatter, FormatterWithOffsetPos. This new formatter is
defined under package org.apache.solr.highlight and configured for each
core in solrconfig.xml.

Now we are trying to do the same for Unified Highlighter and as I
understand it we need to create new PassageFormatter but when we are trying
to define the new formatter and link it to the class we getting the error
"org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
Error loading class 'solr.highlight.CustomPassageFormatter'".

Example from solrconfig.xml:
<formatter name="custom" default="false"
class="solr.highlight.CustomPassageFormatter">
</formatter>

I'm asking if this is still the right way? Is the "formatter" tag in XML
valid option for Unified Highlighter?

Thank you.

Kind regards,
  Damjan
Reply | Threaded
Open this post in threaded view
|

Re: Creating custom PassageFormatter

david.w.smiley@gmail.com
You've probably gotten you answer now but "no".  Basically, you'd need to
specify your own subclass of UnifiedSolrHighlighter in solrconfig.xml like
this:

<searchComponent class="solr.HighlightComponent" name="highlight">
  <highlighting class="com.acme.search.AcmeHighlighter>

  </highlighting>
</searchComponent>

I doubt there's any docs on this.

~ David


On Wed, Feb 27, 2019 at 6:35 AM Damjan Cvetan <[hidden email]>
wrote:

> Dear all,
>
> For our highlighting of search hits we are moving from Original Highlighter
> to Unified Highlighter but we have the need to create our own
> custom PassageFormatter.
>
> Under Original Highlighter we already have our own formatter
> which implements Formatter, FormatterWithOffsetPos. This new formatter is
> defined under package org.apache.solr.highlight and configured for each
> core in solrconfig.xml.
>
> Now we are trying to do the same for Unified Highlighter and as I
> understand it we need to create new PassageFormatter but when we are trying
> to define the new formatter and link it to the class we getting the error
> "org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
> Error loading class 'solr.highlight.CustomPassageFormatter'".
>
> Example from solrconfig.xml:
> <formatter name="custom" default="false"
> class="solr.highlight.CustomPassageFormatter">
> </formatter>
>
> I'm asking if this is still the right way? Is the "formatter" tag in XML
> valid option for Unified Highlighter?
>
> Thank you.
>
> Kind regards,
>   Damjan
>