denshoproject / ddr-cmdln

Command-line tools for automating the Densho Digital Repository's various processes.
Other
0 stars 2 forks source link

`ddrindex postjson` does not add `organization` type docs to ES index as expected #75

Closed GeoffFroh closed 6 years ago

GeoffFroh commented 6 years ago

The previous version of the indexing tool ddr-index had a subcommand to add organization -type docs to the ddr-public ES index. (ddr-index org)

The current version replaces this functionality with the more general-purpose ddrindex postjson command. However, it appears that it does not add all of the necessary attributes to the doc before it is posted to the ES index.

The remediation probably does not involve modifying ddrindex postjson; but perhaps adding a specific postorganization command instead...?

Here is an example of a valid organization doc in the index: { "_index": "ddrpublic-20180502a", "_type": "organization", "_id": "ddr-densho", "_version": 1, "_score": 1, "_source": { "id": "ddr-densho", "model": "organization", "parent_id": "ddr", "links_html": "ddr-densho", "links_json": "ddr-densho", "links_img": "ddr-densho/logo.png", "links_thumb": "ddr-densho/logo.png", "links_parent": "ddr", "links_children": "ddr-densho", "title": "Densho", "description": "DESCRIPTION TEXT HERE", "url": "http://densho.org", "repo": "ddr", "org": "densho", "cid": "", "eid": "", "sid": "", "role": "", "sha1": "" } }

And here is one that is posted by ddrindex postjson:

{ "_index": "ddrpublic-20180502a", "_type": "organization", "_id": "ddr-hwmf", "_version": 2, "_score": 1, "_source": { "id": "ddr-hmwf", "org": "hmwf", "repo": "ddr", "url": "http://heartmountain.org", "title": "Heart Mountain Wyoming Foundation", "description": "DESCRIPTION TEXT HERE" } }

gjost commented 6 years ago

ddrindex has repo and org subcommands but the help documentation wasn't updated. Fixed in commit ff98c91, will be in the next package. Syntax is as follows:

Post repository and organization:
  $ ddrindex repo REPO /var/www/media/ddr/REPO/repository.json
  $ ddrindex org REPO-ORG /var/www/media/ddr/REPO-ORG/organization.json

Note: ddrindex lists all the subcommands if you type the main command by itself. This is a nice feature of the Click library (http://click.pocoo.org). You can get help for each of the subcommands with the --help flag, e.g. ddrindex repo --help.