Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Allow to to specify in the filter element to match the full path #1015

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,15 @@ CrawlableDatasetFilter readDatasetScanFilter(Element filterElem) {
collection = true;
}

// Determine if applies to datasets path, default false.
boolean isPath = false;
String pathAttVal = curElem.getAttributeValue("path");
if (pathAttVal != null) {
// If not "false", set to true.
if (!pathAttVal.equalsIgnoreCase("false"))
isPath = true;
}

// Determine if include or exclude selectors.
boolean includer = true;
if (curElem.getName().equals("exclude")) {
Expand All @@ -670,13 +679,23 @@ CrawlableDatasetFilter readDatasetScanFilter(Element filterElem) {
continue;
}

// Determine if regExp or wildcard
if (regExpAttVal != null) {
selectorList.add(new MultiSelectorFilter.Selector(new RegExpMatchOnNameFilter(regExpAttVal), includer, atomic, collection));
} else if (wildcardAttVal != null) {
selectorList.add(new MultiSelectorFilter.Selector(new WildcardMatchOnNameFilter(wildcardAttVal), includer, atomic, collection));
} else if (lastModLimitAttVal != null) {
selectorList.add(new MultiSelectorFilter.Selector(new LastModifiedLimitFilter(Long.parseLong(lastModLimitAttVal)), includer, atomic, collection));
// Determine if is a dataset
if(!isPath) {
// Determine if regExp or wildcard
if (regExpAttVal != null) {
selectorList.add(new MultiSelectorFilter.Selector(new RegExpMatchOnNameFilter(regExpAttVal), includer, atomic, collection));
} else if (wildcardAttVal != null) {
selectorList.add(new MultiSelectorFilter.Selector(new WildcardMatchOnNameFilter(wildcardAttVal), includer, atomic, collection));
} else if (lastModLimitAttVal != null) {
selectorList.add(new MultiSelectorFilter.Selector(new LastModifiedLimitFilter(Long.parseLong(lastModLimitAttVal)), includer, atomic, collection));
}
}else {
// Determine if regExp or wildcard
if (regExpAttVal != null) {
selectorList.add(new MultiSelectorFilter.Selector(new RegExpMatchOnPathFilter(regExpAttVal), includer, atomic, collection));
} else if (wildcardAttVal != null) {
selectorList.add(new MultiSelectorFilter.Selector(new WildcardMatchOnPathFilter(wildcardAttVal), includer, atomic, collection));
}
}
}
}
Expand Down