Advanced Search Filter based on the Child Property of a Document


I am using the version 12.6.1-1 of the Hippo CMS Enterprise Edition. I am trying to build an advanced search filter which would search articles by a specific category to which the article belongs.

All the examples that I if found online were searching for direct properties of a Document (ex: title, author, body … etc.) and not for the child properties (which are a different document type contributed on a document).

Is there any what to achieve the above?

I think you can extend the Generic Property Filter [1] and override the #getConstraints() method. For example, it could have something like this while your filterPropertyName configuration being like category/@myproject:name:



1 Like

Hi Woonsan,

Thank you for taking time to reply to my question.

I am still having problems to understand how is it possible to retrieve all the articles belonging to a specific category into the filterPropertyName variable. I believe (please correct me if I am wrong) that you example searches for the all categories existing inside the project and not the articles belonging to one category. If it is possible, could you please share a more elaborate answer with a small example?

As for the documentation page, the search value is the author which is a direct property on the Document not a child of the document.

In advanced search UI, if an editor selects news document types, then it will search all the news articles. If you add your custom generic property filter plugin, it will add constraints onto the existing search query. For example, if a new article has a category name field, then your custom generic property filter could add a constraint like @myproject:categoryName = 'cat1', where the property name is from the configuration and the value is provided by the advanced search plugin to your custom filter implementation. I guess you could use child node’s property there too. e.g, `categorycompound/@categoryName = ‘cat1’.
Now, suppose if the news article document contains the internal category identifier or linked category document’s handle UUID. Then I guess your filter could try to search the identifier somehow before adding the constraint…

1 Like

Thank you for the update Woonsan. You gave me a good idea on how to proceed.
I will create a new field on the Article which will contain the value of the category in String format.
From there I will do the same process as describe in the documentation to search for newly created direct property on the Article.