2

I am using content type in Facet. The search result will be having an option to choose the content type to filter the result.

I want the search should show the result with particular content-type filtered by default. Is it possible? If so, how to do that?

To be little more clear instead of

https://example.com/searchpage?search_terms=xxxx

I want to search as following by default.

https://example.com/searchpage?search_terms=xxxx&f[0]=content_type:content_page&f[1]=content_type:cotent_page

2
  • Did you find a solution for this?
    – Randell
    Commented Apr 7, 2021 at 7:11
  • No, sorry, I left that with the default behaviour.
    – siddiq
    Commented Apr 14, 2021 at 0:06

1 Answer 1

0

Not sure you can do this with facets. Facets by definition show only options that exist in the current query results. There is no guarantee that a content_page type will be among the search results for a term.

You may want to consider using an exposed view filter (the views_block_filter_block module lets you turn this into a place-able block). This would show all content types and can have a default type selected if the filter has none.

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.