Hi Ron,

I have made a small mistake when reimporting our publications database from scratch. We did not want to lose the authors Ids when deleting the old database content, so I just did a:
delete from `node` where `node`.`type`="biblio";

under Mysql.

The issue is that the author index (admin/settings/biblio/author) seems corrupt, as it reports an incorrect number of publication for a lot of authors.

Is there an easy way to rebuild the index?

Thank you

Comments

rjerome’s picture

I suspect the problem may lie in the the fact that the biblio related node information was not deleted from the node_revisions table, since every node has a corresponding entry in the node_revisions table.

Prior to your SQL command above, you should have executed...

DELETE FROM node_revisions 
WHERE node_revisions.nid IN (SELECT n.nid FROM node n WHERE n.type='biblio')

Which would first clear the biblio data out of the node_revisions table.

The only other problem you might encounter with the scenario you describe (deleting nodes but not authors) is if you made and modifications to author names AFTER you imported them the first time. If so, the second import will create a new author, but if you are seeing more additional publications attributed to authors, I still suspect the node_revisions table issue.

Ron.

sebos69’s picture

actually, priori to

delete from `node` where `node`.`type`="biblio";

I performed

delete `node_revisions` from `node_revisions`,`node` where `node_revisions`.`nid`=`node`.`nid` and `node`.`type`="biblio";

Is it similar to what you suggested? Sorry for the bothering...

rjerome’s picture

Yes, that appears to achieve the same result, so there must be a issue elsewhere. Thinking about this a bit more, you would have to empty the biblio_contributor (and biblio_keyword) table prior to reimporting because they both have references to nid's. Also, did you empty the biblio table prior to re-import?

sebos69’s picture

Also, did you empty the biblio table prior to re-import?

I don't think so... the two SQL requests were the only command I typed.

But here is a funny fact: under the "admin" username (first Id), this bug appears, but it seems to disappear when logged as a normal user with administration permissions.

rjerome’s picture

Do you have some "unpublished" biblio nodes? Only the admin would see those.

sebos69’s picture

Nope, there are no unpublished biblio nodes. It seems that the biblio nodes deleted by hand (wyth SQL queries) are still counted in the contributors list.

rjerome’s picture

Hmmm, I'm running out of ideas, here is the SQL that builds that page if that helps...

SELECT bd.cid, bd.drupal_uid, bd.name, bd.lastname,
                              bd.firstname, bd.prefix, bd.suffix, bd.initials,
                              bd.affiliation, bd.md5, COUNT(*) AS cnt
                            FROM {biblio_contributor} b
                                 LEFT JOIN {biblio_contributor_data} bd ON b.cid = bd.cid
                                 LEFT JOIN {node} n on n.vid = b.vid
                                 WHERE n.status = 1
                            GROUP BY bd.cid, bd.drupal_uid, bd.name, bd.lastname,
                                     bd.firstname, bd.prefix, bd.suffix,
                                     bd.initials, bd.affiliation, bd.md5
                            HAVING COUNT(*) > 0
                            ORDER BY  lastname ASC, SUBSTRING(firstname,1,1) ASC,
                            initials ASC
sebos69’s picture

OK, after digging a little bit more, I found something interesting. We had a similar issue with keywords (which are easier to debug on). One keyword was not used in any node, but it was present is an old version of the node (an old revision). So the keyword was not qualified as an orphaned keyword. Deleting the revision actually made the keyword orphan and the problem is fixed.

I guess this problem can occur for authors as well?

liam morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This version is no longer maintained. If this issue is still relevant to the Drupal 7 version, please re-open and provide details.