2011-10-10 15 views
0

検索可能な0.6.3とgrails-1.3.7を使用しています。ドメインのhasManyプロパティをうまくマッピングできない場合は、例のようなhasManyプロパティをマップします。ドキュメント:検索可能な閉鎖でGrailsで検索可能なプラグインエラーマッピングhasMany

http://www.grails.org/Searchable+Plugin+-+Mapping+-+Class+Property+Mapping

comments component: true 

または

keywords index: 'not_analyzed' 

、このエラーが発生する

2011-10-10 15:20:53,788 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'compassGps': Cannot resolve reference to bean 'compass' while setting bean property 'compass'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Unable to map [com.ace.mws.servicetemplates.ServiceTemplate.services]. It does not appear to a suitable 'searchable property' (normally simple types like Strings, Dates, Numbers, etc), 'searchable reference' (normally another domain class) or 'searchable component' (normally another domain class defined as a component, using the 'embedded' declaration). Is it a derived property (a getter method with no equivalent field) defined with 'def'? Try defining it with a more specific return type 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compassGps': Cannot resolve reference to bean 'compass' while setting bean property 'compass'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Unable to map [com.ace.mws.servicetemplates.ServiceTemplate.services]. It does not appear to a suitable 'searchable property' (normally simple types like Strings, Dates, Numbers, etc), 'searchable reference' (normally another domain class) or 'searchable component' (normally another domain class defined as a component, using the 'embedded' declaration). Is it a derived property (a getter method with no equivalent field) defined with 'def'? Try defining it with a more specific return type 
     at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212) 
     at grails.web.container.EmbeddableServer$start.call(Unknown Source) 
     at grails.web.container.EmbeddableServer$start.call(Unknown Source) 
     at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158) 
     at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy) 
     at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280) 
     at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) 
     at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149) 
     at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) 
     at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116) 
     at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) 
     at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59) 
     at _GrailsRun_groovy$_run_closure8_closure14.doCall(_GrailsRun_groovy:263) 
     at _GrailsRun_groovy$_run_closure8_closure14.doCall(_GrailsRun_groovy) 
     at _GrailsPackage_groovy$_run_closure8.doCall(_GrailsPackage_groovy:299) 
     at _GrailsPackage_groovy$_run_closure8.call(_GrailsPackage_groovy) 
     at _GrailsRun_groovy$_run_closure8.doCall(_GrailsRun_groovy:245) 
     at RunApp$_run_closure1.doCall(RunApp:35) 
     at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) 
     at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) 
     at gant.Gant$_dispatch_closure7.doCall(Gant.groovy) 
     at gant.Gant.withBuildListeners(Gant.groovy:427) 
     at gant.Gant.this$2$withBuildListeners(Gant.groovy) 
     at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) 
     at gant.Gant.dispatch(Gant.groovy:415) 
     at gant.Gant.this$2$dispatch(Gant.groovy) 
     at gant.Gant.invokeMethod(Gant.groovy) 
     at gant.Gant.executeTargets(Gant.groovy:590) 
     at gant.Gant.executeTargets(Gant.groovy:589) 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Unable to map [com.ace.mws.servicetemplates.ServiceTemplate.services]. It does not appear to a suitable 'searchable property' (normally simple types like Strings, Dates, Numbers, etc), 'searchable reference' (normally another domain class) or 'searchable component' (normally another domain class defined as a component, using the 'embedded' declaration). Is it a derived property (a getter method with no equivalent field) defined with 'def'? Try defining it with a more specific return type 
     ... 29 more 
Caused by: java.lang.IllegalArgumentException: Unable to map [com.ace.mws.servicetemplates.ServiceTemplate.services]. It does not appear to a suitable 'searchable property' (normally simple types like Strings, Dates, Numbers, etc), 'searchable reference' (normally another domain class) or 'searchable component' (normally another domain class defined as a component, using the 'embedded' declaration). Is it a derived property (a getter method with no equivalent field) defined with 'def'? Try defining it with a more specific return type 
     at grails.plugin.searchable.internal.compass.mapping.ClosureSearchableGrailsDomainClassCompassClassMapper.invokeMethod(ClosureSearchableGrailsDomainClassCompassClassMapper.groovy:217) 
     at com.ace.mws.servicetemplates.ServiceTemplate$__clinit__closure1.doCall(ServiceTemplate.groovy:6) 
     at com.ace.mws.servicetemplates.ServiceTemplate$__clinit__closure1.doCall(ServiceTemplate.groovy) 
     at grails.plugin.searchable.internal.compass.mapping.ClosureSearchableGrailsDomainClassCompassClassMapper.searchableGetCompassClassPropertyMappings(ClosureSearchableGrailsDomainClassCompassClassMapper.groovy:97) 
     at grails.plugin.searchable.internal.compass.mapping.ClosureSearchableGrailsDomainClassCompassClassMapper.this$3$searchableGetCompassClassPropertyMappings(ClosureSearchableGrailsDomainClassCompassClassMapper.groovy) 
     at grails.plugin.searchable.internal.compass.mapping.ClosureSearchableGrailsDomainClassCompassClassMapper.getCompassClassMapping(ClosureSearchableGrailsDomainClassCompassClassMapper.groovy:129) 
     at grails.plugin.searchable.internal.compass.mapping.CompositeSearchableGrailsDomainClassCompassClassMapper.getCompassClassMapping(CompositeSearchableGrailsDomainClassCompassClassMapper.java:93) 
     at grails.plugin.searchable.internal.compass.mapping.AbstractSearchableGrailsDomainClassCompassClassMapper.getCompassClassMapping(AbstractSearchableGrailsDomainClassCompassClassMapper.java:52) 
     at grails.plugin.searchable.internal.compass.config.mapping.SearchableClassPropertySearchableGrailsDomainClassMappingConfigurator.configureMappings(SearchableClassPropertySearchableGrailsDomainClassMappingConfigurator.java:80) 
     at grails.plugin.searchable.internal.compass.config.DefaultGrailsDomainClassMappingSearchableCompassConfigurator.configure(DefaultGrailsDomainClassMappingSearchableCompassConfigurator.java:131) 
     at grails.plugin.searchable.internal.compass.config.CompositeSearchableCompassConfigurator.configure(CompositeSearchableCompassConfigurator.java:39) 
     at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.buildCompass(SearchableCompassFactoryBean.java:93) 
     at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:58) 
     ... 29 more 

答えて

0

これは既知の問題です。一般的な回避策は、上記のようにhasManyフィールドをマッピングしないか、save(flush:true)が呼び出される前にオブジェクトインスタンスにmerge(flush:true)を使用することです。 merge(flush:true)を使用すると、いくつかの状況で重複するオブジェクトが発生する可能性があり、検索インデックスを手動で維持する必要があるため、hasManyフィールドをより効率的にマッピングしたり、頭痛を軽減することができませんでした。問題の詳細についてはhereをご覧ください。

+0

私がhasManyをマップしないと、インデックスを作成する方法はありますか? Grails Searchable PluginのデフォルトのWebページでは、hasManyでの検索はできませんが、単純なStringの検索は許可されます。 – bitbucket

+0

インデックスを作成しようとしましたが、同じエラーが発生します。静的検索可能= {タグインデックス: 'いいえ'} – bitbucket

関連する問題