问题描述
我的情况很简单.我需要对一个字段进行包含/类似搜索.根据此文档,您可以进行正则表达式来实现此目的:
My case is very simple. I need to do a contains/like search over a field. Based on this documentation you can do a regex to achieve this:
items/item[name =~ ".*{value}.*"; skip pagination.startOn; limit pagination.numberOf; order +modifiedOn]
但是我在=~
运算符上遇到编译错误.检查编译错误的输出,我看到这是我拥有的选项
But I'm getting a compilation error at the =~
operator. Checking the output of the compilation error I saw that this are the options that I've
Hint: expected "!=" or "<" or "<=" or "==" or ">" or ">=" or "[" or "as" or "_" or "else" or "then" or "if" or "do" or "type" or "with" or "match" or "exists" or "in" or ' ' or ' ' or <spacing>
其中哪些选项允许我执行正则表达式查询?
Which of those options will allow me to do the regex query?
我正在使用此版本的opa(暂时无法使用)
I'm using this version of opa (I'm stuck with it for the moment)
OPA version 0.9.2
(c) 2007-2012 MLstate, All Rights Reserved.
Build: 1815-(fe5cc09)
推荐答案
对正则表达式的支持是Opa的新增功能,而且您的编译器已经过时.请注意,Mongo $regex
运算符可能会严重影响性能,因为它如何使用索引.参见讨论关于Opa中的文本搜索.
Regular expression support is quite new addition to the Opa, and you have outdated compiler. Note, that Mongo $regex
operator may impact performance significantly because of how it uses indexes. See the discussion on text search in Opa.
这篇关于如何在Opa中“点赞"查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!