How to get referring documents from code?

Hi, in the CMS document view there’s an option to show referring documents. (Document > Show referring docuemnts…).

How can I get referring documents for a given document/node inside the code of either a cms or site application?

check org.hippoecm.hst.util.ContentBeanUtils class (createIncomingBeansQuery methods)

@machak Thanks again for the hint. It lead me to some documentation links (such as this Delivery Tier Fluent Search API - Bloomreach Experience - Open Source CMS) and allowed me construct a query such as the one below.

However, this query always return zero result. What am I doing wrong? What I want is to get the exact same list of referrering documents in the CMS document GUI when click on Document > Show referring documents.

package org.example.hal;

import com.onehippo.cms7.addon.halapi.hate.resource.ContentHalResource;
import com.onehippo.cms7.addon.halapi.hate.resource.jcr.JcrContentHalResourceProcessor;
import org.hippoecm.hst.content.beans.query.HstQuery;
import org.hippoecm.hst.content.beans.query.HstQueryResult;
import org.hippoecm.hst.content.beans.query.builder.HstQueryBuilder;

import javax.jcr.Node;

import static org.hippoecm.hst.content.beans.query.builder.ConstraintBuilder.constraint;
import static org.hippoecm.hst.content.beans.query.builder.ConstraintBuilder.or;

public class DopHalResourceProcessor implements JcrContentHalResourceProcessor {

    public boolean isProcessable(Node contentNode) {
        return true;

    public ContentHalResource process(ContentHalResource resource, Node contentNode) {
            String nodeId = contentNode.getIdentifier();

            HstQuery query = HstQueryBuilder.create(contentNode)

            HstQueryResult result = query.execute();
            int size = result.getSize(); // size is always 0.

        } catch (Exception e) {

        return resource;