This project is not covered by Drupal’s security advisory policy.

This module aims to extend Search API with a new processor plugin that adds a link with a "scroll to text" fragment to the highlighted search term within the result excerpt, allowing users to click the link and automatically scroll to the first instance of the highlighted search term on the page.
This leverages the newly supported Text Fragments browser feature.
Text Fragments let you specify a text snippet in the URL fragment. When navigating to a URL with such a text fragment, the browser can emphasize and/or bring it to the user's attention.
REFERENCE:
- https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Text_fragments
- https://web.dev/articles/text-fragments
Features
The module aims to improve user experience by allowing users to click on the highlighted search term within the search results excerpt, which then takes them to the page, and then highlights and scrolls to the first instance of that search term in the context of the previous search action.
For example, without this module, if I specify "Drupal" as my search term and submit the search form, I may see "Drupal" highlighted within the search results excerpt, but only the search result title is clickable, which takes me to the node's page. I then would need to search within that page for the appearance of "Drupal".
However with this module enabled, and the Text Fragment processor enabled within Search API's config, the search results excerpt will apply a link to the highlighted term, which links to the node page along with the text fragment within the URL so that when the page loads it will highlight and scroll to the first instance of that search term on the page. This is especially helpful for pages containing lots of content, where the text fragment may save the user considerable time from having to find the contextual search term on the resulting page.
Post-Installation
After installing the module, make sure to go to Search API's configuration page for your specific index, and make sure you enable the "Highlight with Text Fragment" processor and save e.g., /admin/config/search/search-api/index/search/processors

Within the processor settings tab you have the option to highlight partial matches and create excerpt, as well as specifying the highlighting prefix and suffix.

Additional Requirements
This module requires the Search API module.
| Attachment | Size |
|---|---|
| search_api_text_fragment-extend@2x.png | 53.99 KB |
| search_api-config-processors-1@2x.png | 305.28 KB |
| search_api-config-processors-2@2x.png | 405.87 KB |
Project information
Unsupported
Not supported (i.e. abandoned), and no longer being developed. Learn more about dealing with unsupported (abandoned) projectsObsolete
Use of this project is deprecated.- Project categories: Site search
- Ecosystem: Search API
- Created by btully on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.

