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

2 answers

157 views

ANSWER



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.

0 votes



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.

Same thing with the 2nd localhost link, where you had results, I also had results.

So you are also using 10.10 version as well from what it sounds like. My next thing to try out would be to see if an earlier version of nuxeo works. Maybe try 9.10 and see if making a workspace named Shared there and try your queries again:

https://nuxeo.github.io/downloads.html

I haven't had any experience with using Postman, I've just run my instance locally and used a browser to place NXQL queries with links like:

“http://localhost:8080/nuxeo/api/v1/search/lang/NXQL/execute?query=SELECT%20%2A%20FROM%20Document%20WHERE%20dc:title%20ILIKE%20%27Shared%27”

06/20/2019


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