fix matching
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user