Solr DIH动态文件名&转换值
我有一个使用 DIH 的工作 solr 现在我需要添加多行,与 solr 索引文档是一对多关系
TABLE:
ID:int PK
post_id:int FK
name:string
value:text
type:(int|string)
我需要将基于 FK (post_id) 的所有行插入具有动态名称的 solr 文档中,并根据类型
SELECT name,value,type FROM TABLE WHERE post_id='${post_entity.id}';
loop
insert into solr fieldname: meta_{$name} value: if type int cast to int else just value
end loop
Anybody 转换值知道怎么做吗?
I have a working solr with DIH now i need to add multi rows which is ONE to MANY relationship with the solr indexed doc
TABLE:
ID:int PK
post_id:int FK
name:string
value:text
type:(int|string)
i need to insert all rows based on FK (post_id) into solr doc with dynamic name and convert value based on type
SELECT name,value,type FROM TABLE WHERE post_id='${post_entity.id}';
loop
insert into solr fieldname: meta_{$name} value: if type int cast to int else just value
end loop
Anyone knows how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定您是否已经找到答案,但我的理解是您需要在数据处理程序文档中创建多个实体选项卡,每个选项卡对应您要添加的每个新多值字段,并指示根文档中的 ID。看这个例子:
在 DataHandler.xml 文件中:
Not sure if you have the answer yet, but my understanding is you need to create multiple entity tabs in the data handler document, one for each new multi-value field you want to add, and indicate the ID from the root document. Look at this example:
In the DataHandler.xml file:
我想我可以使用 DIHCustomTransformer 来调用函数,但我还不确定
http://wiki.apache.org/solr/DIHCustomTransformer
任何启发将不胜感激
i think i can use DIHCustomTransformer to invoke a function but i am not sure yet
http://wiki.apache.org/solr/DIHCustomTransformer
any enlightenment will be appreciated