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 @Override
protected boolean match(String[] searchTerms) { protected boolean match(List<String> searchTerms) {
boolean found = false
searchTerms.each { searchTerms.each {
if (keyword == it) if (keyword == it)
return true found = true
} }
false found
} }
@Override @Override

View File

@ -3,9 +3,9 @@ package com.muwire.core.content
import com.muwire.core.search.QueryEvent import com.muwire.core.search.QueryEvent
abstract class Matcher { 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(); public abstract String getTerm();

View File

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