  from rest_framework.fields import CharField
  from rest_framework.settings import api_settings
  
  
  class BaseFilterBackend:
      """
      A base class from which all filter backend classes should inherit.
      """
  
      def filter_queryset(self, request, queryset, view):
 
</s> remove     def setUp(self):
 </s> add     @classmethod
    def setUpTestData(cls): </s> remove         and may be comma and/or whitespace delimited.
 </s> add         and may be whitespace delimited. </s> remove from django.core.exceptions import ImproperlyConfigured
 </s> add from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
def search_smart_split(search_terms):
    """generator that first splits string by spaces, leaving quoted phrases togheter,
    then it splits non-quoted phrases by commas.
    """
    for term in smart_split(search_terms):
        # trim commas to avoid bad matching for quoted phrases
        term = term.strip(',')
        if term.startswith(('"', "'")) and term[0] == term[-1]:
            # quoted phrases are kept togheter without any other split
            yield unescape_string_literal(term)
        else:
            # non-quoted tokens are split by comma, keeping only non-empty ones
            yield from (sub_term.strip() for sub_term in term.split(',') if sub_term)


  from rest_framework.fields import CharField
  from rest_framework.settings import api_settings
  
  
def search_smart_split(search_terms):
    """generator that first splits string by spaces, leaving quoted phrases togheter,
    then it splits non-quoted phrases by commas.
    """
    for term in smart_split(search_terms):
        # trim commas to avoid bad matching for quoted phrases
        term = term.strip(',')
        if term.startswith(('"', "'")) and term[0] == term[-1]:
            # quoted phrases are kept togheter without any other split
            yield unescape_string_literal(term)
        else:
            # non-quoted tokens are split by comma, keeping only non-empty ones
            yield from (sub_term.strip() for sub_term in term.split(',') if sub_term)


  class BaseFilterBackend:
      """
      A base class from which all filter backend classes should inherit.
      """
  
      def filter_queryset(self, request, queryset, view):
keep keep keep add keep keep keep keep keep keep
 Align SearchFilter behaviour to django.contrib.admin search (#9017)

* Use subquery to remove duplicates in SearchFilter

* Align SearchFilter behaviour to django.contrib.admin

* Add compatibility with older django/python versions

* Allow search to split also by comma after smart split

* Use generator to build search conditions to reduce iterations

* Improve search documentation

* Update docs/api-guide/filtering.md

---------

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com> 
rest_framework/filters.py