Hibernate 搜索注释未继承

发布于 2024-08-05 02:35:23 字数 462 浏览 3 评论 0原文

我正在索引一个类,其超类具有以下注释:

@Indexed
@Entity
@Inheritance(strategy = InheritanceType.JOINED)

相同的 @Inheritance 注释位于子类上。超类的注解都在方法上。我想要在超类上建立索引的字段将被忽略:


@Field(index=Index.UN_TOKENIZED,store=Store.YES)
@FieldBridge(impl=org.hibernate.search.bridge.builtin.BooleanBridge.class)
@Type(type="yes_no")
public boolean isFlagged() {
    return flagged;
}

超类仅具有标记的属性和 ID。 ID 显示正常,因为它有 @Id 注释,但我不确定为什么 flagged 没有索引。我发现

I am indexing a class whose superclass has the following annotations:

@Indexed
@Entity
@Inheritance(strategy = InheritanceType.JOINED)

The same @Inheritance annotation is on the subclass. The annotations of the superclass are all on methods. The field I want indexed on the superclass is ignored:


@Field(index=Index.UN_TOKENIZED,store=Store.YES)
@FieldBridge(impl=org.hibernate.search.bridge.builtin.BooleanBridge.class)
@Type(type="yes_no")
public boolean isFlagged() {
    return flagged;
}

The superclass only has the flagged property and the ID. The ID shows up fine, because it has the @Id annotation, but I'm not sure why flagged is not indexed. I found this post but it doesn't give a clear answer. What could I be doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感性 2024-08-12 02:35:23

你的子类上也有 @Indexed 注释吗?你应该。
如果您发布完整注释的超类和子类代码,可能会有所帮助。
isFlagged 上的 @FieldBridge 注释是不必要的。 BooleanBridge 是默认值。

顺便说一句,您可能会在 Hibernate 搜索论坛 上更幸运地回答这个问题。

——哈代

Do you have the @Indexed annotation also on the subclass? You should.
It would probably help if you post the fully annotated super- and sub-class code.
The @FieldBridge annotation on isFlagged is unnecessary. BooleanBridge is the default.

BTW, you might have more luck with this question on the Hibernate Search Forum.

--Hardy

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文