fix matching

pull/11/head
Zlatin Balevsky 2019-07-09 20:27:28 +01:00
parent 57d593a68a
commit 72b81eb886
3 changed files with 7 additions and 6 deletions

View File

@ -7,12 +7,13 @@ class KeywordMatcher extends Matcher {
}
@Override
protected boolean match(String[] searchTerms) {
protected boolean match(List<String> searchTerms) {
boolean found = false
searchTerms.each {
if (keyword == it)
return true
found = true
}
false
found
}
@Override

View File

@ -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<Match> matches = Collections.synchronizedList(new ArrayList<>())
protected abstract boolean match(String []searchTerms);
protected abstract boolean match(List<String> searchTerms);
public abstract String getTerm();

View File

@ -10,7 +10,7 @@ class RegexMatcher extends Matcher {
}
@Override
protected boolean match(String[] keywords) {
protected boolean match(List<String> keywords) {
String combined = keywords.join(" ")
return pattern.matcher(combined).find()
}