mirror of https://github.com/zlatinb/muwire
single hit per search uuid
parent
3f95d2bf1d
commit
ee2fd2ef68
|
@ -4,6 +4,7 @@ import com.muwire.core.search.QueryEvent
|
||||||
|
|
||||||
abstract class Matcher {
|
abstract class Matcher {
|
||||||
final List<Match> matches = Collections.synchronizedList(new ArrayList<>())
|
final List<Match> matches = Collections.synchronizedList(new ArrayList<>())
|
||||||
|
final Set<UUID> uuids = new HashSet<>()
|
||||||
|
|
||||||
protected abstract boolean match(List<String> searchTerms);
|
protected abstract boolean match(List<String> searchTerms);
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ abstract class Matcher {
|
||||||
|
|
||||||
public void process(QueryEvent qe) {
|
public void process(QueryEvent qe) {
|
||||||
def terms = qe.searchEvent.searchTerms
|
def terms = qe.searchEvent.searchTerms
|
||||||
if (match(terms)) {
|
if (match(terms) && uuids.add(qe.searchEvent.uuid)) {
|
||||||
long now = System.currentTimeMillis()
|
long now = System.currentTimeMillis()
|
||||||
matches << new Match(persona : qe.originator, keywords : terms, timestamp : now)
|
matches << new Match(persona : qe.originator, keywords : terms, timestamp : now)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue