single hit per search uuid

pull/11/head
Zlatin Balevsky 2019-07-09 21:22:31 +01:00
parent 3f95d2bf1d
commit ee2fd2ef68
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import com.muwire.core.search.QueryEvent
abstract class Matcher {
final List<Match> matches = Collections.synchronizedList(new ArrayList<>())
final Set<UUID> uuids = new HashSet<>()
protected abstract boolean match(List<String> searchTerms);
@ -11,7 +12,7 @@ abstract class Matcher {
public void process(QueryEvent qe) {
def terms = qe.searchEvent.searchTerms
if (match(terms)) {
if (match(terms) && uuids.add(qe.searchEvent.uuid)) {
long now = System.currentTimeMillis()
matches << new Match(persona : qe.originator, keywords : terms, timestamp : now)
}