2 つのクラスを使用して基本的なアプリ (Grails 1.3.5、Searchable 0.5.5.1) を作成し、「country:NL」を検索するとうまくいきます。検索を試みる前に index() を呼び出すことを覚えていましたか?
grails create-app search
grains install-plugin searchable
人:
class Person {
static searchable = {
address component: true
}
Address address
}
住所:
class Address {
static belongsTo = Person
static searchable = {
root false
}
String country
}
ブートストラップ:
class BootStrap {
def init = { servletContext ->
def p1 = new Person(address:new Address(country:'NL')).save()
def p2 = new Person(address:new Address(country:'DE')).save()
def p3 = new Person(address:new Address(country:'NZ')).save()
Person.index()
}
def destroy = {
}
}
次に、/searchable をブラウズし、country:NL を検索したところ、人 1 が返されました。
フィールド/インデックスなどに関して Searchable が内部で何をしているかを確認したい場合 - Luke は非常に便利なツールです (実行可能な JAR をダウンロードするだけです): http://code.google.com/p/luke/
インデックスファイルは
<user.home>/.grails/projects/<project name>/searchable-index/development/index
乾杯
リー