This article covers a Bloomreach Experience Manager version 11. There's an updated version available that covers our most recent release.

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?