Metadata / index - multiple values

Hi. I would like to use a metadata field for a document that can have multiple values that is also able to build up an index with those multiple values.

Example: Let’s assume that we have a [datasheet document A] that can be referenced with multiple inventory items of my stock. So we have a metadata field [item_no] for [A] that needs to hold multiple values. How can this be made possible with Mayan? It would be also fine if there was one metadata field to hold a comma separated string. My goal is to create an index with multiple pointers to that document like so:

-> Item_No
  -> 12345 -> Document A
  -> 12346 -> Document A
  -> 23456 -> Document A
  -> 98787 -> Document B

What I have already tried is to use comma separated metadata values as one sting and split it to multiple values for the index like so:

{% with document.metadata_value_of.ItemNo|split:"," as numbers %}
  {% for number in numbers %}
    {{ number }}<br>
  {% endfor %}
{% endwith %}

But this leads into a multi-line index - which does not help.
Please advice me how to achive a documents that can be connected by multiple values of the same index.

Thanks, Torsten

Any idea for a solution or any workaround to have multiple index entries pointing to the same document?
Thanks

If I understood correctly your goal is to have the same document in different index levels.

This is not possible because the template system evaluates the template only once. The other issue would be how to let the template system know what is the delimiter character.

What you wish to accomplish requires having the index/templating system to support iteration. We have discussed this but have not come up with an implementation that covers all use cases. This is an area of ongoing research.

Hi Roberto.

Thanks for this clarification. I don’t need to have the document necessarily in different index levels but multiple times in the same index level. Let’s say we have one document which is valid for a bunch of companies. So it would be useful to have the same document linked to multiple company numbers via its index (“virtual directory”).


One option to do so would be to allow the relationship between Metadata <==> Documenttype to have the options None, Optional, Required and [MULTI], so that one data meta field of a document (i.e. company number) coult be assigned many times for the same document. And out of this field the (iterated) index could be created. Maybe this would be easier than the previous idea with the comma separated list of values?

It is possible to have the same document multiple times in the index but only if you use static values on the first level. I have indexes that have a static value „per month“ or „per year“ on the first level and then months or respectively years in the second level. You can then add the documents under each of these month/year nodes.

For your example this would however require a static list of item numbers and a potentially huge index definition which would be very inflexible when changes occur.