SOLR DataImportHandler 不计算表达式

发布于 2024-10-10 19:21:40 字数 1455 浏览 3 评论 0原文

我正在尝试使用 SOLR DataImportHandler 来提供数据。当我只从根实体导入一个字段时,配置简单明了,一切正常。

但是当我尝试从嵌套实体导入字段时,它不起作用,我真的很困惑并且陷入困境。

这是我的数据配置中的相关片段:

<dataConfig>
    <dataSource ... />
    <document>
        <entity name="a" query="select id, b_id from a" pk="id">
               <entity name="b" query="select title from b where id ='${a.b_id}'">
                   <field column="title" name="title" />
               </entity>
        </entity>
    </document>
</dataConfig>

当我尝试使用 DIH 开发控制台在打开详细信息的情况下调试导入时,我可以看到类似的内容:

...
<lst name="document#3">
<str>----------- row #1-------------</str>
<str name="ID">PST_210-SI.10             </str>
<str name="B_ID">6c2r3490seeqvb86pgb4c4trf9</str>
<str>---------------------------------------------</str>
−
<lst name="entity:b">
<str name="query">select title from b where id =''</str>
<str name="query">select title from b where id =''</str>
<str name="query">select title from b where id =''</str>
<str name="time-taken">0:0:0.1</str>
<str name="time-taken">0:0:0.1</str>
<str name="time-taken">0:0:0.1</str>
</lst>
</lst>

我认为有趣的一点是实体 b 中的 3 个查询,其中id 字段为空。在我看来,好像 ${a.b_id} 没有被评估,但我找不到原因。

有人可以帮忙吗? 提前致谢。

I'm trying to use SOLR DataImportHandler to feed data. Configuration was simple and straightforward and everything worked fine, when I was importing only one field from root entity.

But when I tried to import fields from nested entities, it doesn't work and I'm really puzzled and stuck.

Here is relevant snippet from my dataconfig:

<dataConfig>
    <dataSource ... />
    <document>
        <entity name="a" query="select id, b_id from a" pk="id">
               <entity name="b" query="select title from b where id ='${a.b_id}'">
                   <field column="title" name="title" />
               </entity>
        </entity>
    </document>
</dataConfig>

When I try to debug import using DIH Development Console with verbose switched on, i can see something like:

...
<lst name="document#3">
<str>----------- row #1-------------</str>
<str name="ID">PST_210-SI.10             </str>
<str name="B_ID">6c2r3490seeqvb86pgb4c4trf9</str>
<str>---------------------------------------------</str>
−
<lst name="entity:b">
<str name="query">select title from b where id =''</str>
<str name="query">select title from b where id =''</str>
<str name="query">select title from b where id =''</str>
<str name="time-taken">0:0:0.1</str>
<str name="time-taken">0:0:0.1</str>
<str name="time-taken">0:0:0.1</str>
</lst>
</lst>

I think the interesting point are the 3 queries in entity b, where the id field is empty. It seems to me, like the ${a.b_id} is not evaluated, but I can't find out why.

Can anyone help, please?
Thanks in advance.

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

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

发布评论

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

评论(1

萌吟 2024-10-17 19:21:41

哈,像往常一样 - 在花了整个下午试图找出解决方案之后,当我用完所有想法并向社区询问一个问题时..我突然自己找到了解决方案:)

问题是区分大小写 - 如果你正确查看详细的 XML输出,由于某种原因。所以我尝试使用表达式 ${a.B_ID} 并且它有效!

也许大写字母仅适用于 Oracle JDBC 驱动程序。

Ha, as usual - after spending whole afternoon trying to find out solution, when I run out all ideas and ask community a question.. I suddenly find the solution myself :)

The catch was case sensitivity - If you look properly on the verbose XML output, there is for some reason . So I tried to use expression ${a.B_ID} and it works!

Maybe the upper case could be speciffic only for Oracle JDBC driver.

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