For some requirement I need to write code something like below and not sure how it is possible -

Query query = new Query();         

query.setResultFilter(new PagingFilter(minitems,pageSize));

String [] totalComURIs = query.executeQuery();  

/* Here I want to Remove the exiting PagingFilter and execute the same query with 
   new PagingFilter as below- again */    
query.setResultFilter(new PagingFilter(minitems,(pageSize +5)));

/* This  increment of 5 is not fix and getting calculated with the help of some 
   code after executing query with first PagingFilter */
String [] AllitemURIs = query.executeQuery();
  • 1
    Did you try to executeQuery() then setResultFilter() and executeQuery() again? Does it work? You can only have one result filter so probably calling setResultFilter() the second time will 'overwrite' the result filter. – Jan H Jan 16 '14 at 13:56

I would expect that setting the result filter again would reset it, so if you would call:

String [] AllitemURIs = query.executeQuery();

that should work (but I am guessing here, I didn't test it).

If it doesn't then you can always revert to creating a new Query object:

query = new Query();         
String [] AllitemURIs = query.executeQuery();

That surely should work.

| improve this answer | |

It's good to have a nice method to handle different filters.


// Calling method
String[] totalComURIs = ExecuteQuery(criteria, new PagingFilter(currentPosition, pageSize));
String[] AllitemURIs = ExecuteQuery(criteria, new PagingFilter(currentPosition, pageSize+5));

// Method returns String Array
public String[] ExecuteQuery(Criteria criteria, ResultFilter resultFilter)
    Query query = new Query();
    return query.executeQuery();
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.