(Quick Reference)
countHits
Purpose
Returns the number of hits for a specified search query.
Only domains that are root-mapped have this method injected.
Examples
def res = MyDomain.countHits("${params.query}")
def res = MyDomain.countHits {
queryString("${params.query}")
}
Description
search
signature:
def countHits(Closure query, Map params)
def countHits(Closure query)
def countHits(Map params, Closure query)
def countHits(String query, Map params)
def countHits(String query)
Parameters
query
- The search query. You may use one or more terms to look for, or use the Lucene syntax for advanced searching.
params
- A list of additional parameters to customize the searching process
Returned value
Returns an
Integer
representing the number of hits for the query.