索引 Solr 文档时查询 mysql 数据库
我需要使用可以从 mysql 数据库获取的详细信息来更新我的 solr 文档。
示例:
- solr 字段“城市”--> “London”(使用 post.jar 工具从 xml 源读取)
- 更新时间(requestHandler /update 已经配置了自定义插件来执行其他操作)solr 应该查询 mysql 以获取有关“London”(或刚刚读取的任何内容)的更多信息
- solr 使用我一直在尝试使用 JDBC 插件和 DIH 处理程序的查询结果更新该文档的字段
(我只能使用调用 /dataimport/ full-import...并且在我的具体情况下不能)到目前为止没有成功:(
你们中有人有同样的问题吗?你是怎么解决的?谢谢!
编辑:我忘记了,对于 dih 配置,我尝试按照本指南http://www.cabotsolutions.com/2009/05/using-solr-lucene-for-full-text-search-with-mysql-db/
I need to update my solr documents with detailed informations i can grab from a mysql database.
Example:
- solr field "city" --> "London" (read from an xml source with post.jar tool)
- on update time (requestHandler /update already configured with custom plugin to do other stuff) solr should query mysql for more information about "London" (or whatever just read)
- solr updates the fields of that document with the query result
i've been trying with a JDBC plugin and with a DIH handler (which i can only use calling /dataimport/ full-import... and i can't in my specific case) and so far no success :(
Any of you had the same problem? How did you solve it? Thanks!
edit: i forgot, for the dih configuration i tried following this guide http://www.cabotsolutions.com/2009/05/using-solr-lucene-for-full-text-search-with-mysql-db/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您在浏览器中访问 /dataimport/full-import 时,请务必包含其完整输出。 Solr 错误消息可能会变得神秘。
您是否考虑过通过 XML 上传文档? http://wiki.apache.org/solr/UpdateXmlMessages 。它更强大,允许您在上传文档时使用自己的逻辑。
从 SQL 中读取每一行,并将每个文档放在标签下组成一个 XML 文档(字符串)。
从
将整个 XML 字符串发布到 /update 。不要忘记将 MIMEtype 标头设置为 text/xml 。并确保在 POST 上设置 Servler 容器(Tomcat、Jetty)的上传限制(Tomcat 有 2mb 限制,如果我没记错的话)
不要忘记提交和优化命令
Please do include the full output of /dataimport/full-import when you access it in your browser. Solr error messages can get cryptic.
Have you considered uploading documents by XML? http://wiki.apache.org/solr/UpdateXmlMessages . Its more powerful, allowing you to use your own logic when uploading documents.
Read each row from SQL and compose an XML document (string) with each document under tags.
Post the entire XML string to /update . Dont forget to set the MIMEtype header as text/xml . And make sure to set your Servler container's (Tomcat, Jetty) upload limit on POSTs (Tomcat has 2mb limit, if I recall right)
dont forget the commit and optimize commands