将自定义 Id 列映射与可搜索插件结合使用
我有一个带有自定义 Id 映射的 Domain 类
...
...
String ensemblGeneId
String ensemblTranscriptId
String ensemblProteinId
String proteinSequence
String topologySequence
String topologyRatio
String description
String geneName
..
..
..
static mapping = {
proteinSequence type:'text'
topologySequence type:'text'
description type:'text'
id name:'ensemblProteinId', generator:'assigned'
}
我在使用可搜索插件进行此操作时遇到问题
我将以下内容添加到类中
static searchable = {
id name:'ensemblProteinId'
except = ['topologySequence','proteinSequence']
}
数据插入完成后收到以下错误
2010-07-06 13:35:08,091 [http-8080-1] ERROR errors.GrailsExceptionResolver - Id with path [$/Protein/id] for alias [Protein] not found
org.compass.core.engine.SearchEngineException: Id with path [$/Protein/id] for alias [Protein] not found
似乎它仍在尝试查找名为的列id 而不是名为ensemblProteinId 的列。
可搜索插件是否应该与自定义 id 列一起使用,如果是的话我做错了什么?
I have a Domain class with a custom Id mapping
...
...
String ensemblGeneId
String ensemblTranscriptId
String ensemblProteinId
String proteinSequence
String topologySequence
String topologyRatio
String description
String geneName
..
..
..
static mapping = {
proteinSequence type:'text'
topologySequence type:'text'
description type:'text'
id name:'ensemblProteinId', generator:'assigned'
}
i have a problem making this work with the searchable plugin
i add the following to the class
static searchable = {
id name:'ensemblProteinId'
except = ['topologySequence','proteinSequence']
}
I receive the following error after the data insert is completed
2010-07-06 13:35:08,091 [http-8080-1] ERROR errors.GrailsExceptionResolver - Id with path [$/Protein/id] for alias [Protein] not found
org.compass.core.engine.SearchEngineException: Id with path [$/Protein/id] for alias [Protein] not found
it seems like it still tries to find a column named id instead of a column named ensemblProteinId.
is the searchable plugin supposed to work with custom id columns, if so what am i doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
自定义域 ID 和可搜索插件似乎确实存在问题。作为解决方法,您可以使用此处记录的罗盘注释来映射类:
http:// /grails.org/Searchable+Plugin+-+Mapping+-+Compass+annotations
和此处:
http://www.compass-project.org/docs/2.1.4/reference/html/core-osem.html
所以你的类看起来像:
我还将通过将行添加
到 log4j 配置块来启用 config.groovy 中的调试(您可能需要从错误块中删除“org.codehaus.groovy.grails.plugins”行!)
这将使您看到插件正在生成的罗盘映射。
吉姆.
There does appear to be an issue with custom domain ids and the searchable plugin. As a work around you can map the class using the compass annotations documented here:
http://grails.org/Searchable+Plugin+-+Mapping+-+Compass+annotations
and here:
http://www.compass-project.org/docs/2.1.4/reference/html/core-osem.html
So your class looks something like:
I'd also enable the debugging in your config.groovy by adding the lines
to your log4j configuration block(you may need to remove the 'org.codehaus.groovy.grails.plugins' line from the error block!)
This will let you see the compass mappings the plugin is producing.
Jim.