No result when using ILIKE operator on the REST API

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?

0 votes

1 answers

70 views

ANSWER



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%20dc:title%20ILIKE%20%27Shared%27 “

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.

0 votes