Orthanc tools/find API: Is there any limit on the length of the query value?

The following is the json I tried to POST to toots/find API. For the SOPInstanceUID key in Query, i want to specify hundreds or even thousands values of SOPInstanceUID. But, i got “Internal Server Error” as response. So, i want to confirm if there is any limit on the query length? Or is there other way to perform such kind of query? but seems it donest support json array here. Thanks.

{
“CaseSensitive”: true,
“Expand”: true,
“Level”: “Patient”,
“Query”: {
“PatientName”: “ABC”,
“SOPInstanceUID”: "1.3.46.670589.11.38008.5.24.5.1.7984.2021050809595065000\1.3.46.670589.11.0.0.51.4.56.1.38008.1.1300.1620472029195.1\…
},
“RequestedTags”: [
“PatientID”
]
}

Hello,

Have you tried escaping the backslashes, by doubling them? For instance:

$ curl https://orthanc.uclouvain.be/demo/tools/find -d '{"Level":"Instance","Query":{"SOPInstanceUID":"1.3.46.670589.11.0.0.11.4.2.0.8743.5.5396.2006120114290875518\\1.3.46.670589.11.0.0.11.4.2.0.8743.5.5396.2006120114290109505"}}'

Regards,
Sébastien-

Yes, I tried double backslashes between each query value. But it will return “internal server error” once the number of query values become large enough like 1000+.

So my question is if there is any limit for the query values? If so, any way to query with thousands query values? Thanks.

If there is such a problem, please provide a minimal working example for other people to independently reproduce your issue. We cannot afford to guess user problem scenarios by trial and error.

orthanc.json (43.6 KB)
Orthanc.log.20240913-044222.7276.txt (123.8 KB)
I40.dcm (809.4 KB)

search.json (54.2 KB)

Here are the mininal working example tried to provide, please let me know anything is still missing to help understand the issue.

  • orthanc.json should be the config file of my local orthanc server
  • Orthanc.log.20240913-044222.7276.txt is the trace log
  • I40.dcm is one of the sample DICOM file, there are more than 2000 in my case.
  • search.json is the body i POST to tools/find api

And i got the response result: Internal Server Error

So, i want to know if this is not supported by Orthanc or there is any problem of my query? Many thanks.

Hi,

As you’ll see in your logs:

E0924 16:25:11.183667           HTTP-5 StatementReference.cpp:89] SQLite: too many SQL variables (1)

So yes, you’ll have to rewrite your query differently. What are you actually trying to perform ?

got it, thanks a lot