英文:
ORDS not like - is it possible?
问题
我正在尝试使用 Oracle ORDS 端点,这部分是正确的。问题出现在当我尝试添加一个类型为 NOT LIKE 的查询时,我收到了 400 - 错误的请求。
我的 URL 如下:
https://my.api.com/v1/results?q="type":{"$not like":"FP%"}}
编码后的 URL 如下:
https://my.api.com/v1/results?q=%7B%22type%22%3A%7B%22%24notlike%22%3A%22FP%25%22%7D%7D
我还尝试了以下方式:
https://my.api.com/v1/results?q=%7B%22type%22%3A%7B%22%24not%20like%22%3A%22FP%25%22%7D%7D
但它们都不起作用。如果我只使用 LIKE,API 就按预期工作。问题是是否支持 NOT LIKE?如果不支持,我可以使用什么解决方法?
英文:
I'm trying to consume Oracle ORDS endpoint which works correct. The problem is when i try to add a query of type NOT LIKE
I'm receiving - bad request (400)
My URL looks like :
https://my.api.com/v1/results?q="type":{"$not like":"FP%"}}
encoded :
https://my.api.com/v1/results?q=%7B%22type%22%3A%7B%22%24notlike%22%3A%22FP%25%22%7D%7D
I've also tried with :
https://my.api.com/v1/results?q=%7B%22type%22%3A%7B%22%24not%20like%22%3A%22FP%25%22%7D%7D
but not of them works. If i use only LIKE , the API works as expected.
The question is if NOT LIKE is supported at all ? If not what workaround i could use ?
答案1
得分: 2
我们不支持“NOT LIKE”谓词的查询参数过滤。您可以在文档中查看完整列表。
我们提供的是$instr和$ninstr。
因此,通过在我的活动列表上添加此查询参数过滤 -
/?q={"activity_name":{"$ninstr":"run"}}
将返回不包含名称中的RUN、run或Run的活动。
英文:
We don't support a query parameter filter for a 'NOT LIKE' predicate. You can see the full list in the docs
What we do have is $instr and $ninstr
I have examples for using INSTR and LIKE here.
So a GET on my activities list, with this query parameter filter added -
/?q={"activity_name":{"$ninstr":"run"}}
Brings me back activities that that don't have RUN, run, or Run in the name is said activity.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论