To use Grails searchable plugin, I get these classes:
class person {
and:
class address {static searchable = {root false} string country}
I want to do a specific search for a particular country. "Country: NL" does not work "Address: Country: NL" either does not work, I did not find anything about syntax for it. any idea?
I think I have to do some clever sequencing or some other trick to stop searching, but I can not find it.
I created a basic app with two sections (Grails 1.3.5, searched 0.5.5.1) And searching for 'Country: NL' works for me Do you remember to call the index before trying to search?
Create grails-App Search Grain install-plugin searchable
person:
class person {constant search Qualified = {address component: true} address address}
address:
class address {static belongsTo = person constant searchable = {root false} String Country}
Bootstrap:
class bootstrap {def init = {servletContext -> Def p1 = new person (address: new address (country: 'nl')). Save () def p2 = new person (address: new address (country: 'd')). Save () def p3 = new person (address: new address (country: 'New Zealand')). Save () person. Endx ()} def = destroy = {}}
Then I searched for the country and searched for: NL and returned the person to 1.
If you want to see what is searching under the cover in relation to the field / indexed etc. - Luke is a very easy tool (just download the executable jar):
Index File
& lt; User.home & gt; / Grails / projects / & lt; Project name & gt; / Search-index / development / index
in
Cheers
Lee
Comments
Post a Comment