diff -r c69670b7b4ef -r 98be80d2e65b src/GrepHandler.h --- a/src/GrepHandler.h Tue May 11 18:30:50 2021 +0200 +++ b/src/GrepHandler.h Tue May 11 20:42:22 2021 +0200 @@ -73,7 +73,7 @@ currentSearchableAttributes.resize(attributes.size(), false); currentFilter = nullptr; for (int i = 0; i < configuration.relationConfigurations.size(); i++) { - if (regex_match(name, configuration.relationConfigurations[i].relationPattern)) { + if (regex_match(name, configuration.relationConfigurations[i].relationPattern) ^ configuration.relationConfigurations[i].invertMatch[RelationConfiguration::ENTITY::RELATION]) { currentFilter = &configuration.relationConfigurations[i]; break; } @@ -81,7 +81,7 @@ if (currentFilter) { for (int i = 0; i < currentSearchableAttributes.size(); i++) { - currentSearchableAttributes[i] = regex_match(attributes[i].getAttributeName(), currentFilter->attributePattern); + currentSearchableAttributes[i] = regex_match(attributes[i].getAttributeName(), currentFilter->attributePattern) ^ currentFilter->invertMatch[RelationConfiguration::ENTITY::ATTRIBUTE]; } } @@ -94,11 +94,13 @@ if (currentSearchableAttributes[currentAttributeIndex]) { includeCurrentRecord |= regex_search(value, currentFilter->valuePattern); + // includeCurrentRecord ^= currentFilter->invertMatch[RelationConfiguration::ENTITY::VALUE]; // might be inverted here, but it would be probably less useful } currentAttributeIndex++; if (currentAttributeIndex > 0 && currentAttributeIndex % currentSearchableAttributes.size() == 0) { + includeCurrentRecord ^= currentFilter->invertMatch[RelationConfiguration::ENTITY::VALUE]; if (includeCurrentRecord) for (string_t v : currentRecord) relationalWriter->writeAttribute(v); includeCurrentRecord = false; }