Adding Tags to Pictures on Bulk CSV Import?

Hi,

There seems to be many unanswered, or incomplete, questions regarding the ability to import 'tags' associated with doctypes upon use of the CSV importer.

A member of the community apparently wrote code to resolve, or add, this feature: https://github.com/nuxeo/nuxeo-csv/pull/1

Yet, it seems as though it hasn't been resolved fully? Any ideas from the Nuxeo core developers, or community?

Thanks,

-Yousuf

0 votes

1 answers

2217 views

ANSWER



It's possible that this may help others out.

A quick and dirty solution that I've found is to, after uploading all of my Pictures using the CSV importer, write a custom tool to update the PostgreSQL database directly with the desired tags. Of course, you must keep track, or maintain a map, of what belongs to whom on the Nuxeo server, as well as the newly generated unique id's created by your custom tool for the new tags and tagging objects, locally.

Here is the PostgreSQL script, and steps, necessary to do so:

1) Add a new tag to the 'hierarchy' table
2) Add the same tag to the 'tag' table
3) Add a new tagging to the hierarchy table using a new unique id and the same tag
4) Combine into relations table id = tagging-id, source=document-id, target=tag-id
5) That should work

examples:

1) INSERT INTO hierarchy (id,name,isproperty,primarytype,majorversion,minorversion) VALUES ('463dd5f1-28d3-4782-b6e2-b28dc0334f01','mynewtag','FALSE','Tag','0','0');

2) INSERT INTO tag VALUES ('463dd5f1-28d3-4782-b6e2-b28dc0334f01','mynewtag');

3) INSERT INTO hierarchy (id,name,isproperty,primarytype,majorversion,minorversion) VALUES ('5b8e577c-d0a6-5ccd-8d96-fbbf02f1efec','mynewtag','FALSE','Tagging','0','0');

4) INSERT INTO relation (id,source,target) VALUES ('5b8e577c-d0a6-5ccd-8d96-fbbf02f1efec','93241112-dd5e-40cc-9a33-cbce1da159e2','463dd5f1-28d3-4782-b6e2-b28dc0334f01');

I hope that there is a better solution out there, and I look forward to hearing from those who have one.

-Yousuf

0 votes