villebro commented on code in PR #41897:
URL: https://github.com/apache/superset/pull/41897#discussion_r3547832175
##########
superset/subjects/filters.py:
##########
@@ -176,6 +176,28 @@ def apply(self, query: Query, value: Optional[Any]) ->
Query:
return _apply_subject_list_filters(query)
+class SubjectAllTextFilter(BaseFilter): # pylint:
disable=too-few-public-methods
+ """ILIKE search across a subject's textual columns.
+
+ Used by the Subject REST API ``search_filters`` for free-text search.
+ """
+
+ name = _("All Text")
+ arg_name = "subject_all_text"
+
+ def apply(self, query: Query, value: Any) -> Query:
+ if not value:
+ return query
+ ilike_value = f"%{value}%"
+ return query.filter(
+ or_(
+ Subject.label.ilike(ilike_value),
+ Subject.secondary_label.ilike(ilike_value),
+ Subject.extra_search.ilike(ilike_value),
+ )
+ )
Review Comment:
Irrelevant for this use case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]