[ 
https://issues.apache.org/jira/browse/SOLR-4722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16404826#comment-16404826
 ] 

Bram Vereertbrugghen commented on SOLR-4722:
--------------------------------------------

As a response to [~TamerBoz]:

What I did was the following:
1. place the solr-positionshighlighter.jar into /opt/solr/server/solr/lib, 
where Solr could find it. (Note: I'm running Solr in a docker container, so our 
paths will be different).
2. Create the searchComponent using the above snippets and name it 
'highlighter' (so I could be able to outrule duplicate naming issues).
{code:java}
 <searchComponent class="solr.HighlightComponent" name="highlighter">
    <highlighting class="org.apache.solr.highlight.PositionsSolrHighlighter"/>
 </searchComponent>{code}
3. Create a new requestHandler explicitly using this way of highlighting.
{code:java}
  <requestHandler name="/test-point" class="solr.SearchHandler">
    <lst name="defaults">
      <str name="omitHeader">true</str>
      <str name="wt">json</str>
      <str name="indent">true</str>
    </lst>
    <arr name="last-components">
      <str>highlighter</str>
    </arr>
  </requestHandler>
{code}
4. Make the followinhg call:
{noformat}
http://localhost:8002/solr/mycore/test-point?hl.fl=tm_field_test&hl=on&indent=on&q=tm_field_test:test&wt=json{noformat}
This makes the call

 

 

> Highlighter which generates a list of query term position(s) for each item in 
> a list of documents, or returns null if highlighting is disabled.
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-4722
>                 URL: https://issues.apache.org/jira/browse/SOLR-4722
>             Project: Solr
>          Issue Type: New Feature
>          Components: highlighter
>    Affects Versions: 4.3, 6.0
>            Reporter: Tricia Jenkins
>            Priority: Minor
>         Attachments: PositionsSolrHighlighter.java, SOLR-4722.patch, 
> SOLR-4722.patch, solr-positionshighlighter.jar
>
>
> As an alternative to returning snippets, this highlighter provides the (term) 
> position for query matches.  One usecase for this is to reconcile the term 
> position from the Solr index with 'word' coordinates provided by an OCR 
> process.  In this way we are able to 'highlight' an image, like a page from a 
> book or an article from a newspaper, in the locations that match the user's 
> query.
> This is based on the FastVectorHighlighter and requires that termVectors, 
> termOffsets and termPositions be stored.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to