@@ -1938,12 +1938,14 @@ public void testRawQueries() {
19381938 assertCount (numV / strings .length * 2 , graph .indexQuery (VINDEX , "v.text:(beautiful are ducks)" ).vertexStream ());
19391939 assertCount (numV / strings .length * 2 - 10 , graph .indexQuery (VINDEX , "v.text:(beautiful are ducks)" ).offset (10 ).vertexStream ());
19401940 long total = graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (Integer .MAX_VALUE ).vertexStream ().count ();
1941- assertCount (10 , graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (10 ).vertexStream ());
1942- assertEquals (total , (long ) graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (10 ).vertexTotals ());
1943- assertCount (10 , graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (10 ).vertexStream ());
1944- assertEquals (total , (long ) graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (10 ).vertexTotals ());
1945- assertCount (0 , graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (numV ).vertexStream ());
1946- assertEquals (total , (long ) graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (numV ).vertexTotals ());
1941+ int limit = 10 ;
1942+ long expectedLimitedCount = Math .min (total , limit );
1943+ assertCount (expectedLimitedCount , graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (limit ).vertexStream ());
1944+ assertEquals (expectedLimitedCount , (long ) graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (limit ).vertexTotals ());
1945+ assertCount (expectedLimitedCount , graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (10 ).vertexStream ());
1946+ assertEquals (expectedLimitedCount , (long ) graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (10 ).vertexTotals ());
1947+ assertCount (0 , graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (numV ).vertexStream ());
1948+ assertEquals (0 , (long ) graph .indexQuery (VINDEX , "v.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (numV ).vertexTotals ());
19471949 //Test name mapping
19481950 assertCount (numV / strings .length * 2 , graph .indexQuery (VINDEX , "xtext:ducks" ).vertexStream ());
19491951 assertCount (0 , graph .indexQuery (VINDEX , "text:ducks" ).vertexStream ());
@@ -1954,36 +1956,38 @@ public void testRawQueries() {
19541956 //Same queries for edges
19551957 assertCount (numV / strings .length * 2 , graph .indexQuery (EINDEX , "e.text:ducks" ).edgeStream ());
19561958 total = graph .indexQuery (EINDEX , "e.text:ducks" ).limit (Integer .MAX_VALUE ).edgeStream ().count ();
1959+ expectedLimitedCount = Math .min (total , limit );
19571960 assertEquals (total , (long ) numV / strings .length * 2 , graph .indexQuery (EINDEX , "e.text:ducks" ).edgeTotals ());
19581961 assertCount (numV / strings .length * 2 , graph .indexQuery (EINDEX , "e.text:(farm uncle berry)" ).edgeStream ());
19591962 assertCount (numV / strings .length , graph .indexQuery (EINDEX , "e.text:(farm uncle berry) AND e.name:\" Uncle Berry has a farm\" " ).edgeStream ());
19601963 assertCount (numV / strings .length * 2 , graph .indexQuery (EINDEX , "e.text:(beautiful are ducks)" ).edgeStream ());
19611964 assertCount (numV / strings .length * 2 - 10 , graph .indexQuery (EINDEX , "e.text:(beautiful are ducks)" ).offset (10 ).edgeStream ());
19621965 total = graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (Integer .MAX_VALUE ).edgeStream ().count ();
1963- assertCount (10 , graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (10 ).edgeStream ());
1964- assertEquals (total , (long ) graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (10 ).edgeTotals ());
1965- assertCount (10 , graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (10 ).edgeStream ());
1966- assertEquals (total , (long ) graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (10 ).edgeTotals ());
1967- assertCount (0 , graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (numV ).edgeStream ());
1968- assertEquals (total , (long ) graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (numV ).edgeTotals ());
1966+ assertCount (expectedLimitedCount , graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (limit ).edgeStream ());
1967+ assertEquals (expectedLimitedCount , (long ) graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (limit ).edgeTotals ());
1968+ assertCount (expectedLimitedCount , graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (10 ).edgeStream ());
1969+ assertEquals (expectedLimitedCount , (long ) graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (10 ).edgeTotals ());
1970+ assertCount (0 , graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (numV ).edgeStream ());
1971+ assertEquals (0 , (long ) graph .indexQuery (EINDEX , "e.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (numV ).edgeTotals ());
19691972 //Test name mapping
19701973 assertCount (numV / strings .length * 2 , graph .indexQuery (EINDEX , "text:ducks" ).edgeStream ());
19711974
19721975 //Same queries for properties
19731976 assertCount (numV / strings .length * 2 , graph .indexQuery (PINDEX , "p.text:ducks" ).propertyStream ());
19741977 total = graph .indexQuery (PINDEX , "p.text:ducks" ).limit (Integer .MAX_VALUE ).propertyStream ().count ();
1978+ expectedLimitedCount = Math .min (total , limit );
19751979 assertEquals (total , (long ) numV / strings .length * 2 , graph .indexQuery (PINDEX , "p.text:ducks" ).propertyTotals ());
19761980 assertCount (numV / strings .length * 2 , graph .indexQuery (PINDEX , "p.text:(farm uncle berry)" ).propertyStream ());
19771981 assertCount (numV / strings .length , graph .indexQuery (PINDEX , "p.text:(farm uncle berry) AND p.name:\" Uncle Berry has a farm\" " ).propertyStream ());
19781982 assertCount (numV / strings .length * 2 , graph .indexQuery (PINDEX , "p.text:(beautiful are ducks)" ).propertyStream ());
19791983 assertCount (numV / strings .length * 2 - 10 , graph .indexQuery (PINDEX , "p.text:(beautiful are ducks)" ).offset (10 ).propertyStream ());
19801984 total = graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (Integer .MAX_VALUE ).propertyStream ().count ();
1981- assertCount (10 , graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (10 ).propertyStream ());
1982- assertEquals (total , (long ) graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (10 ).propertyTotals ());
1983- assertCount (10 , graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (10 ).propertyStream ());
1984- assertEquals (total , (long ) graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (10 ).propertyTotals ());
1985- assertCount (0 , graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (numV ).propertyStream ());
1986- assertEquals (total , (long ) graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (10 ).offset (numV ).propertyTotals ());
1985+ assertCount (expectedLimitedCount , graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (limit ).propertyStream ());
1986+ assertEquals (expectedLimitedCount , (long ) graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (limit ).propertyTotals ());
1987+ assertCount (expectedLimitedCount , graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (10 ).propertyStream ());
1988+ assertEquals (expectedLimitedCount , (long ) graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (10 ).propertyTotals ());
1989+ assertCount (0 , graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (numV ).propertyStream ());
1990+ assertEquals (0 , (long ) graph .indexQuery (PINDEX , "p.\" text\" :(beautiful are ducks)" ).limit (limit ).offset (numV ).propertyTotals ());
19871991 //Test name mapping
19881992 assertCount (numV / strings .length * 2 , graph .indexQuery (PINDEX , "text:ducks" ).propertyStream ());
19891993 }
0 commit comments