You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Luis <re...@gmail.com> on 2013/03/19 20:28:07 UTC

Extracting excerpt from solr

Hi,
I am using solr to index data from binary files using BinURLDataSource.  I
was wondering if anyone knows how to extract an excerpt of the indexed data
during search.  For example if someone made a search it would return 200
characters as a preview of the whole text content.  I read online that hl
would do the trick.  I tried it even though I am not as interested in
highlighting as I am in pulling the excerpt.  However, so far I have not
been able to make it work.

I added a /browse requestHandler to my solrconfig.xml like this:

<requestHandler name="/browse" class="solr.SearchHandler">
    <lst name="defaults">
          <str name="echoParams">explicit</str>
           <str name="hl">true</str>
           <str name="hl.simple.pre">[HIGHLIGHT]</str> 
            <str name="hl.simple.post">[/HIGHLIGHT]</str> 
            <str name="hl.fl">text title</str>
            <str name="hl.useFastVectorHighlighter">true</str>
            <str name="hl.fragmentsBuilder">colored</str>
            <str name="hl.snippets">3</str>
            <int name="hl.fragsize">70</int>
            <str name="hl.mergeContiguous">true</str>
           <float name="hl.regex.slop">0.5</float>
            
            <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
    </lst>
  </requestHandler>

I tried it in other requestHandlers as well without any success.
Does anyone have some hints?  Thanks In advance.





--
View this message in context: http://lucene.472066.n3.nabble.com/Extracting-excerpt-from-solr-tp4049067.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Extracting excerpt from solr

Posted by Luis <re...@gmail.com>.
Nevermind, I found a solution.  I created an excerpt field in the schema.xml,
then I used the copyField method with the maxChars parameter declared to
copy the content into it with a limitation of the amount of characters that
I wanted. <copyField source="text" dest="excerpt" maxChars="255" />

Thanks anyways.



--
View this message in context: http://lucene.472066.n3.nabble.com/Extracting-excerpt-from-solr-tp4049067p4049358.html
Sent from the Solr - User mailing list archive at Nabble.com.