diff --git a/core/src/main/groovy/com/muwire/core/content/KeywordMatcher.groovy b/core/src/main/groovy/com/muwire/core/content/KeywordMatcher.groovy index 55eff1eb..41fff444 100644 --- a/core/src/main/groovy/com/muwire/core/content/KeywordMatcher.groovy +++ b/core/src/main/groovy/com/muwire/core/content/KeywordMatcher.groovy @@ -7,12 +7,13 @@ class KeywordMatcher extends Matcher { } @Override - protected boolean match(String[] searchTerms) { + protected boolean match(List searchTerms) { + boolean found = false searchTerms.each { if (keyword == it) - return true + found = true } - false + found } @Override diff --git a/core/src/main/groovy/com/muwire/core/content/Matcher.groovy b/core/src/main/groovy/com/muwire/core/content/Matcher.groovy index 84b7e003..98214855 100644 --- a/core/src/main/groovy/com/muwire/core/content/Matcher.groovy +++ b/core/src/main/groovy/com/muwire/core/content/Matcher.groovy @@ -3,9 +3,9 @@ package com.muwire.core.content import com.muwire.core.search.QueryEvent abstract class Matcher { - final Match [] matches = Collections.synchronizedList(new ArrayList<>()) + final List matches = Collections.synchronizedList(new ArrayList<>()) - protected abstract boolean match(String []searchTerms); + protected abstract boolean match(List searchTerms); public abstract String getTerm(); diff --git a/core/src/main/groovy/com/muwire/core/content/RegexMatcher.groovy b/core/src/main/groovy/com/muwire/core/content/RegexMatcher.groovy index 3849b23d..ee76db20 100644 --- a/core/src/main/groovy/com/muwire/core/content/RegexMatcher.groovy +++ b/core/src/main/groovy/com/muwire/core/content/RegexMatcher.groovy @@ -10,7 +10,7 @@ class RegexMatcher extends Matcher { } @Override - protected boolean match(String[] keywords) { + protected boolean match(List keywords) { String combined = keywords.join(" ") return pattern.matcher(combined).find() }