solr - Spring Data Solr - 支持本机(不是“匿名”或“未标记”)嵌套/子文档?
问题描述
据我了解,从 Solr 8 开始,有一种处理嵌套/子文档的新方法。
经典的 Solr 方式现在被称为“匿名”或“未标记”子文档。
以某种新方式支持 Spring Data Solr?
有人可以通过存储库编写两个 VO、save() 和 findAll() 的最简单示例吗?
首先 - 如何定义 VO?
@SolrDocument
public class ParentIndex {
@Id
@Indexed
private String id;
@ChildDocument//??
@Field(child = true)//??
private List<ChildIndex> childs;
}
@SolrDocument//SolrDocument on child??
public class ChildIndex {
@Id//child id??
@Indexed
private String id;
@Indexed
private String data;
}
第二 - 如何定义架构?
@EnableSolrRepositories(schemaCreationSupport = true) 不要创建这样的东西:
<field name="_root_" type="string" docValues="false" indexed="true" stored="false"/>
<field name="id" type="string" multiValued="false" required="true" stored="true"/>
<fieldType name="_nest_path_" class="solr.NestPathField"/>
<field name="_ChildIndex_" type="_nest_path_"> //where to get name value ??
<field name="id" type="string" multiValued="false" required="true" stored="true"/>
<field name="data" type="string" indexed="true" stored="true"/>
</field>
如何在我的 Solr schema.xml 中表示子文档?
Solr 嵌套文档未正确设置
第三 - 如何在存储库方法上使用 [child]
是否有必要检索孩子的VO?
解决方案
推荐阅读
- django - 在 Django REST 中序列化 SQL 函数
- c# - .NET 在内存转储中固定句柄,没有互操作或固定
- c# - 配置选项
使用 AuthenticationBuilder - arcore - 突出显示未放置在平面中的点
- twilio - Twilio:在暖转接中保持通话
- r - position_stack 不适用于 facet_wrap
- c# - 日历 System.Globalization.GregorianCalendar 不支持字符串表示的 DateTime 与数据和月份混淆
- c# - C#复制和粘贴对象
- xml - 通过 DISPLAY_XML_DOCUMENT 显示一个 IF_IXML_ELEMENT 对象
- android - 如何更好地设计 Android CRUD 中的删除操作