As a follow-up to #1166114: Manage Displays Search Results doesn't manage the display of the search results, what people really want is the ability to control how search results are displayed -- for example, to display a thumbnail image or taxonomy or etc., and maybe not to display the node type or snippet.
Right now the options are:
a) Use https://drupal.org/project/ds (Display Suite), which gives you that flexibility if you use their Search plugin instead of the core NodeSearch plugin.
b) Use Views to build a search page. This gives you great flexibility but you probably would want #2212321: Add highlighted search result snippet as "field" for Views as well so you can include the search "snippet" with highlighted search terms.
c) Do some theme preprocessing programming in a contrib module to modify the information sent to search-result.html.twig
It would be nicer if you could just go to a Manage Display page and drag fields around. But you'd want the additional "fields" from Search to be included there:
- Snippet with highlighted information
- Info section (or its components): user name, date, content type I think?
So to do this we would probably need to provide our own version of \Drupal\field_ui\DisplayOverview so it would find our special "fields" and display them along with regular fields on the Manage Display page for each content type, for the view mode that would govern search results display. [That is basically what Display Suite does: it has a way to define special "fields"]
Comments
Comment #1
David_Rothstein commentedJust linking to #1166114-55: Manage Displays Search Results doesn't manage the display of the search results for a way that (at least part of) this could perhaps be backported to Drupal 7 - basically an optional checkbox to turn on the new behavior.
I know I've overridden the output like this via some custom code on a couple of sites, and it tends to work well (even without the snippet or the info section available as "fields" to place in the view mode - in some cases you just want to display regular node fields and don't care about those other search-specific things).
Comment #2
jhodgdonSince 8.0.x-beta1 has been released, our policy at this point is No feature requests until 8.1.x. See #2350615: [policy, no patch] What changes can be accepted during the Drupal 8 beta phase?. Sorry, it's just too late for 8.0.x at this point, so even if we had a viable patch, the core committers would not commit it. So unless we decide this is a Task or a Bug (and I don't think it is), we'll have to delay it.
Comment #3
xjmComment #9
anybodyThis option is still relevant. I think the best option would be to generally use a view for search (results) in D8 search or add an option to select the entity display to render search results in. One option could be to fall back to the current default search result tpl display.
Comment #19
joegl commentedI don't think #1166114 really solved anything. All it did was rename "Search Result" to "Search result highlighting input" which in my opinion is more confusing.
It also extremely confusing that Drupal Core out of the box has two default View modes, on a configuration page called manage Display that do not affect either the View or Display of the content type. There is also NO documentation for Drupal 8 or 9 on what these View modes are for. Perhaps there could be some improvements there.
Comment #22
quietone commentedThe Search Module was approved for removal in #3476883: [Policy, no patch] Move Search module to contrib .
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3565780: [meta] Tasks to deprecate the Search module and the removal work in #3565783: [meta] Tasks to remove the Search module.
Search will be moved to a contributed project before Drupal 12.0.0 is released.
Comment #23
quietone commentedThe Search Module has moved from core to contrib,