removes duplicate nodes in search

This commit is contained in:
lucio 2020-03-17 13:58:37 +01:00
parent acbd780dff
commit 62fe5a77a0
1 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import java.security.MessageDigest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Deque; import java.util.Deque;
import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -139,11 +140,15 @@ public class Utils {
int count =0; int count =0;
logger.trace("selected range is {}", range); logger.trace("selected range is {}", range);
Node2ItemConverter node2Item= new Node2ItemConverter(); Node2ItemConverter node2Item= new Node2ItemConverter();
Set<String> duplicateId = new HashSet<String>();
while (iterator.hasNext()){ while (iterator.hasNext()){
Node current = iterator.nextNode(); Node current = iterator.nextNode();
logger.debug("[SEARCH] evaluating node {} ",current.hasProperty(NodeProperty.TITLE.toString())? current.getProperty(NodeProperty.TITLE.toString()):current.getName()); logger.debug("[SEARCH] evaluating node {} ",current.hasProperty(NodeProperty.TITLE.toString())? current.getProperty(NodeProperty.TITLE.toString()):current.getName());
//REMOVE duplicate nodes, in case the indexes are not working
if (duplicateId.contains(current.getIdentifier())) continue;
//ECLUDES node not authorized, in case the indexes are not working //ECLUDES node not authorized, in case the indexes are not working
if (authChecker!=null) if (authChecker!=null)
try { try {
@ -163,7 +168,7 @@ public class Utils {
returnList.add(item); returnList.add(item);
} }
count++; count++;
duplicateId.add(current.getIdentifier());
} }
return returnList; return returnList;
} }