def add(self, query, params): """Set query according to search param.""" value = params.get('q', '') if filters.is_empty(value): return for keyword in value.split(' '): query.raw_filter( '(LOWER(crash_state) LIKE %s OR LOWER(crash_type) LIKE %s)' % (json.dumps('%%%s%%' % keyword.lower()), json.dumps('%%%s%%' % keyword.lower()))) GROUP_FILTERS = [ filters.Boolean('is_new', 'new'), ] FILTERS = [ TimeFilter(), filters.Boolean('security_flag', 'security'), filters.Boolean('reproducible_flag', 'reproducible'), filters.String('job_type', 'job'), filters.String('project', 'project'), FuzzerFilter(), PlatformFilter(), KeywordFilter(), ] def query_testcase(project_name, crash_type, crash_state, security_flag,
def setUp(self): self.filter = filters.Boolean('field', 'param') self.query = mock.Mock()
helpers.cast(value, int, "'group' must be int.")) KEYWORD_FILTERS = [ GroupFilter(), filters.String('bug_indices', 'issue'), filters.String('platform', 'platform'), filters.String('impact_stable_version_indices', 'stable'), filters.String('impact_beta_version_indices', 'beta'), filters.String('fuzzer_name_indices', 'fuzzer'), filters.String('job_type', 'job'), ] FILTERS = [ filters.String('impact_version_indices', 'impact'), filters.Boolean('has_bug_flag', 'issue'), filters.Boolean('open', 'open'), filters.Boolean('security_flag', 'security'), filters.Keyword(KEYWORD_FILTERS, 'keywords', 'q'), filters.NegativeBoolean('one_time_crasher_flag', 'reproducible'), filters.String('job_type', 'job'), filters.String('fuzzer_name_indices', 'fuzzer'), filters.String('project_name', 'project'), filters.Int('crash_revision', 'revision_greater_than', operator='>') ] def add_filters(query, params): """Add filters based on params.""" if not filters.has_params(params, FILTERS) and not params.get('showall'): params['open'] = 'yes'