Hello everyone,

I am having difficulty enabling phrase highlighting and am hoping someone
here can offer some help. This is what I have currently:

Solr 4.9
solrconfig.xml (partial snip)
<requestHandler name="/select" class="solr.SearchHandler">
                <lst name="defaults">
                        <str name="wt">xml</str>
                        <str name="echoParams">explicit</str>
                        <int name="rows">10</int>
                        <str name="df">text</str>
                        <str name="hl">on</str>
                        <str name="hl.fl">text</str>
                        <str name="hl.encoder">html</str>
                        <str name="hl.snippets">100</str>
                        <str name="hl.simple.pre"><b></str>
                        <str name="hl.simple.post"></b></str>
                </lst>
</requestHandler>

schema.xml (partial snip)
   <field name="id" type="string" indexed="true" stored="true"
required="true" multiValued="false" /> 
   <field name="documentText" type="string" indexed="true" stored="true" />

Query (partial snip):
...select?fq=id:43040&q="my%20search%20phrase"

Response (partial snip):
...
<str>
ipsum dolor sit amet, pro ne verear prompta, sea te aeterno scripta
assentior. (<b>my</b> <b>search</b>
</str>
<str>
<b>phrase</b> facilitates highlighting). Et option molestiae referrentur
ius. Viris quaeque legimus an pri
</str>

The document in which this phrase is found is very long. If I reduce the
document to a single sentence, such as "My search phrase facilitates
highlighting" then the response I get from Solr is:
<str>
<b>My</b> <b>search</b> <b>phrase</b> facilitates highlighting
</str>

What I am trying to achieve instead, regardless of the document size is:
<str><b>My search phrase</b></str> with a single indicator at the beginning
and end rather than three separate words that may get dsitributed between
two different snippets depending on the placement of the snippet in te
larger document.

I tried to follow this guide:
http://stackoverflow.com/questions/25930180/solr-how-to-highlight-the-whole-
search-phrase-only/25970452#25970452 but got zero results. I suspect that
this is due to the hl parameters in my solrconfig file, but I cannot find
any specific guidance on the correct parameters should be. I tried
commenting out all of the hl parameters and also got no results.

Can anyone offer any solutions for searching large documents and returning a
single phrase highlight?

-Teague

Reply via email to