@Override
    public int count(final FindMetaCriteria criteria) {

        final Collection<Condition> conditions = createCondition(criteria);
        final Set<Integer> usedValKeys = identifyExtendedAttributesFields(criteria.getExpression(),
                new HashSet<>());

        final Object result = JooqUtil.contextResult(metaDbConnProvider, context ->
                        metaExpressionMapper.addJoins(
                                        context
                                                .selectCount()
                                                .from(meta)
                                                .straightJoin(metaFeed).on(meta.FEED_ID.eq(metaFeed.ID))
                                                .straightJoin(metaType).on(meta.TYPE_ID.eq(metaType.ID))
                                                .leftOuterJoin(metaProcessor)
                                                .on(meta.PROCESSOR_ID.eq(metaProcessor.ID)),
                                        meta.ID,
                                        usedValKeys)
                                .where(conditions)
                                .fetchOne())
                .get(0);

        return (Integer) result;
    }
@return True if any term in any rule expression uses at least one of {@code fields}.
stroom-meta/stroom-meta-impl-db/src/main/java/stroom/meta/impl/db/MetaDaoImpl.java