Last active
August 29, 2015 14:09
-
-
Save tkh44/6af5e50dc95a3f746d8c to your computer and use it in GitHub Desktop.
this is fun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newOptions += search.map((search: String) => { | |
val splitString: Array[String] = search.trim.split(" ") | |
val conjunction = Restrictions.conjunction | |
for (term <- splitString; disjunction = Restrictions.disjunction; searchString = "%" + term + "%" if term.nonEmpty) { | |
Array("name", "description") foreach((field) => disjunction.add(Restrictions.like(field, searchString))) | |
conjunction.add(disjunction) | |
} | |
conjunction | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment