3

Problem

I have a country taxonomy field. The top level is continents then below that countries:

Asia
--China
--Thailand
Europe
--France
--Germany
  • I'm using search API (with solr backend) to index.
  • Views to display the results.
  • Views exposed filters to search.

How can I set-up the search, so a search on a parent term (e.g. Asia) displays all it's children (China, Thailand etc.)?

So Far

I think the relevant solution if you're not using Search API is described in this page:

Use views to display taxonomy children terms from parent

I think you have to add a contextual filter which sets the rules for taxonomy, however this doesn't seem to be an option in Search API. There are also no contrib modules which solve this problem.

Has anyone tackled this before?

  • Hi, Please say how you make to get search results in views, Very thank you – Alen Simonyan Aug 3 '18 at 13:07
4

There's a wonderful little checkbox in the Search API workflow tab which enables it.

Head to:

admin/config/search/search_api/index/*your solr server*/workflow

(You'll need to have created a server to get to this.)

And then tick the box "Index Hierarchy".

In callback options select the taxonomy field where you would like searching for the parent to include the child.

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.