mneethiraj commented on code in PR #463:
URL: https://github.com/apache/atlas/pull/463#discussion_r2389110666


##########
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java:
##########
@@ -927,13 +927,15 @@ private AtlasSearchResult 
searchWithSearchContext(SearchContext searchContext) t
         final QueryParams params           = 
QueryParams.getNormalizedParams(searchParameters.getLimit(), 
searchParameters.getOffset());
         String            searchID         = searchTracker.add(searchContext); 
// For future cancellations
 
+        long totalEntityCount = 
searchContext.getSearchProcessor().getResultCount();
+
         searchParameters.setLimit(params.limit());
         searchParameters.setOffset(params.offset());
 
         try {
             List<AtlasVertex> resultList = 
searchContext.getSearchProcessor().execute();
 
-            
ret.setApproximateCount(searchContext.getSearchProcessor().getResultCount());
+            ret.setApproximateCount(totalEntityCount);

Review Comment:
   The real issue is likely that `limit` and `offset` set in lines 932 and 933 
are used by`AtlasJanusIndexQuery.vertexTotals()`, which doesn't seem correct. 
Instead of moving `getResultCount()` call here prior to setting of limit and 
offset, I suggest updating `vertexTotals()` like this:
   
   ```
   @Override
   public Long vertexTotals() {
       return query.offset(0).limit(Integer.MAX_VALUE).vertexTotals();
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to