0

I am using Drupal 8 default search and I don't want to use search api module. Default search is working fine. But I Want to modify it. I want to categorize search result and get count of that category. Also I want to add class of that category so that On click of that category, I can hide other results.

There was hook hook_preprocess_search_results() in 7 but in 8 I think they have removed.

So is there any alternate hook available? Is there any other way around without using search api and facet api?

  • It literally sounds like facets, why don’t you want to use facets? – Kevin Jan 29 '18 at 4:36
  • Hook hook_preprocess_search_results works in D8. Please check out this article: fivemilemedia.co.uk/blog/… – Vladislav Apr 5 '18 at 10:47
  • You have to alter the route defined by the search module like this – Rem Jul 12 '19 at 12:23
1

Perhaps a view with exposed filters may be a quicker solution for this kind of thing.

| improve this answer | |
0

If you want to add search behavioral and modify the results which it gives you, you can use hook_node_search_result , Else if you want to modify the look and design of your result items you can use search-result.html.twig file to theme the output markup of your result items.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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