gorm - Search by the first match letters in word Grails -
how search result in grails first match letters in word in grails? example such query: findby...("moscow")
must have output: "mosquite", "moschino", etc.
what you're looking here easy if scope very narrow. if want search first n matching chars - use findby[domainclass]like
. can find documentation here.
an example this:
def size = params.query.size(); def results = thing.findbynamelike("${params.query[0..size]}%") // search length of query
however, way narrow you're looking do. may started but, if want serious search need additional tools. take @ searchable plugin located here. uses lucene engine amazing tool , possibly best way text based search in domain.
good luck!
Comments
Post a Comment