﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15961	Admin search should be pluggable	Jeremy Dunck	anonymous	"RIght now, the ModelAdmin search_fields functionality is implemented in admin.views.ChangeList.get_query_set:
http://code.djangoproject.com/browser/django/tags/releases/1.3/django/contrib/admin/views/main.py#L256

Choosing search fields often requires tough tradeoffs between utility (searching all fields that are likely useful) and performance (joining over large M2M traversals is hard on the DB).

It would be good if the implementation for search_fields were pluggable;  on the current project, I wish I could use Haystack/Solr there.

What about adding a hook, .get_search_results(self, query) which would return either a queryset or a list of primary keys?  The rest of ChangeList could remain unchanged, just incorporating the result into the QuerySet resulting from get_query_set.

As for declaring a backend, how about adding ModelAdmin.search_backend which is a dotted python-path string?
"	New feature	closed	contrib.admin	1.3	Normal	fixed		kmike84@…	Accepted	0	0	0	1	0	0
