Full-Text Search

Overview

Full-Text Search operation allows querying the archive using an arbitraty string over a predefined collection of entity types grouped in index collections or as referred to in the operation paratemers doctype. Entities created in Documaster are indexed on a regular basis and available in those index collections for full-text queries to be executed.

Index Collection Name Indexed Entities
Tekst
  • Tekst (document text)
  • Dokumentversjon (latest only)
  • Dokument
  • AbstraktRegistrering (and its Noekkelord, Korrespondansepart, virksomhetsspesifikkeMetadata, secondary Klasse, and secondary Klassifikasjonssystem)
  • AbstraktMappe (and its Noekkelord, virksomhetsspesifikkeMetadata, primary Klasse, secondary Klasse, secondary Klassifikasjonssystem, Sakspart, Arkivdel, and Arkiv)
Korrespondansepart
  • Korrespondansepart
Registrering
  • AbstraktRegistrering (and its Noekkelord, Korrespondansepart, virksomhetsspesifikkeMetadata, secondary Klasse, and secondary Klassifikasjonssystem)
  • AbstraktMappe (and its Arkivdel, and Arkiv)
Mappe
  • AbstraktMappe (and its Noekkelord, virksomhetsspesifikkeMetadata, and Sakspart)
Arkivdel
  • Arkivdel

Using the index collection Tekst would be the default for most of the use cases related to full-text search.

Entities fields over which the queries are executed are listed in the table below. Whether a particular field is searched depends on the index collection used in the query.

Entity Searched Fields
Klasse
  • klasseIdent
  • tittel
AbstraktMappe
  • mappeIdent
  • tittel
  • offentligTittel
  • saksansvarlig
Sakspart
  • sakspartNavn
  • kontaktperson
AbstraktRegistrering
  • registreringsIdent
  • tittel
  • offentligTittel
Korrespondansepart
  • korrespondansepartNavn
  • epostadresse
  • kontaktperson
  • foedselsnummer
Dokument
  • beskrivelse
  • tittel
Tekst
  • text of the DocumentVersion (DokumentVersjon)
Noekkelord
  • verdi
Arkivdel
  • tittel

POST /noark5/v1/full-text/search

The operation is used to execute a full-text search over an index collection. The returned data is a list of Documaster entities identifiers and highlights of the matched string in the index collection.

HTTP Request
Field Location Mandatory Type Description
Authorization string access token aquired as part of the authentication call, prefixed with Bearer
X-Documaster-Error-Response-Type string custom header indicating that any error should be reported in JSON format, rather than the standard text format, should always be provided as application/json
$.doctype string name of the index collection, one of the values in the table above
$.query string free text search string
$.limit number maximum number of results to retrieve
Default : 10
$.offset number offset of the first result to retrieve
Default : 0
HTTP Response

The operation returns HTTP 200 OK in case of success or any of the standard error codes defined.

Field Location Type Description
Content-Type string content type header, always is application/json
$.total number total number of matched index entries
$.results[] array list index matching the query in the request
$.results[].ids object object containing one key for each of the Documaster entities part of the index result
$.results[].ids.{entityIDField} array string list of Documaster entities' IDs under the same entityIDField, where the entityIDField is in the form {entityType}.id

Examples :
  • Klasse.id
  • AbstraktMappe.id
$.results[].highlights object object containing one key for each of the entities fields which matched the query
$.results[].highlights.{entityField} array string list of matched values under the same entityField, where the entityField is in the form {entityType}.{entityFiled}. The value of the element contains the following tokens, representing highlights start and end -
  • Start of highlight - | =hlstart= |
  • End of highlight - | =hlend= |


Examples :
  • Korrespondansepart.korrespondansepartNavn
  • AbstraktMappe.tittel

      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
}

In the example above the search string Timothy Simpson was found only in a single entity in one of its Correspondence Party (Korrespondensepart) name - Korrespondansepart.korrespondansepartNavn.

The Registry Entry (Journalpost) which has this correspondence party is with ID = 11923 (identified by $.results[0].ids["AbstraktRegistrering.id"][0]).

The Registry Entry (Journalpost) is under a Case File (Saksmappe) with ID = 11919 (identified by $.results[0].ids["AbstraktMappe.id"][0]).

Identifying all the entities in the archival structure up to the Series (Arkivdel) can be done in the same way.