Problem/Motivation
When the NodeSearch plugin renders nodes for indexing, in NodeSearch::indexNode(), and again where it renders the results as part of the execute() method, it is currently invoking hook_node_update_index() in order to render the comments.
Since comments are now a field whose display can be determined by a view mode, this should not be necessary.
Proposed resolution
Get rid of hook_node_update_index() and its one implementation in comment.module, and instead obey the settings on the search_index and search_result display modes.
Also, there is a kludge in CommentDefaultFormatter::viewElements() that is making sure to not render comments in those two view modes, in favor of using the hook, which would be removed.
Remaining tasks
Make a patch.
User interface changes
Users will be able to control whether comments are added to node indexes and displayed for search result highlighting, by using display modes.
API changes
hook_node_update_index() will go away.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 2324719-17.patch | 26.79 KB | claudiu.cristea |
Comments
Comment #1
jhodgdonComment #2
andypostThe problem here that http://api.drupal.org/api/search/8/collectRenderDisplays does not load disabled entity view displays so I have no idea how to make it without #1920044: Move comment field settings that relate to rendering to formatter options
Comment #3
larowlanThis makes sense +1, will try and get a re-roll on #1920044: Move comment field settings that relate to rendering to formatter options today
Comment #4
catchDon't think there's anything beta deadline about this, it's just removing cruft.
Hook probably go past RC so adding beta target, but we could do the comment clean-up even if the hook stays and mark it deprecated if we have to.
Comment #5
jhodgdonSee #2, needs to be postponed for now.
Comment #6
andypostPointed issue does not solve #2
Suppose it should be possible to use disabled entity displays for search.
Also that's would be great issue to implement this ability
Comment #7
jhodgdonI don't see how we can implement this without having the comment rendering options on the formatter though?
Comment #8
jhodgdonTalked to pwolanin about this in DDD today. We think the right solution to this (and would also solve #1113832: [PP-1] Comment module renders "reply" and other links in search index/results) is to make a new comment field formatter for search indexing and results snippet generation that would do the right thing:
- Display all the comments without threading or page limits
- Omit links (reply, permalink, etc.)
- Use this formatter as the default in the search index and search results view modes
Comment #9
xjmThis issue was marked as a beta target for the 8.0.x beta, but is not applicable as an 8.1.x beta target, so untagging.
This could potentially be implemented in a minor with BC, so moving to 8.2.x.
Comment #15
claudiu.cristea+1 for this as it helps getting rid of
drupal_static(). See #1577902: [META] Remove all usages of drupal_static() & drupal_static_reset() .Comment #17
claudiu.cristeaA first raw try with the idea from #8. For now, covers only the indexing.
Comment #19
andypostI still not sure we should add so many things instead of allowing comments to be rendered as field in search view modes
Then no need in templates and everything will work like supposed as comment field
Meantime gonna resurrect patch in #1920044: Move comment field settings that relate to rendering to formatter options and check the way in #1113832: [PP-1] Comment module renders "reply" and other links in search index/results
Comment #20
andypostOn other hand search within comments should be separate task which needs follow-up and research
For example comments maybe queued for indexing when their node(entity) indexed, it affects accuracy of whole search
Also this indexing must order comments from newer to older to increase search relevancy, then how to deal with paging?
Comment #30
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.