foliolib.folio.api.search.SearchAdmin

class foliolib.folio.api.search.SearchAdmin(okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioAdminApi

Search API Administration

Search API

Parameters

okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

createlanguageconfig(languageConfig)

Save languages that will be used for analyzers

deletefeatureconfigurationbyid(featureId)

Delete feature configuration by id

deletelanguageconfig(code)

Delete all supported languages

getallfeatures()

Get all feature configurations per tenant

getalllanguageconfigs()

Get all supported languages

indexrecords(indexRecordRequest)

Indexes the records into elasticsearch.

savefeatureconfiguration(featureConfig)

Save feature configuration (enables or disables pre-defined optional search options)

updatefeatureconfiguration(featureId, ...)

Update feature configuration settings

updatelanguageconfig(code, languageConfig)

Update language config settings

createlanguageconfig(languageConfig)

Save languages that will be used for analyzers

POST /search/config/languages

Parameters

languageConfig (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises

OkapiRequestUnprocessableEntity – Validation error for the request.

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "description": "Language config",
    "properties": {
        "code": {
            "type": "string",
            "description": "An ISO-639-2/B compatible language code.",
            "pattern": "[a-zA-Z]{3}"
        },
        "languageAnalyzer": {
            "type": "string",
            "description": "Custom elasticsearch analyzer for language."
        }
    },
    "additionalProperties": false,
    "required": [
        "code"
    ]
}
deletefeatureconfigurationbyid(featureId)

Delete feature configuration by id

DELETE /search/config/features/{featureId}

Parameters

featureId (str) – Feature id (name) (enum: [‘search.all.fields’, ‘browse.cn.intermediate.values’, ‘browse.cn.intermediate.remove.duplicates’])

Raises

OkapiRequestNotFound – No feature configuration is found by id

deletelanguageconfig(code)

Delete all supported languages

DELETE /search/config/languages/{code}

Parameters

code (str) – Language code (pattern: [a-zA-Z]{3})

Raises

OkapiRequestNotFound – No language support is found

getallfeatures()

Get all feature configurations per tenant

GET /search/config/features

Returns

See Schema below.

Return type

dict

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "description": "Feature configs response per tenant",
    "properties": {
        "features": {
            "type": "array",
            "description": "Configured features per tenant",
            "items": {
                "$ref": "featureConfig.json"
            }
        },
        "totalRecords": {
            "type": "integer",
            "description": "Total records that matches the query.",
            "minimum": 0
        }
    }
}
getalllanguageconfigs()

Get all supported languages

GET /search/config/languages

Returns

See Schema below.

Return type

dict

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "description": "Language config",
    "properties": {
        "languageConfigs": {
            "type": "array",
            "description": "Configured languages for a tenant",
            "items": {
                "$ref": "languageConfig.json"
            }
        },
        "totalRecords": {
            "type": "integer",
            "description": "Total records that matches the query.",
            "minimum": 0
        }
    },
    "additionalProperties": false,
    "required": [
        "languageConfigs",
        "totalRecords"
    ]
}
indexrecords(indexRecordRequest)

Indexes the records into elasticsearch.

POST /search/index/records

Parameters

indexRecordRequest (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises

OkapiFatalError – When unhandled exception occurred during code execution, e.g. NullPointerException

Schema

{
    "type": "array",
    "items": {
        "$ref": "#/components/schemas/resourceEvent"
    }
}
{
    "type": "object",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Folio search create index response",
    "properties": {
        "errorMessage": {
            "type": "string",
            "description": "Error message with the reason why index was failed to create."
        },
        "status": {
            "type": "string",
            "description": "Index creation status - success or error.",
            "enum": [
                "success",
                "error"
            ]
        }
    },
    "additionalProperties": false
}
savefeatureconfiguration(featureConfig)

Save feature configuration (enables or disables pre-defined optional search options)

POST /search/config/features

Parameters

featureConfig (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Validation errors

  • OkapiRequestUnprocessableEntity – Validation error for the request.

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "description": "Feature config request value",
    "properties": {
        "feature": {
            "description": "The feature name",
            "$ref": "tenantConfiguredFeature.json"
        },
        "enabled": {
            "type": "boolean",
            "description": "Action - enable or disable option"
        }
    },
    "additionalProperties": false,
    "required": [
        "feature",
        "enabled"
    ]
}
updatefeatureconfiguration(featureId, featureConfig)

Update feature configuration settings

PUT /search/config/features/{featureId}

Parameters
  • featureId (str) – Feature id (name) (enum: [‘search.all.fields’, ‘browse.cn.intermediate.values’, ‘browse.cn.intermediate.remove.duplicates’])

  • featureConfig (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Validation errors

  • OkapiRequestUnprocessableEntity – Validation error for the request.

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "description": "Feature config request value",
    "properties": {
        "feature": {
            "description": "The feature name",
            "$ref": "tenantConfiguredFeature.json"
        },
        "enabled": {
            "type": "boolean",
            "description": "Action - enable or disable option"
        }
    },
    "additionalProperties": false,
    "required": [
        "feature",
        "enabled"
    ]
}
updatelanguageconfig(code, languageConfig)

Update language config settings

PUT /search/config/languages/{code}

Parameters
  • code (str) – Language code (pattern: [a-zA-Z]{3})

  • languageConfig (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises

OkapiRequestUnprocessableEntity – Validation error for the request.

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "description": "Language config",
    "properties": {
        "code": {
            "type": "string",
            "description": "An ISO-639-2/B compatible language code.",
            "pattern": "[a-zA-Z]{3}"
        },
        "languageAnalyzer": {
            "type": "string",
            "description": "Custom elasticsearch analyzer for language."
        }
    },
    "additionalProperties": false,
    "required": [
        "code"
    ]
}