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 Michael Joyner <mi...@newsrx.com> on 2017/07/25 18:05:28 UTC
phrase highlight, exact phrases only?
Hello,
We are using highlighting and are looking for the exact phrase "HIV
Prevention" but are receiving back highlighted snippets like the
following where non-phrase matching portions are being highlighted, is
there a setting to highlight the entire phrase instead of any partial
token matches?
==> Settings:
protected static final String QUERY_TYPE = "edismax";
String highlight_query = "\"HIV Prevention\"";
query.addHighlightField("_text_ws");
query.addHighlightField("_text_txt");
query.addHighlightField("_text_txt_en_split");
query.set("hl.qparser", QUERY_TYPE);
query.set("hl.q", highlight_query);
query.setHighlight(true);
query.setHighlightSimplePre("<span class=\"highlight\">");
query.setHighlightSimplePost("</span>");
query.setHighlightSnippets(999);
query.setHighlightFragsize(100);
query.set("hl.usePhraseHighlighter", "true");
query.set("hl.highlightMultiTerm", "true");
==> Snippets:
SNIPPET: impact on male viewers.” For more information on this research
see: Emotional Appeals in <span class="highlight">HIV</span> <span
class="highlight">Prevention</span>
SNIPPET: Findings from University of Southern California Reveals New
Findings on HIV/AIDS (Emotional Appeals in <span
class="highlight">HIV</span>
SNIPPET: <span class="highlight">Prevention</span> Campaigns:
Unintended Stigma Effects) Immune System Diseases and Conditions -
HIV/AIDS California
SNIPPET: on male viewers.” For more information on this research see:
Emotional Appeals in <span class="highlight">HIV</span> <span
class="highlight">Prevention</span> Campaigns
SNIPPET: Findings from University of Southern California Reveals New
Findings on HIV/AIDS (Emotional Appeals in <span
class="highlight">HIV</span>
SNIPPET: <span class="highlight">Prevention</span> Campaigns:
Unintended Stigma Effects) Immune System Diseases and Conditions -
HIV/AIDS California