Search by HSTQuery

Hello,
We have a document xxx:article with xxx:image as a property. It’s a list property with CompanyImageSet in it. In the most cases the article has a xxx:image with one or more CompanyImageSet in it and it’s not important for the search whether the xxx:image property is empty or not.
We search with:

HstQuery hstQuery = builder.ofTypes(xxx:article).orderByDescending(xxx:priority).orderByDescending(xxx:date).limit(limit).build();

Now we want to search in this query only for xxx:article with one or more images in it. How is this possible? We have try it with a where condition in the query and by adding a filter but both queries won’t work for us. Can someone help?

Best regards
Philipp

Hi Philipp,
Indeed it can be challenging to query for information stored in subtree (as in compounds, images links). Maybe you can directly store the presence of one or more images directly on the document level, using Derive Data (see [1])? Then you can query that.

HTH
Jeroen

[1] Derived Data - Bloomreach Experience - Open Source CMS

Thank you.