Commit 83fedaff authored by Volker Krause's avatar Volker Krause
Browse files

When collecting all matching result nodes, only take the leaf-most ones

This avoids triggering on nodes that already have results propagated
parent b7ce72ff
......@@ -176,6 +176,17 @@ static bool filterMachesNode(const ExtractorFilter &filter, ExtractorFilter::Sco
if (scope != ExtractorFilter::Ancestors && filter.mimeType() == QLatin1String("application/ld+json") && !node.result().isEmpty()) {
// when collecting all matches for results, we only want the "leaf-most" ones, not those along the path
if (matchMode == All && scope == ExtractorFilter::Descendants) {
bool descendantsMatched = false;
for (const auto &child : node.childNodes()) {
descendantsMatched |= filterMachesNode(filter, ExtractorFilter::Descendants, child, matches, matchMode);
if (descendantsMatched) {
return true;
const auto res = node.result().jsonLdResult();
for (const auto &elem : res) {
const auto property = valueForJsonPath(elem.toObject(), filter.fieldName());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment