作者:呼吸乱了的声音_648 | 来源:互联网 | 2023-06-05 14:25
这篇文章主要讲解了“怎么使用java solr嵌套文档”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么使用java solr嵌套文档”吧!
"id": "A",
"queryGroup": "group1",
"_childDocuments_": [
{
"metricScore": "0.86",
"metric": "p",
"docType": "child",
"id": 12894
},
{
"metricScore": "0.62",
"metric": "r",
"docType": "child",
"id": 12895
}
],
"docType": "parent",
public class Parent
{
@Field
private String id;
...
@Field(child = true)
private List children;
}
Parent sampleParent = new Parent();
Child sampleChild = new Child();
//you need to implement it in your POJO
sampleParent.addChildDocument(sampleChild);
solr.addBean("collection", sampleParent)
q={!parent which=}
e.g.
q={!parent which=docType:"parent"}title:(child title terms)
fl=*,[child parentFilter=doc_type:parent childFilter=id:*]
fl=*,[child parentFilter=doc_type:book childFilter=$childQuery limit=100]&childQuery=(id:(12894 OR 12895))
fl=*,[child parentFilter=doc_type:book childFilter=$childQuery limit=100]&childQuery=(id:12894 OR id:12895)
感谢各位的阅读,以上就是“怎么使用java solr嵌套文档”的内容了,经过本文的学习后,相信大家对怎么使用java solr嵌套文档这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是编程笔记,小编将为大家推送更多相关知识点的文章,欢迎关注!