Permalink
Browse files

regex match operator for string fields

  • Loading branch information...
1 parent 125ca03 commit 091c2d5dd9dc40821fd5ff0989a090b8b91ee006 @jliszka jliszka committed Dec 19, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/main/scala/com/foursquare/rogue/QueryField.scala
@@ -13,6 +13,7 @@ import net.liftweb.record._
import net.liftweb.mongodb.record.field.{BsonRecordField, BsonRecordListField, MongoCaseClassField, MongoCaseClassListField}
import org.bson.types.ObjectId
import org.joda.time._
+import scala.util.matching.Regex
object CondOps extends Enumeration(0, "$ne", "$lt", "$gt", "$lte", "$gte",
"$in", "$nin", "$near", "$all", "$size",
@@ -198,7 +199,7 @@ class StringQueryField[M <: MongoRecord[M]](val field: Field[String, M]) {
new EqClause(field.name, p) {
override lazy val actualIndexBehavior = IndexBehavior.DocumentScan
}
-
+ def matches(r: Regex) = matches(r.pattern)
def regexWarningNotIndexed(p: Pattern) = new EqClause(field.name, p)
}

0 comments on commit 091c2d5

Please sign in to comment.