innoq/iqvoc

Additional hierarchy levels

Closed this issue · 2 comments

Is there any way to increase the number of levels that are returned with the hierarchy API call?

We have a metadata creation application (https://github.com/uhlibraries-digital/brays) that retrieves place names for a type-ahead from our controlled vocabulary application based on iQvoc: https://github.com/uhlibraries-digital/cedar

We've noticed that the returned hierarchy only goes four layers deep, and we have place names at lower levels: https://vocab.lib.uh.edu/en/hierarchy/place.html

Currently iQvoc's maximum hierarchy depth is fixed at four level because it's a very expensive operation to traverse such a deep tree: https://github.com/innoq/iqvoc/blob/master/app/controllers/hierarchy_controller.rb#L107

You can control it with depth-param as mentioned in hierarchy-api documentation: https://vocab.lib.uh.edu/apidoc/4.9.0/hierarchy/show.html

Example:

Try to modify max_depth-variable in app/controllers/hierarchy_controller.rb#L107.

Thanks @mjansing. Your suggestion to override the hierarchy_controller worked perfectly.
uhlibraries-digital/cedar@72d849c