Autocomplete field in django inline admin overwrites filtered queryset

I have this inline admin:

class AnalysedSampleInline(admin.TabularInline):
    formset = AnalysedSampleInlineForm
    model = SampleDataRelationship
    extra = 0
    show_change_link = True
    autocomplete_fields = ("sample",)

    def formfield_for_foreignkey(self, db_field, request, **kwargs):
        if == "sample":
            kwargs["queryset"] = (
                Sample.objects.select_related("person__family", "file")
        return super().formfield_for_foreignkey(db_field, request, **kwargs)

The filter .filter(file__type=File.TYPE_BED) works fine without the autocomplete field but not with it.

I found suggestions saying I should modify the “get_search_results” method. But this method does not exist for inline admins and is never called. How can I apply a filter to the autocomplete queryset of an inline admin?