Full-Text Search Utilization

Usecase Details

API Consumer has the need to support full-text search over the archive and to visualize a list of folders (one of Case File (Saksmappe), Basic Folder (Mappe) or Meeting Folder (MoetteMappe)) based on the search results. The string used to execute the query can be contained in any of the fields supported by the Full-Text Search opeartion. For this purpose the most complete index collection is used - Tekst.

child-parent-relation

Authentication and Authorization (1, 2)

Aquiring an OAuth2 access token is done through the configured Identity Provider (IDP) used by the customer. Details on how to get the access token, how it should be cached and renewed can be found in Authentication and Authorization section of the documentation.

Execute Free-Text Search and Collect Results (3, 4, 5, 6)

The Free-Text Search executed returns in the sample below a single result. From the result the relevant Case File (Saksmappe) and Registry Entry (Journalpost) IDs are collected as follows:

  • Series (Arkivdel)
    • response path - $.results[0].ids['Arkivdel.id'][0]
    • ID = 11857
  • Case File (Saksmappe)
    • response path - $.results[0].ids['AbstraktMappe.id'][0]
    • ID = 11919
  • Registry Entry (Journalpost)
    • response path - $.results[0].ids['AbstraktRegistrering.id'][0]
    • ID = 11923

Extract the exact fields where the query value was found, in the sample below that is in a Correspondence Party name (Korrespondansepart.korrespondansepartNavn).

  • Highlights Key
    • response path - $.results[0].highlights.*~
    • value = Korrespondansepart.korrespondansepartNavn
  • Highlights Value
    • response path - $.results[0].highlights['Korrespondansepart.korrespondansepartNavn'][0]
    • value = |=hlstart=|Timothy|=hlstop=| |=hlstart=|Simpson|=hlstop=|

      Request

POST https://v2-34-0.local.documaster.tech:8083/rms/api/public/noark5/v1/full-text/search HTTP/1.1
...
Authorization: Bearer {{accessTokenIntegrator}}
Content-Type: application/json
X-Documaster-Error-Response-Type: application/json

{
  "doctype": "Tekst",
  "query": "Timothy Simpson"
}

      Response

HTTP/1.1 200 OK
...
Content-Type: application/json

{
    "results": [
        {
            "ids": {
                "Dokument.id": [
                    "11924"
                ],
                "Dokumentversjon.id": [
                    "11925"
                ],
                "AbstraktRegistrering.id": [
                    "11923"
                ],
                "AbstraktMappe.id": [
                    "11919"
                ],
                "Klasse.id": [
                    "11861"
                ],
                "Arkivdel.id": [
                    "11857"
                ],
                "Korrespondansepart.id": [
                    "11926"
                ]
            },
            "highlights": {
                "Korrespondansepart.korrespondansepartNavn": [
                    "|=hlstart=|Timothy|=hlstop=| |=hlstart=|Simpson|=hlstop=|"
                ]
            }
        }
    ],
    "facets": [],
    "total": 1
}

Collect Case File and Registry Entry Details (7, 8)

Once we have the identifiers of the Case Files and Registry Entries, the following queries can be executed.

In case more than one result is returned from the full-text search, the retrieval of the Case Files (Saksmappe) or Registry Entries (Journalpost) can be done in batches as shown below, where queries for three files/folders are presented. Keep in mind that the $.limit field should be set to the relevant number of expected results and should not exceed 500.

      Request Case Files

POST https://v2-34-0.local.documaster.tech:8083/rms/api/public/noark5/v1/query HTTP/1.1
...
Authorization: Bearer {{accessTokenIntegrator}}
Content-Type: application/json
X-Documaster-Error-Response-Type: application/json

{
  "type": "AbstraktMappe",
  "limit" : 1,
  "query": "id = @id",
  "parameters" : {
    "@id" : "11919"
  }
}

      Request Multiple Case Files

POST https://v2-34-0.local.documaster.tech:8083/rms/api/public/noark5/v1/query HTTP/1.1
...
Authorization: Bearer {{accessTokenIntegrator}}
Content-Type: application/json
X-Documaster-Error-Response-Type: application/json

{
  "type": "AbstraktMappe",
  "limit" : 3,
  "query": "id = @id1 || id = @id2 || id = @id3",
  "parameters" : {
    "@id1" : "11919",
    "@id2" : "11820",
    "@id3" : "11722"
  }
}

      Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "hasMore": false,
    "results": [
        {
            "type": "Saksmappe",
            "id": "11919",
            "version": "7",
            "fields": {
                "uuid": "bd53bcc6-752b-4b73-b14f-cc82e435c6dc",
                "opprettetDato": "2022-06-04T04:44:26.462+0200",
                "opprettetAv": "IDP Admin",
                "opprettetAvBrukerIdent": "f22f849b-8046-5190-b547-2da0cc103696",
                "mappeIdent": "2022/110",
                "tittel": "[Customer Complain] - John Doe",
                "offentligTittel": "[Customer Complain] - John Doe",
                "dokumentmedium": "E",
                "saksaar": 2022,
                "sakssekvensnummer": 110,
                "saksdato": "2022-06-04",
                "administrativEnhet": "AD1",
                "saksansvarlig": "IDP Admin",
                "saksansvarligBrukerIdent": "f22f849b-8046-5190-b547-2da0cc103696",
                "saksstatus": "B"
            },
            "links": {
                "refPrimaerKlasse": 11861,
                "refArkivdel": 11857
            }
        }
    ]
}

      Request Registry Entry

POST https://v2-34-0.local.documaster.tech:8083/rms/api/public/noark5/v1/query HTTP/1.1
...
Authorization: Bearer {{accessTokenIntegrator}}
Content-Type: application/json
X-Documaster-Error-Response-Type: application/json

{
  "type": "AbstraktRegistrering",
  "limit" : 1,
  "query": "id = @id",
  "parameters" : {
    "@id" : "11923"
  }
}

      Request Multiple Registry Entries

POST https://v2-34-0.local.documaster.tech:8083/rms/api/public/noark5/v1/query HTTP/1.1
...
Authorization: Bearer {{accessTokenIntegrator}}
Content-Type: application/json
X-Documaster-Error-Response-Type: application/json

{
  "type": "AbstraktRegistrering",
  "limit" : 3,
  "query": "id = @id1 || id = @id2 || id = @id3",
  "parameters" : {
    "@id1" : "11923",
    "@id2" : "11924",
    "@id3" : "11925"
  }
}

      Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "hasMore": false,
    "results": [
        {
            "type": "Journalpost",
            "id": "11923",
            "version": "7",
            "fields": {
                "uuid": "700e41ea-f0c0-4f89-be4a-32efad8d0001",
                "opprettetDato": "2022-06-04T04:46:46.889+0200",
                "opprettetAv": "IDP Admin",
                "opprettetAvBrukerIdent": "f22f849b-8046-5190-b547-2da0cc103696",
                "registreringsIdent": "2022/128",
                "tittel": "Payment Processing Failed",
                "offentligTittel": "Payment Processing Failed",
                "registreringsDato": "2022-06-04",
                "dokumentmedium": "E",
                "journalaar": 2022,
                "journalsekvensnummer": 128,
                "journalpostnummer": 1,
                "journalansvarlig": "IDP Admin",
                "journalansvarligBrukerIdent": "f22f849b-8046-5190-b547-2da0cc103696",
                "journalposttype": "I",
                "journalstatus": "J",
                "skjermKorrespondanseParterEInnsyn": false
            },
            "links": {
                "refMappe": 11919
            }
        }
    ]
}