Search metadata

Hi, i have Mayan EDMS 4.4.2.
Is it possible to search through a combination of metadata?
For example, I created 3 metadata as below:

  • Judge (which can take the value A, B or C)
  • Grade (which can be first appeal, second appeal or third appeal)
  • type (civil or criminal)
    If I wanted to search all the documents for a civil case with Judge A, second instance, would it be possible to do it? If yes, how?

Hi,

This is a complex query because it uses the combination of three pairs.

As a search query

It cannot be expressed using the user interface and needs to be composed manually. We created a search language used internally by Mayan that remains the same regardless of the search backend used. All user queries are translated into this language before processing.

Your search has 4 elements: 3 combinations plus 1 final combination of all first 3.

  1. “judge” AND “A”
  2. “grade” AND “second instance”
  3. “type” AND “civil”
  4. #1 AND #2 AND #3

Written in Mayan’s search language that would be:

Element 1, Judge:

__J0_metadata__metadata_type__name=="judge"&__J1_metadata__value=="A"&__J2=AND_J0_J1

Element 2, Grade:

__G0_metadata__metadata_type__name=="grade"&__G1_metadata__value=="first grade"&__G2=AND_G0_G1

Element 3, Type:

__T0_metadata__metadata_type__name=="type"&__T1_metadata__value=="civil"&__T2=AND_T0_T1

Element 4, combine all previous 3:

__R=AND_J2_G2_T2&__result=R

The complete URL is as follows:

https://< Your Mayan EDMS URL >/#/search/results/?_search_model_pk=documents.documentsearchresult&__J0_metadata__metadata_type__name=="judge"&__J1_metadata__value=="a"&__J2=AND_J0_J1&__G0_metadata__metadata_type__name=="grade"&__G1_metadata__value=="first grade"&__G2=AND_G0_G1&__T0_metadata__metadata_type__name=="type"&__T1_metadata__value=="civil"&__T2=AND_T0_T1&__R=AND_J2_G2_T2&__result=R

If you typed it correctly the search explainer should look like this or similar.

The same search works via the API:

https://< Your Mayan EDMS URL >/api/v4/search/documents.documentsearchresult/?__J0_metadata__metadata_type__name=="judge"&__J1_metadata__value=="a"&__J2=AND_J0_J1&__G0_metadata__metadata_type__name=="grade"&__G1_metadata__value=="first grade"&__G2=AND_G0_G1&__T0_metadata__metadata_type__name=="type"&__T1_metadata__value=="civil"&__T2=AND_T0_T1&__R=AND_J2_G2_T2&__result=R

As an index

You can also use a multi level index to automatically categorize the documents by these values.

If the order Judge → Grade → Type does not work, you can use any order, or create multiple indexes with different orders:

  • Grade → Type → Judge
  • Type → Judge → Grade.