The $reindex parameter is not used in search_reindex(). Let's remove it. This is in search.module.

The parameter was used in Drupal 7. However, the (largely broken) D7 functionality that created the node links table was removed in Drupal 8, so the lines of code that used the $reindex parameter were removed when the Search module was redone to use plugins. The parameter was not removed at that time (an oversight), even though the lines of code using it were removed. (As a note, the replacement for the node_links functionality, which is desired for Views, is being handled in #1853536: Reintroduce Views integration for search.module (not supporting backlinks view).)

The alternative would be to leave the parameter there but change its name to $unused and document it as a crufty unused parameter. However, since the Search API for plugins is still in flux, it seems unlikely that any search-related contrib modules would suffer needlessly by this API change going in now, so this seems like a good time to go ahead and make the change.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

InternetDevels’s picture

InternetDevels’s picture

Status: Active » Needs review
ianthomas_uk’s picture

Priority: Normal » Minor
Status: Needs review » Active

This is a cosmetic issue for users of the API, there's no broken or missing functionality, so I'd say it's minor rather than normal.

It's also an API change, so would be against the policy to include in Drupal 8 at this stage. See https://drupal.org/node/2045345

I'm not sure what to do with this issue though - should we ask for permission for the api change, bump it to D9, or mark as won't fix?

jhodgdon’s picture

Status: Active » Reviewed & tested by the community
Issue tags: +API change

I don't understand why you changed the status. It still needed a review?

Anyway... The patch is OK. The only place in core that used the language code (4th, now 3rd, parameter) was the one that this patch fixes in search.module search_index(), and I've verified that all the other calls only pass in the first two parameters.

Let's see whether it can go in. It's a minor change, because no one was using this parameter... If it is rejected then we at least need to update the documentation of the $reindex parameter to say it doesn't do anything, and probably change its name to $unused, which seems silly. The $langcode parameter was added in D8 anyway, so the API is already different for D8 from what it was in D7.

ianthomas_uk’s picture

I changed the status because it is against the current policy to commit this to 8.x, so there seemed little point reviewing it for 8.x until that could be resolved.

Does it block release? -> No -> Is it a big deal? -> No -> Do not propose an API change.

Perhaps there should be a third question in there: "Are we confident that we have updated all calls to this API from Drupal core and contrib?" i.e. for critical / major issues we can change an API and contrib has to keep up, but if we want to change an API for normal or minor issues then we also need to provide patches for any affected contrib code. This is getting off topic though...

jhodgdon’s picture

Well, if it is not approved then we should change the parameter name to $unused and document it as such. The documentation is incorrect as it stands.

webchick’s picture

Status: Reviewed & tested by the community » Needs review

I'm not necessarily opposed to removing completely dead code, but I'm wondering why/when the code died and whether or not that's a bug.. because while I can confirm that the D8 version of search_reindex() contains no reference to that variable, the D7 version definitely did:

    // Don't remove links if re-indexing.
    if (!$reindex) {
      db_delete('search_node_links')->condition('sid', $sid)->condition('type', $module)->execute();
    }

So what's up with that?

jhodgdon’s picture

Issue summary: View changes

Sorry, I forgot to explain this in the issue summary. Summary is updated to explain why the parameter is not currently needed.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Setting back to RTBC in hopes that the explanation now in the issue summary is sufficient.

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Approved API change

Awesome, thanks, that totally makes sense.

Now it just needs to apply again. :D

jhodgdon’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
1.22 KB
xjm’s picture

Issue tags: +Quick fix
webchick’s picture

Title: Remove $reindex param in search_reindex() » Change notice: Remove $reindex param in search_reindex()
Priority: Minor » Major
Status: Reviewed & tested by the community » Active
Issue tags: +Needs change record

Ok, great.

Committed and pushed to 8.x. Thanks!

Marking for a brief change notice.

jhodgdon’s picture

Title: Change notice: Remove $reindex param in search_reindex() » Remove $reindex param in search_reindex()
Priority: Major » Minor
Status: Active » Fixed
Issue tags: -Needs change record

Special delivery: One change notice done.
https://drupal.org/node/2173329

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.