/**
* Used in SQALE
* If 'pageSize' params is set no -1, all rules are returned (using scrolling)
*/
public PagedResult<Rule> find(Map<String, Object> params) {
RuleQuery query = new RuleQuery();
query.setQueryText(Strings.emptyToNull((String) params.get("searchQuery")));
query.setKey(Strings.emptyToNull((String) params.get("key")));
query.setLanguages(RubyUtils.toStrings(params.get("languages")));
query.setRepositories(RubyUtils.toStrings(params.get("repositories")));
query.setSeverities(RubyUtils.toStrings(params.get("severities")));
query.setStatuses(RubyUtils.toEnums(params.get("statuses"), RuleStatus.class));
query.setTags(RubyUtils.toStrings(params.get("tags")));
query.setDebtCharacteristics(RubyUtils.toStrings(params.get("debtCharacteristics")));
query.setHasDebtCharacteristic(RubyUtils.toBoolean(params.get("hasDebtCharacteristic")));
query.setSortField(RuleNormalizer.RuleField.NAME);
QueryContext options = new QueryContext();
Integer pageSize = RubyUtils.toInteger(params.get("pageSize"));
int size = pageSize != null ? pageSize : 50;
if (size > -1) {