Element targetElement = location.getElement();
// check scope
if (scope != null && !scope.encloses(targetElement)) {
continue;
}
SourceRange range = new SourceRange(location.getOffset(), location.getLength());
// TODO(scheglov) IndexConstants.DYNAMIC for MatchQuality.NAME
MatchQuality quality = MatchQuality.EXACT;
// MatchQuality quality = element.getResource() != IndexConstants.DYNAMIC
// ? MatchQuality.EXACT : MatchQuality.NAME;
SearchMatch match = new SearchMatch(quality, matchKind, targetElement, range);