2015-06-15 32 views
0

我的情況很簡單。我需要在字段上進行包含/類似的搜索。基於this documentation你可以做一個正則表達式來實現這一目標:如何在Opa中做'喜歡'的查詢?

items/item[name =~ ".*{value}.*"; skip pagination.startOn; limit pagination.numberOf; order +modifiedOn] 

但我在=~運營商得到一個編譯錯誤。檢查編譯錯誤的輸出我看到,這是我一直

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> 

其中的這些選項將允許我做的正則表達式查詢的選項?

我使用這個版本的OPA的(我卡與它的時刻)

OPA version 0.9.2 
(c) 2007-2012 MLstate, All Rights Reserved. 
Build: 1815-(fe5cc09) 

回答

0

正則表達式的支持是相當新增加的OPA,並且已經過時的編譯器。請注意,Mongo $regex運營商可能會顯着影響性能,因爲它使用索引的方式。請參閱the discussion關於Opa中的文本搜索。