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