How to customize Mayan Advanced Search

Hi,
I installed Mayan edms via docker (Docker Compose installation — Mayan EDMS 4.4.2 documentation), I would like to change the advanced search page by deleting some fields and showing a drop-down menu for example in the metadata section (thus showing options based on the existing metadata). I know it can be done by accessing files with source code also through the command prompt but I couldn’t… how can I do?

Hi,

You can modify which fields are enabled for searching by modifying the search.py of each app. For example, this is how document fields are configured for search.

search_model_document.add_model_field(
    field='document_type__label', label=_('Document type label')
)
search_model_document.add_model_field(field='datetime_created')
search_model_document.add_model_field(field='label')
search_model_document.add_model_field(field='description')
search_model_document.add_model_field(field='uuid')
search_model_document.add_model_field(
    field='files__checksum', label=('Document file checksum')
)
search_model_document.add_model_field(
    field='files__filename', label=('Document file filename')
)
search_model_document.add_model_field(
    field='files__mimetype', label=('Document file MIME type')
)

You can also add or remove existing search fields from your own app even if they are defined elsewhere. To remove external fields from your app use the SearchModel method remove_search_field(self, search_field).

For example, search_model_document.remove_search_field(search_field='files__mimetype').

1 Like

Thanks for the reply!
The problem is: i can’t see this file.
Starting from the link (put in the question), only the .env file and the docker-compose.yml file are downloaded. To access the files I have to:

  • enter in the prompt (terminal),
  • connect to the Mayan app image and look for the file (I can’t find it in any directory).
    If I download the Mayan documents from Github I find this file in mayan>apps>documents>search.py (in this case I could edit the file on my pc and then create a new container for Mayan )

What you are attempting to do requires changing the code and building your own custom version. It is not a configuration change but a change in the source and requires programming experience.

I recommend you familiarize yourself with Docker, Python, Django, Mayan source code and coding practices in order to accomplish the customizations you are attempting.

i’m sorry… I didn’t want to change the source code, I find the advanced search interface a bit complicated and I wanted to simplify it.
For example, if you want to do an advanced search based on the document rather than having a form with the items: "ID, Document type label,…UUID, Document file checksum, Document file MIME type " ect, simply display the items: “Name, Date , Document Type Label, Metadata Value”