harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-0653harbor download openthoughts/tasktrove-exp-rpt-issue-issue-0653Title: Optimize multi-word admin search to reduce unnecessary JOINs
Goal
Context
Relevant source (before state)
Code excerpt showing the problematic per-term filtering (this is the pre-fix state you should replace with the improved approach):
# app/django/contrib/admin/options.py
def construct_search(field_name):
# ... (other code)
if search_fields and search_term:
orm_lookups = [construct_search(str(search_field))
for search_field in search_fields]
for bit in smart_split(search_term):
if bit.startswith(('"', "'")) and bit[0] == bit[-1]:
bit = unescape_string_literal(bit)
queryset = queryset.filter(
*((orm_lookup, bit) for orm_lookup in orm_lookups),
_connector=models.Q.OR,
)
What to implement (high level, without sharing exact patch)
Files to create/modify in /app/
Expected behavior after fix
How to verify (manual guidance)
Notes