- last update
almost 2 years ago 544 pass
Search API removes and then reapplies highlighted terms which can cause problems, specifically with the Solr backend.
Issues can arise:
I'm not sure that there is a good way for Search API to know if the query is quoted or how the search engine is handling something like apostrophes.
1. Install Search API 8.x-1.x and Search API Solr 4.x and Solr Server 8.4
2. Create Solr Server with "Retrieve highlighted snippets" selected
3. Create Index that includes fulltext field for body content and enable the Highlight process with "Create Excerpt" selected and the following advanced options:
4. Create test content that include apostrophes and terms "toys", and "son's toys" with fulltext fields
5. Create search page in views that uses "Multiple words" parse mode for the fulltext fields
6. Search terms that include apostrophes, ie "son't toys"
7. See results that include highlighted "s", words like "reason" with "son" in it:
8. Note that the highlight returned from Solr looks something like this:
damaged in that move. Is reasonably supported. β¦ Matter of: Andrews Road Homes, β¦ (which also contained a music holder and mouthpiece) with his [HIGHLIGHT]sons[/HIGHLIGHT] [HIGHLIGHT]toys[/HIGHLIGHT] in item 48. Second, the member provided a standard form statement β¦
As noted above this happens because the highlighted search terms are removed and re-added and characters like apostrophes are treated like word breaks.
The solution in the patch adds a new setting for the Highlight process, "Keep highlighted terms from server". When enabled the highlighted terms returned from the server are not removed. Instead they are kept as is with the highlight prefix and suffix.
1. See if maintainers are interested in pursuing this approach
2. Refine the implementation per maintainers
3. Write tests
Needs work
1.0
Plugins
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.