Index by document type

241 views
Skip to first unread message

Valen

unread,
Aug 19, 2018, 3:45:48 AM8/19/18
to Mayan EDMS
Hi!

I seem to have understand the concept of indices and it is great!

I would like to build a simple 1 level index (for now) with the document type as first level. I have not managed to access the type, how do I do that? Is it at all possible?

Also: I have not found this in the docs, are the indices build regularly or only manually? If the latter, can I then make a cron-job using the API?

Thanks and have a great day!

Roberto Rosario

unread,
Aug 20, 2018, 12:02:33 AM8/20/18
to Mayan EDMS
Hello, that's great :) Indexes are the "killer" feature of Mayan. They allow automatic categorization of documents.

Once created, indexes are updated automatically when the document type, metadata or tags change. When you change the structure of an index by editing its template you need to trigger a rebuild using the "Rebuil Index" entry on the Tools menu. This is also needed if you create a new index and already have uploaded documents in the system.

For a document type index. These are the steps required:

1. Create a new index and name it "By document type" and add a similar entry for the name. The name is an identifier in case you want to reference this index in other parts of Mayan. That is why it is formatted like a variable name (no spaces, special characters).
2. Create a new child node template under the "Root" node. 
3a. Use the following text for the template: {{ document.document_type }}
3b. Click on "Link documents". This is to put links to the corresponding documents of the document type being generated. Sometimes you want an index level with other sub index levels, in those cases you keep "Link documents".
4. Associate this index with the document type you want it to react to. Use the "Document types" button of the index.
5. Rebuild the index using the Tools menu.

There will by a new entry under the "Index" main menu. Every time a document is uploaded or modified a link will appear under the corresponding document type. If you create a new document type don't forget to associate it with the index.

When you become comforntable with index template you can create mult level indexes. For example: A top level for each document type and sub level for the value of a metadata field like "supplier" or "organization". All the properties of a document can be used as source for the index levels. The index template also support conditional statements for even more intricate index structures.

{% if document.metadata_value_of.invoice_number.0 == "A" %}Accounting 
{% if document.metadata_value_of.invoice_number.0 == "H" %}Human Resources
{% endif %}

This creates an index level whose value changes based on the first character of the invoice number of the document for different departments.

I'll start an "Index recipes" page on the wiki (wiki.mayan-edms.com) so users can add their own indexes for specific use cases.
Screenshot from 2018-08-19 23-40-44.png
Screenshot from 2018-08-19 23-41-09.png
Screenshot from 2018-08-19 23-41-31.png
Screenshot from 2018-08-19 23-41-48.png
Screenshot from 2018-08-19 23-42-07.png

Valen

unread,
Aug 20, 2018, 1:43:03 AM8/20/18
to Mayan EDMS
Hi!

Thank you very much! Works as advertised.

Yes indexing is a killer feature! I managed to make an index "original date" in conjunction with the document analyzer regexing the date out of the documents. Works very well. I can make a recipe for that in the wiki too, if you like.

The main issue I have is the state of the documentation in this case, I had no idea that I could access the document type that way. Is there already an overview of how to access the data associated with an document with templating? I get metadata and analyzer data, but what about the built in stuff like document type (answered here), langauge, filename etc. An overview for that would be nice.

Thank you very much and have a great day!

Valen

unread,
Aug 20, 2018, 6:17:02 AM8/20/18
to Mayan EDMS
BTW I found a bug (maybe?): If I make a more complex index defenition, it will become a multiline configuration. When I mount that with the fuse (the other killer feature!), the folder names are all wacky because of the newlines not stripped away like in the web UI....


On Monday, August 20, 2018 at 6:02:33 AM UTC+2, Roberto Rosario wrote:
Reply all
Reply to author
Forward
0 new messages