Closed kkanthet closed 9 years ago
Once the limit is set for a query , its not cleared after query execution.
Query query = QueryFactory.create("PREFIX bb: <http://marklogic.com/baseball/players#> SELECT ?o WHERE" + "{ ?s bb:position ?o.}"); // Query with limit 2 query.setLimit(2); QueryExecution queryExec = QueryExecutionFactory.create(query, dataSet); ResultSet results = queryExec.execSelect(); assertNotNull(results); assertTrue(results.hasNext()); int count = 0; while (results.hasNext()) { QuerySolution qs = results.next(); System.out.println(qs.toString()); assertTrue(qs.contains("o")); count++; } assertTrue(count == 2); // Query with Offset 2 query.setOffset(2); System.out.println(query.getLimit()); queryExec = QueryExecutionFactory.create(query, dataSet); results = queryExec.execSelect(); assertNotNull(results); assertTrue(results.hasNext()); count = 0; while (results.hasNext()) { QuerySolution qs = results.next(); System.out.println(qs.toString()); assertTrue(qs.contains("o")); count++; } //TODO confirm LIMIT reset to the query assertTrue("Should return 9 results but returned::"+count,count == 9);
I verified and found where to fix this bug. The queryManager needs to have its pagelength cleared if none is supplied in a select.
This is pushed to develop
Verified the limit is cleared when not set.
Once the limit is set for a query , its not cleared after query execution.