Promote tags from pdf to item?
Is there a way to promote tags from the pdf to the item?
All my papers are tagged on the pdf itself.
Not sure when this changed but I can no longer select by tag unless that tag is also in the item. I really don't want to manually retag every paper.
Alternately, is there a way to reenable the ability to select pdf's by tag?
All my papers are tagged on the pdf itself.
Not sure when this changed but I can no longer select by tag unless that tag is also in the item. I really don't want to manually retag every paper.
Alternately, is there a way to reenable the ability to select pdf's by tag?
But we do strongly recommend tagging the parent item, not the PDF, for most usage. It's the parent item that represents the reference. The file is incidental.
It would be possible to write a script that transferred tags from child items to parent items, but there's no built-in functionality to do so.
I wasn't aware that Zotero was scriptable, what resources are there on writing scripts for Zotero? It would be nice to properly tag my items.
Not tested, but running this from Tools → Developer → Run JavaScript will probably work:
var items = await Zotero.Items.getAll(Zotero.Libraries.userLibraryID, true);
for (let item of items) {
if (!item.isRegularItem()) continue;
let ids = item.getAttachments();
for (let id of ids) {
let attachment = await Zotero.Items.getAsync(id);
let tags = attachment.getTags();
for (let tag of tags) {
item.addTag(tag.tag);
}
attachment.setTags([]);
await item.saveTx({
skipDateModifiedUpdate: true
});
await attachment.saveTx({
skipDateModifiedUpdate: true
});
}
}
Make a backup of zotero.sqlite in your Zotero data directory and temporarily disable auto-sync in the Sync pane of the preferences before running it.