📂Indexing

Description of indexing for Iris. What is indexing and how can it be used ?

Indexing must be performed on documents

Indexing is mandatory before interrogating a document (pdf for instance). The Interrogation brick does not index documents before interrogating it, so you need to explicitely index it.

Indexing is optional for strings

Indexing can be done on string but is optional. The Interrogation brick indexes strings before interrogating it. But there will be a new indexation each time, so indexing it once can save time.

Example of use case

In order to interrogate a project brief to get precise information about technicalities, we first index the document, and then interrogate it.

API

Index a document

⚠️ You can only index a single document for now

The id of the indexed document will be returned. Keep it to be able to interrogate it later !

import requests

token = 'JWT ' + ''  # set your token here
url = "https://iris.egis-group.com/api/cgpt_structure/task_execute/?label_task=indexing_pdf_document"

payload = {}
files=[
  ('document_list',('name_file.pdf',open('path_to_file.pdf','rb'),'application/pdf'))
]
headers = {
  'Authorization': token
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

Index a string

You can index a list of string, it will return a list of ids

import requests
import json

token = 'JWT ' + ''  # set your token here
url = "https://iris.egis-group.com/api/cgpt_structure/task_execute/?label_task=str_indexing"

payload = json.dumps({
  "string_list": [
    "String 1",
    "String 2",
    ]
})
headers = {
  'Authorization': token,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

Last updated