No description provided.
ENHANCEMENT: Search both Title and Filename in AssetAdmin (#7013)
Hm, the removal of SearchContext means that you can't simply add to File::$searchable_fields (or decorate File with additional properties) - you now have to subclass AssetAdmin. Can't you just remove the SearchFilter responsible for querying the name, add it manually, but leave the SearchContext in place?
...or modify File::$searchable_fields to search across both Filename and Title?
@chillu Title was the only thing still being searched by the SearchContext. I didn't see any point keeping the SearchContext around when it wasn't being used. I can add it back if you feel it makes sense.
@sminnee It didn't look to me like it was possible to have a single form field that searches across two database fields, and I didn't see an immediately obvious way to extend it to do so. Ideas?
It's more work but I'd probably suggest that we make the ORM support this. The API that we had previously discussed was to allow the map key to be a string containing a comma separated list of field names. I'm not sure if it got into implementation or not.
The best place to do this would be in the DataList::filter() method, and then to refactor SearchContext to push most of the hard work to filter (or refactor modeladmin to use filter directly).
@ajoneil For customization purposes, I'd prefer to keep SearchContext in there, yes.
I'm not quite sure how @sminnee has planned to deprecate SearchContext though,
so this might be a non-starter. Sam, is there a ticket describing the required work already?
Which class would be responsible for scaffolding the search form fields according to model definitions in that new API?
BTW, there's a ticket/patch about multiple field support in trac that's just about as old as SearchContext itself ;)
Fixed the issue on the ticket with 363dc9a, lets tackle the composite searchfilter problem in the ticket Sam referenced.
MINOR Searching both Title and Filename in AssetAdmin (fixes #7013, s…
…ee pull request #71)