0

When I look for the word "Unternehmen" with the following query

q="Unternehmen"&
hl=true&
hl.simple.pre=<em>&
hl.simple.post=</em>

I get this Result if the Word Unternehmen is found twice within a close distance within the same field:

Um als <em>Unternehmen die Zukunft erfolgreich zu gestalten, brauchen Unternehmen</em> Innovationen

When "Unternehmen" is found within the same field not within close distance solr gives me:

olle in <em>Unternehmen</em>, hat eine lange Tradition in der Betriebswirtschaftslehre. Dieses Special Issue widmet sich in vielfältiger Weise dem Thema der geeigneten Corporate Governance in mittelständischen oder öffentlichen deutschen <em> Unternehmen </em>. ​

How do I prevent solr from merging highlighting when the matches are too close? I always want to get the second variation of highlighting.

I already tried playing around with hl.fragsize= 0, 10,1000, hl.snippets=2 with no visible effect.

1 Answer 1

0

I tried your example in Solr 5 here using the standard /select Request Handler, and highlighting worked as expected (your second variation) on the first sentence.

Try the following:

  1. What field type do you have for the field where you are querying and highlighting text in? Even if it is German, try "text_en" as the field type and re-index the document for testing.

  2. Try querying and highlighting not on the general catch-all field, but specifically on the field (lets assume it is "mytext") you have your text, such as:

    q=mytext:"Unternehmen"&hl=true&hl.fl=mytext&hl.simple.pre=<em>&hl.simple.post=</em>
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.