You'll learn how to enable hit highlighting in Drupal when it's not working even after enabling it in SearchStax Site Search.
Hit highlighting makes search results more useful by emphasizing the search terms in your results. However, enabling hit highlighting in SearchStax alone isn't enough—you also need to configure specific settings in Drupal for the feature to work properly.
Enable Hit Highlighting in SearchStax
If you haven't already enabled hit highlighting in SearchStax:
- In SearchStax, go to Configurations > Basic Configurations > Results Fields.
- Check the box for Hit Highlighting.
- Click SAVE DRAFT, then click PUBLISH.
Configure Drupal to Retrieve Highlighted Snippets
The key Drupal setting that's often missed is enabling highlighted snippet retrieval on your search server:
- In Drupal, go to Configuration > Search and metadata > Search API.
- Find your SearchStax server and click Edit.
- Under the Advanced section, check the box that says Retrieve highlighted snippets.
- Click Save.
Configure Your Drupal Search View
Your Drupal search view must be configured to use the highlighted field data:
- Go to Structure > Views and edit your search view.
- In the Fields section, edit each field you want to highlight (such as Title and Body).
- For each field, check the box that says Use highlighted field data.
- Click Apply, then click Save.
If hit highlighting still isn't working, verify that:
- The fields you want highlighted are configured as search fields in both Drupal and SearchStax
- Your SearchStax configuration includes the fields in both Results Fields and Search Fields
- You've re-indexed your content after making field changes
What's Next
See the Drupal Hit Highlighting guide for complete setup instructions and advanced configuration options.