mirror of https://github.com/zlatinb/muwire
fix matching
parent
57d593a68a
commit
72b81eb886
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue