⟵ hearthere ⟶
  • Quick start
  • Install Totum
  • Updating
  • Optimization
  • Backups
  • bin/totum
  • Basics for users
  • Interface and Layout
  • Tables and their parameters
  • Fields and their parameters
  • Prefilter
  • Syntax
  • Code, actions, formatting
  • Relational associations
  • Calculation order and calculation units
  • Auto-complete calculations and timing
  • Duplicate rows and cycles
  • Comparisons
  • Functions
  • Debugging
  • Print and CSV
  • Roles and users
  • Notifications
  • System tables
  • [PRO] Crons
  • [PRO] Daemons
  • [PRO] API
  • [PRO] Exporting and importing tables
  • [PRO] Anonymous tables
  • [PRO] External Forms
  • [PRO] LDAP AD
  • [PRO] MeiliSearch
  • Installing meilisearch
  • Connect the search database to the Totum schema
  • Configure search data in the target table
  • Add tables to the search
  • [PRO] Only Office
  • [PRO] Trees
  • [PRO] Dynamic fields
  • [PRO] File versions
  • [PRO] 2FA
  • [PRO] Superlang
  • [PRO] Auth Tokens
  • [PRO] List-unsubscribe
  • [PRO] Databases
  • [PRO] Custom CSS
  • [PRO] Custom docs
  • [PRO] Profiler
  • [PRO] Connecting functions
  • [SRV] Installation and Connection
  • [SRV] Export, PDF, Upload, and Preview
  • [SRV] XLSX/DOCX Generators
  • PRO MeiliSearch


    youtube

    Video on YouTube ⟹


    Installing meilisearch

    Until version V7, meilisearch was installed using an installation script — check for the presence of the /home/totum/meilifiles folder.

    Below is the installation guide on the same server where Totum is installed:

    From the totum user:

    su totum
    

    Create a folder:

    cd /home/totum && mkdir meilisearch && cd ./meilisearch
    

    Download the binary:

    curl -L https://install.meilisearch.com | sh
    

    Generate the key file:

    printf "MEILI_MASTERKEY=%s\n" "$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c24)" > /home/totum/meili_masterkey
    

    Create the service file (one multi-line command):

    cat << EOF > /home/totum/meilisearch/meilisearch.service
    [Unit]
    Description=Meilisearch
    After=systemd-user-sessions.service
    
    [Service]
    Type=simple
    EnvironmentFile=/home/totum/meilisearch/meili_masterkey
    WorkingDirectory=/home/totum/meilisearch
    ExecStart=/home/totum/meilisearch/meilisearch --no-analytics --db-path ./meilifiles --env production --master-key $MEILI_MASTERKEY
    User=totum
    Group=totum
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    EOF
    

    Switch to root:

    exit
    

    Connect the service:

    ln -s /home/totum/meilisearch/meilisearch.service /etc/systemd/system/meilisearch.service
    
    systemctl daemon-reload
    
    systemctl enable meilisearch.service
    
    systemctl start meilisearch.service
    
    service meilisearch status
    

    Connect the search database to the Totum schema

    Fill in h_hosthttp://localhost:7700 (you can right-click and select Default).

    If the host is on a remote server, the address of the remote server should be entered.

    In h_key, enter the key created during the installation stage, with which the search database is launched.

    The key in the meili_masterkey file:

    cat /home/totum/meilisearch/meili_masterkey
    

    In index_name, enter the schema in the search database — a good practice is to make it similar to the Totum schema.

    The schema is added to the search database at the moment the value is saved in the field — try to do this only once.

    You can check the addition of the schema by clicking on Connect code.

    Search limit is 20 by default. If you need to display a different maximum number of search options, enter a number.

    We do not recommend setting a large number, as they will not fit on the screen anyway.

    To set search settings, fill in settings with the following parameters (this can be done by right-clicking on the field):

    {
      "displayedAttributes": [
        "pk",
        "index",
        "catalog",
        "title",
        "text"
      ],
      "searchableAttributes": [
        "title",
        "index"
      ],
      "attributesForFaceting": [
        "catalog",
        "table"
      ]
    }
    

    Show settings — shows the current search index (schema) settings.

    Index it — allows you to manually pass rows to the search index by specifying table_id + / + row_ids separated by commas.

    • If the rows were absent in the index, they will be added.

    • If they were present, they will be updated.

    The table must be added to the search tables and have a technical field ttm_search in the row part with the correct data format!

    Delete from index — allows you to manually delete rows from the index similarly to Index it.

    If you pass table_id/*ALL*, the search index for the entire table will be deleted.

    Search — search, the result of which is shown in json.

    The h_get_updates field is responsible for displaying the search button in the interface. It is calculated by code based on h_host, h_key, h_index_name, h_settings, but you can set the value manually. For example, disable it until table settings are entered.

    Configure search data in the target table

    Create a field of type data with name = ttm_search (mandatory!) in the target table. The search will be updated when this field is added (row), changed, and deleted (row). The content of this field is passed to the search database, which must match the format:

    {
      "index": "data for search",
      "title": "title for this index",
      "catalog": "catalog name from ttm__search_catalog"
    }
    

    base

    For example:

    = : rowCreate(field: "index" = str`#field_1 ++ #field_3`; field: "title" = #field_3; field: "catalog" = "video")
    

    The catalog parameter is passed the name of the catalog, which needs to be created in the ttm__search_catalog table.

    For a simple table, don't forget to recalculate the rows so that the data in ttm_search is updated, and then check the data structure in a couple of rows.

    Add tables to the search

    base

    After that, you need to add the table to the row part in ttm__search_settings and fill in the code and buttons parameters.

    • code — the action code that will be executed when clicking on the search result tile. It is executed from the table row containing the search result and receives the corresponding environment data.

    • buttons — extends possible actions by adding buttons to the search result tile.

    To index (add to the search database) the data of the added table, click Index table.