cancel
Showing results for 
Search instead for 
Did you mean: 

No result when using ILIKE operator on the REST API

Julien_ROY
Champ in-the-making
Champ in-the-making

Hi, I'm trying to use the ILIKE operator with the REST API.

I have a Workspace named 'Shared' on my instance, so from the Nuxeo NXQL Console it is working with "SELECT * FROM Document WHERE dc:title LIKE / ILIKE 'Shared' ".

When I use GET (with Postman for example) on " http://NUXEO_SERVER/nuxeo/api/v1/search/lang/NXQL/execute?query=SELECT * FROM Document WHERE dc:title LIKE 'Shared' " it is working, but when I use the ILIKE operator on this request, I have no result.

Am I doing something wrong, or have I forgot something?

3 REPLIES 3

Peter_Tucker
Confirmed Champ
Confirmed Champ

Hi Julien!

I tried to recreate your setup with my own local instance of nuxeo (8.10). I created a workspace named "Shared". I then used the API by typing in my browser:

" http://NUXEO_SERVER/nuxeo/api/v1/search/lang/NXQL/execute?query=SELECT * FROM Document WHERE dc:title ILIKE 'Shared' "

Obviously replace NUXEO_SERVER with what your server is, but this worked on my end and returned the document in the results. Keep in mind when placing in a browser, it will fill in spaces and special characters with encoded URL codes. So it will actually look like this:

" http://NUXEO_SERVER/nuxeo/api/v1/search/lang/NXQL/execute?query=SELECT%20*%20FROM%20Document%20WHERE... "

I would review the query you are using and check which operator you using, because it sounds like the reverse is happening of what's expected. If you were to use LIKE with 'shared', you would get no results (since the dc:title = "Shared"). If you use ILIKE, it should return.

Perhaps this is an issue tied with elasticsearch settings or the documents in the repository need to be re-indexed. Try re-indexing by going to the Admin section and going to Elasticsearch -> Admin (sub tab) and re-index the Shared workspace (I would use the 'Reindex Document and it's Children' where you just need to provide the Document ID). Then try the NXQL query again.

If you need more information, take a look here about endpoints https://doc.nuxeo.com/nxdoc/search-endpoints/

And about elasticsearch (and if you need to trace a search) https://doc.nuxeo.com/admindoc/60/elasticsearch-setup/#ElasticsearchSetup-ActivateTraces

I hope this helps a bit.

Julien_ROY
Champ in-the-making
Champ in-the-making

Hi, thanks for the response. I tried to reindex as you said but I have the same problem.

For more precision, I use Postman to make requests. Postman encodes itself the URL so there is no problem from this side. I have tested this comportment on a Nuxeo Docker container, and with the Nuxeo installer for Windows, both in the 10.10 version. I tried the request on a local instance and also from a Nuxeo behind a reverse-proxy.

The request:

  • "http://localhost:8080/nuxeo/api/v1/search/lang/NXQL/execute?query=SELECT%20%2A%20FROM%20Document%20WHERE%20dc:title%20ILIKE%20%27Shared%27"
  • does not have any result.

But the request :

  • "http://localhost:8080/nuxeo/api/v1/search/lang/NXQL/execute?query=SELECT%20%2A%20FROM%20Document%20WHERE%20dc:title%20LIKE%20%27Shared%27"
  • has the right result.

I also tried to put the '%' in front and behind 'Shared' but the result is still the same.

So to resume with the Search API endpoint with a 'Shared' named workspace, I try:

  • LIKE 'Shared' -> ok

  • LIKE 'shared' -> PROBLEM

  • LIKE '%Shared%' -> ok

  • LIKE 'Shared%' -> ok

  • LIKE '%Shared' -> ok

  • ILIKE 'Shared' -> problem

  • ILIKE 'shared' -> problem ...

I try to create an extension in javascript with search functionality, but without the ILIKE operator working it is a bit complicated.

Hi! Thanks for giving more feedback on what you've tried. I took the two links you posted and compared them with my local instance. The first one where for you, you had no results, I had results.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.