如何使用 spring solr 数据索引嵌套文档
How Indexing nested documents using spring solr data
谁能帮我解释一下如何索引嵌套文档?我正在使用最新版本的 spring-data-solr ,我有一个带有列表的文档,注释如下:
@Indexed(required = true,stored = true)
@Field(child = true,value = "werkzeuge")
private List<Werkzeug> werkzeuge;
但是solr里面的文档没有字段werkzeuge。
我正在使用 SOLR 无模式配置。
非常感谢,
嵌套文档支持最近已添加到 Apache Solr 的 Spring 数据中。在撰写本文时,只有适用于此功能的快照版本可用。详情请见DATASOLR-394 and the documentation。
非常感谢您对示例项目的回答和参考。现在它对我有用,但嵌套对象的结构似乎仍然是扁平的。框架生成 root 字段 id,但所有字段都在同一层次结构中。一个示例:werkzeug 是父对象的子对象
{
"werkzeug_id":"116283s",
"id_werkzeug":"",
"werkzeug_zitiernr":"s019910",
"werkzeug_kyrissnr":"",
"werkzeug_internnr":"069.02",
"werkzeug_floerke":"",
"werkzeug_laenge":0,
"werkzeug_breite":23,
"werkzeug_form":"Herz, umrandet",
"werkzeug_stecher":"",
"werkzeug_beschriftung":"",
"werkzeug_image":"s0192202",
"werkzeug_literatur":"",
"werkzeug_freitext":"",
"werkzeug_erfname":"",
"werkzeug_erfdatum":"2004-12-10T13:11:13Z",
"werkzeug_korrname":"",
"werkzeug_publicity":"public",
"_root_":"205789s"},
{
"id":"205789s",
"all":["205789s"],
"signatur":"Inc.fol.7541",
"id_standort":58,
"sovermerk":"ok",
"erfdatum":"2004-12-10T14:33:10Z",
"korrname":"wlb",
"korrdatum":"Thu Nov 13 13:31:22 UTC 2014",
"publicity":"public",
"_version_":1573171122990481408,
"_root_":"205789s"}]}
它应该看起来像这样而不是这个?
[
{id : book1, type_s:book, title_t : "The Way of Kings", author_s : "Brandon
Sanderson",
cat_s:fantasy, pubyear_i:2010, publisher_s:Tor,
_childDocuments_ : [
{ id: book1_c1, type_s:review, review_dt:"2015-01-03T14:30:00Z",
stars_i:5, author_s:yonik,
comment_t:"A great start to what looks like an epic series!"
}
,
{ id: book1_c2, type_s:review, review_dt:"2014-03-15T12:00:00Z",
stars_i:3, author_s:dan,
comment_t:"This book was too long."
}
]}]
您知道可能是什么原因吗?
谁能帮我解释一下如何索引嵌套文档?我正在使用最新版本的 spring-data-solr ,我有一个带有列表的文档,注释如下:
@Indexed(required = true,stored = true)
@Field(child = true,value = "werkzeuge")
private List<Werkzeug> werkzeuge;
但是solr里面的文档没有字段werkzeuge。
我正在使用 SOLR 无模式配置。
非常感谢,
嵌套文档支持最近已添加到 Apache Solr 的 Spring 数据中。在撰写本文时,只有适用于此功能的快照版本可用。详情请见DATASOLR-394 and the documentation。
非常感谢您对示例项目的回答和参考。现在它对我有用,但嵌套对象的结构似乎仍然是扁平的。框架生成 root 字段 id,但所有字段都在同一层次结构中。一个示例:werkzeug 是父对象的子对象
{
"werkzeug_id":"116283s",
"id_werkzeug":"",
"werkzeug_zitiernr":"s019910",
"werkzeug_kyrissnr":"",
"werkzeug_internnr":"069.02",
"werkzeug_floerke":"",
"werkzeug_laenge":0,
"werkzeug_breite":23,
"werkzeug_form":"Herz, umrandet",
"werkzeug_stecher":"",
"werkzeug_beschriftung":"",
"werkzeug_image":"s0192202",
"werkzeug_literatur":"",
"werkzeug_freitext":"",
"werkzeug_erfname":"",
"werkzeug_erfdatum":"2004-12-10T13:11:13Z",
"werkzeug_korrname":"",
"werkzeug_publicity":"public",
"_root_":"205789s"},
{
"id":"205789s",
"all":["205789s"],
"signatur":"Inc.fol.7541",
"id_standort":58,
"sovermerk":"ok",
"erfdatum":"2004-12-10T14:33:10Z",
"korrname":"wlb",
"korrdatum":"Thu Nov 13 13:31:22 UTC 2014",
"publicity":"public",
"_version_":1573171122990481408,
"_root_":"205789s"}]}
它应该看起来像这样而不是这个?
[
{id : book1, type_s:book, title_t : "The Way of Kings", author_s : "Brandon
Sanderson",
cat_s:fantasy, pubyear_i:2010, publisher_s:Tor,
_childDocuments_ : [
{ id: book1_c1, type_s:review, review_dt:"2015-01-03T14:30:00Z",
stars_i:5, author_s:yonik,
comment_t:"A great start to what looks like an epic series!"
}
,
{ id: book1_c2, type_s:review, review_dt:"2014-03-15T12:00:00Z",
stars_i:3, author_s:dan,
comment_t:"This book was too long."
}
]}]
您知道可能是什么原因吗?