grails - How to order by number of keywords found in sql/namedQuery -
i created query , or
select * xxx title ('%bon%') or title ('%test%')
i receive result : bonjour je test bonjour test bonjour test
and ordered number of word in title : bonjour je test test bonjour bonjour test
i use grails namedqueries.
is possible ?
thanks
you can use little trick count number of space characters , sort that.
select * xxx title ('%bon%') or title ('%test%') order (len(title) - len(replace(title, ' ', '')))
Comments
Post a Comment