You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by pi...@apache.org on 2022/07/14 05:57:31 UTC
[atlas] branch master updated: ATLAS-4531: _ALL_ENTITY_TYPES showing same basic search results even when offset is changed
This is an automated email from the ASF dual-hosted git repository.
pinal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new e5e63c150 ATLAS-4531: _ALL_ENTITY_TYPES showing same basic search results even when offset is changed
e5e63c150 is described below
commit e5e63c150e6f656bd261aed69dc3c47fbd4cdda3
Author: Sanket Shelar <sa...@freestoneinfotech.com>
AuthorDate: Tue Jun 14 15:42:10 2022 +0530
ATLAS-4531: _ALL_ENTITY_TYPES showing same basic search results even when offset is changed
Signed-off-by: Pinal Shah <pi...@freestoneinfotech.com>
---
.../atlas/discovery/EntitySearchProcessor.java | 2 +-
.../atlas/discovery/EntitySearchProcessorTest.java | 32 ++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java b/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
index f45ccaf24..7f1f2f3b4 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
@@ -252,7 +252,7 @@ public class EntitySearchProcessor extends SearchProcessor {
if (marker != null) {
qryOffset = marker;
} else {
- qryOffset = (nextProcessor != null || (graphQuery != null && indexQuery != null)) ? 0 : startIdx;
+ qryOffset = (nextProcessor != null || (graphQuery != null && indexQuery != null) || isEntityRootType()) ? 0 : startIdx;
}
int resultIdx = qryOffset;
diff --git a/repository/src/test/java/org/apache/atlas/discovery/EntitySearchProcessorTest.java b/repository/src/test/java/org/apache/atlas/discovery/EntitySearchProcessorTest.java
index 764568915..3f9e74d11 100644
--- a/repository/src/test/java/org/apache/atlas/discovery/EntitySearchProcessorTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/EntitySearchProcessorTest.java
@@ -23,6 +23,7 @@ import org.apache.atlas.SortOrder;
import org.apache.atlas.TestModules;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.discovery.SearchParameters;
+import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -42,6 +43,8 @@ import java.util.Date;
import java.util.List;
import java.util.Calendar;
import java.util.GregorianCalendar;
+import java.util.stream.Collectors;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -602,4 +605,33 @@ public class EntitySearchProcessorTest extends BasicTestSetup {
SearchParameters.FilterCriteria ret = processor.processDateRange(filterCriteria);
return ret;
}
+
+ @Test
+ public void ALLEntityTypeForPagination() throws AtlasBaseException {
+ SearchParameters params = new SearchParameters();
+ params.setTypeName(SearchParameters.ALL_ENTITY_TYPES);
+ params.setLimit(10);
+
+ SearchContext context = new SearchContext(params, typeRegistry, graph, Collections.<String>emptySet());
+
+ EntitySearchProcessor processor = new EntitySearchProcessor(context);
+ List<AtlasVertex> v = processor.execute();
+ List a =v.stream().map(v1 -> v1.getProperty(Constants.GUID_PROPERTY_KEY, String.class)).collect(Collectors.toList());
+
+ SearchParameters params2 = new SearchParameters();
+ params2.setTypeName(SearchParameters.ALL_ENTITY_TYPES);
+ params2.setLimit(10);
+ params2.setOffset(10);
+ SearchContext context2 = new SearchContext(params2, typeRegistry, graph, Collections.<String>emptySet());
+
+ EntitySearchProcessor processor2 = new EntitySearchProcessor(context2);
+
+ List<AtlasVertex> v2 = processor2.execute();
+ List b =v2.stream().map(v3 -> v3.getProperty(Constants.GUID_PROPERTY_KEY, String.class)).collect(Collectors.toList());
+
+ assertTrue(!a.stream().anyMatch(element -> b.contains(element)));
+
+
+ }
+
}