@Override
    @SuppressWarnings("unchecked")
    public boolean filterMatches(final long recordIndex) {
        final long metaId = metaHolder.getMeta().getId();

        // If we are skipping to a severity then perform check on severity.
        if (settings.getSkipToSeverity() != null) {
            final ErrorReceiver errorReceiver = errorReceiverProxy.getErrorReceiver();
            if (errorReceiver instanceof final LoggingErrorReceiver loggingErrorReceiver) {
                // If this is a stepping filter being used for input then catch
                // indicators raised by the code.
                if (elementId != null) {
                    final Indicators indicators = loggingErrorReceiver.getIndicators(elementId);
                    if (indicators != null) {
                        final Severity maxSeverity = indicators.getMaxSeverity();
                        if (maxSeverity != null && maxSeverity.greaterThanOrEqual(settings.getSkipToSeverity())) {
                            return true;
                        }
                    }
                }
            }
        }

        // If we are skipping to output or no output then check to see if we
        // have output or not.
        if (settings.getSkipToOutput() != null) {
            if (maxElementDepth > 1) {
                if (OutputState.NOT_EMPTY.equals(settings.getSkipToOutput())) {
                    return true;
                }
            } else {
                if (OutputState.EMPTY.equals(settings.getSkipToOutput())) {
                    return true;
                }
            }
        }

        if (xPathFilters == null && settings.getFilters() != null && !settings.getFilters().isEmpty()) {
            // Compile the XPath filters.
            xPathFilters = new HashSet<>();
            for (final XPathFilter xPathFilter : settings.getFilters()) {
                try {
                    // Only add filters that check for uniqueness or that have
                    // had a valid value specified.
                    if (!xPathFilter.getMatchType().isNeedsValue() || xPathFilter.getValue() != null) {
                        final CompiledXPathFilter compiledXPathFilter = new CompiledXPathFilter(xPathFilter,
                                getConfiguration(), getNamespaceContext());
                        xPathFilters.add(compiledXPathFilter);
                    }
                } catch (final XPathExpressionException e) {
                    throw ProcessException.create("Error in XPath filter expression", e);
                }
            }
        }

        if (xPathFilters != null) {
            try {
                final NodeInfo nodeInfo = getEvents();
                final NodeInfo documentInfo = nodeInfo.getRoot();
                for (final CompiledXPathFilter compiledXPathFilter : xPathFilters) {
                    final Object result = compiledXPathFilter.getXPathExpression().evaluate(documentInfo,
                            XPathConstants.NODESET);
                    // May contain NodeInfo, Boolean, Double, Long, String
                    final List<Object> objects = (List<Object>) result;
                    if (NullSafe.hasItems(objects)) {
                        if (isFilterMatch(objects, compiledXPathFilter, metaId, recordIndex)) {
                            return true;
                        }
                    }
                }
            } catch (final XPathExpressionException | RuntimeException e) {
                throw ProcessException.wrap(e);
            }
        }

        return false;
    }
This method checks that the current event matches the filter that has
been applied to this section of the pipeline.
stroom-pipeline/src/main/java/stroom/pipeline/filter/SAXEventRecorder.java