Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
node.module
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
28 Jun 2007 at 08:48 UTC
Updated:
29 Jul 2014 at 17:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
robertdouglass commentedI support the RTBC. The only argument against this approach is that there is no way to update the index for an author's nodes when that author changes his name. This, however, is no different than the inclusion of taxonomy terms in the search index... there is no way to update them either, so it is a larger problem that should be handled separately. This patch will make search much more useful.
Comment #2
robertdouglass commentedThis patch raises the question of how best to rebuild the search index. I think it would be unfair to simply wipe people's search index as a matter of upgrading to D6 (although that would certainly solve the problem). Perhaps it should be an update that they can opt out of with ample information?
The issue is the already indexed content that needs to be re-indexed for this feature to take hold. We have the same issue (though it is less likely to affect many people) with http://drupal.org/node/155262.
I think I'm in favor of an update that calls search_wipe_index and some documentation in the upgrade docs that points this out.
I'd put the update in search.install so that people can most easily opt out of it.
Comment #3
bennybobw commentedI've rerolled this patch relative to the base directory. I'm not sure what to do about the search index issue , but I think the ability to search by author should be included. I'm surpised that it wasn't in the past. +1
Comment #4
douggreen commentedShouldn't we
theme('username', $node)?@robert, I think that Steven's link patch is going to force a re-index. See #146466.
Re-rolling with slight changes to adhere to coding standards.
Comment #5
robertdouglass commented@Doug: thanks for the re-roll, and yes I think you're right about theme('username')
Comment #6
robertdouglass commentedNo, I take that back... theme_username isn't right here. Keeping as RTBC.
Oh, and the reindexing of the site due to Steven's patch would be a great way to handle the addition of this feature. In fact, if this patch, #155262 and Steven's link patch all went in it would be overall a nice incremental improvement to the search index.
In the future we need to have a hook that lets modules send back a set of nids which need reindexing. One monolithic query in node_update_index doesn't cut it any more.
Comment #7
douggreen commentedI'm leaning towards agreeing that theme_username isn't needed here, but you didn't explain yourself. I think it might not be needed because all it does is wrap the user name in an HTML anchor, and since we're just doing search indexing here, all that the extra anchor would do is affects the words relevancy. You're already putting it inside a STRONG which does the same thing.
However, what about sites that override theme_username?
Comment #8
robertdouglass commentedSites that override theme_username usually change the presentation (add an icon, or styling) but don't change the name itself. I think that we have the name in fine form as it is and can use it to link content to the author in the view of the search engine.
Comment #9
douggreen commentedI've occasionally used theme_username to replace the user name with the user's full name. So I'm not convinced this shouldn't be themed. But I do believe that we should index some user name. And if we decide later that it should be the themed name, this can be changed.
So, +1 for the current patch.
Comment #10
RobRoy commentedI haven't checked out the patch, but -1 on not using theme('username') everywhere a username is displayed. I think this should be marked 'needs work' but don't want to set it as I haven't installed the patch, just read comments.
In a lot of sites I've done, we have a Drupal core username and then a Display name using another module. I override theme_username to show a Profile module field's display name, Usernode CCK's field display name or a display name from LDAP. What we really need is a third argument in theme_username that shows name as a link or not IMO or an arbitrary $style string.
I created a simple patch for theme_username at http://drupal.org/node/156266 just now.
Comment #11
robertdouglass commentedBlake, can you reroll with theme_username?
Comment #12
BlakeLucchesi commentedSorry for the delay. I have reworked the code to use the theme('username', $user). Hope this resolves any issues that people are having with the code.
Comment #13
douggreen commented@Blake, now please re-roll while adhering to coding standards (see #30785 or compare your latest patch to the one I re-rolled).
Comment #14
BlakeLucchesi commentedDoug, thanks for the pointers, I read over the standards once but apparently I should read harder next time.
Comment #15
catchNo longer applies, but would be a nice addition in Drupal 7.
Comment #16
robertdouglass commentedRerolled for D7.
Comment #17
Freso commentedApplies cleanly and works as advertised.
Before applying the patch, I generate a bunch of stuff with devel_generate (first users, then content). I then mark the search index for re-indexing, run cron, and try to search for one of the users that have associated content - which returns nothing.
After applying the patch, I mark the search index for re-indexing, run cron, and try to search for the very same user, this time returning the nodes associated with it! Success! :D
Comment #18
Freso commentedOh, yes, there's of course no upgrade path, but the search will still work as normal (according to my testing) until the site is re-indexed, so I don't really feel one is needed for the code to go in. Keeping the RTBC.
Comment #19
catchDo we want a note somewhere to mention the reindexing? Only places I can think of are CHANGELOG.txt and a fake search_update() with a drupal_set_message() though.
Comment #20
Freso commentedAh, you're right. Not sure about whether a
search_update_Xis needed, but this patch has a draft for a CHANGELOG.txt entry. Setting this back to CNR until we've decided on the CHANGELOG.txt text and whether to use asearch_update_Xto inform upgraders.Comment #21
Freso commentedPatch broken by changes to CHANGELOG.txt and the node.module hunk applied with offset. Re-rolled. Also, as there have been no comments on the CHANGELOG.txt text, I'm setting this back to RTBC.
Comment #22
robertdouglass commentedAgree with RTBC.
Comment #23
dries commentedFirst, I'm not a fan of using theme('username') here -- it leads to behavior that is unpredictable and that could lead to inconsistent or skewed index (i.e. when switching a theme that puts more or different information in the index).
Second, it would be good if we extended the search module's tests.
Comment #24
jhodgdonThis didn't make the Drupal 7 feature request deadline... moving on to Drupal 8.
Comment #25
jhodgdonThis is actually a duplicate of #233476: Add search by node creation date and the author
Comment #26
jhodgdonComment #28
internal commentedIs there a final code here? I really need this function in D7.