Negate a Query Constraint - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS
17-03-2022

Negate a Query Constraint

If you have a query with one or more constraints, you can negate() any of those constraints:

// Query documents that do not contain "hippo"
final HstQuery query = HstQueryBuilder.create(scope)
        .ofTypes(BaseDocument.class)
        .limit(10)
        .where(constraint(".").contains("hippo").negate())
        .build();
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?