Solr DIH:文档不嵌套

问题描述

我正在尝试将一些数据作为嵌套文档导入。

我试图尽可能简化我的问题。

这是我的父查询

var express = require("express");
var app = express();
var morgan = require("morgan");
var mongoose = require("mongoose");
port = 8000;
var User = require("./app/models/user");
mongoose.connect("mongodb://localhost:27017/tutorial",function (err) {
  if (err) {
    console.log("disconnected: " + err);
  } else {
    console.log("connected");
  }
});
app.post("/users",function (req,res) {
  var user = new User();
  user.username = req.body.username;
  user.email = req.body.email;
  user.password = req.body.password;
  user.save();
  res.send("user created");
});
app.use(morgan("dev"));
app.listen(port,function () {
  console.log("You are listen on port " + port);
});

您可以在此处查看数据:

SELECT 1 AS id,'xxx' AS col1,'yyy' AS col2
UNION
SELECT 2 AS id,'yyy' AS col2
UNION
SELECT 3 AS id,'yyy' AS col2

我的孩子查询是:

1 | xxx | yyy
2 | xxx | yyy
3 | xxx | yyy

数据是:

SELECT 1 AS id,1 AS rel_id,'aaa' AS col1,'bbb' AS col2
UNION
SELECT 2 AS id,'bbb' AS col2
UNION
SELECT 3 AS id,2 AS rel_id,'bbb' AS col2
UNION
SELECT 4 AS id,3 AS rel_id,'bbb' AS col2

我正在尝试使用以下DIH配置进行嵌套:

1 | 1 | aaa | bbb
2 | 1 | aaa | bbb
3 | 2 | aaa | bbb
4 | 3 | aaa | bbb

但是,它们不是嵌套的:

<entity
    name="item"
    query="select 1 as id,'xxx' as col1,'yyy' as col2 union select 2 as id,'yyy' as col2 union select 3 as id,'yyy' as col2">

        <field column="id" name="id"/>

        <field column="col1" name="column1_s" />
        <field column="col2" name="column2_s" />

    <entity
        name="autor"
        child="true"
        query="select 1 as id,1 as rel_id,'aaa' as col1,'bbb' as col2 union select 2 as id,'bbb' as col2 union select 3 as id,2 as rel_id,'bbb' as col2 union select 4 as id,3 as rel_id,'bbb' as col2"
        cacheKey="rel_id" cacheLookup="item.id" cacheImpl="SortedMapBackedCache">

            <field column="node_type" template="autor"/>

            <field column="alt_code" name="id" template="${autor.id}-${autor.rel_id}"/>

            <field column="col1" name="column1_s" />
            <field column="col2" name="column2_s" />


        </entity>
</entity>

如您所见,文档没有嵌套。

在这个问题上我一直很努力。

我试图解决这个问题。

我希望我解释得很好。

请问有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)