Negate a Query Constraint - BloomReach Experience - Open Source CMS
07-01-2019

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?