将停用词从Postgresql加载到Solr6 [英] Loading stopwords from Postgresql to Solr6

查看:264
本文介绍了将停用词从Postgresql加载到Solr6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Solr的新手.我想在分析阶段从数据库而不是txt文件加载同义词或停用词到solr.如何在Solr 6中实现它?

I am new to solr. I want to load synonyms or stopwords from DB instead of txt file to solr at analyzing phase. How can I acheive it in solr 6.

我尝试移植Solr-JDBC( https://github.com/shopping24/solr-jdbc ),并使用以下代码配置了web.xml:

I tried porting Solr-JDBC(https://github.com/shopping24/solr-jdbc), and I configured web.xml with code below:

<resource-ref>
        <description>my datasource</description>
        <res-ref-name>jdbc/dsTest</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

和solr-jetty-context.xml带有:

and solr-jetty-context.xml with:

<New id="dsTest" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg></Arg>
     <Arg>jdbc/dsTest</Arg>
     <Arg>
        <New class="org.postgresql.ds.PGSimpleDataSource">
           <Set name="User">username</Set>
           <Set name="Password">password</Set>
           <Set name="DatabaseName">DBName</Set>
           <Set name="ServerName">localhost</Set>
           <Set name="PortNumber">5432</Set>
        </New>
     </Arg>
  </New>

但是当我尝试启动SolrCloud时遇到了以下错误.

But I encountered the following error when I was trying to start SolrCloud.

错误:在 http://localhost:8983/solr 上没有看到solr联机 30以内

Error: did not see solr at http://localhost:8983/solr come online within 30

还将所需的库添加到正确的文件夹中.

Also, the needed libraries are added to the correct folder.

推荐答案

老实说,我认为该解决方案很烂,我强烈建议将同义词和停用词导出到文本文件中,并保存它们以覆盖旧的配置文件.

Honestly I think this solution is a mess, I strongly suggest to export your synonyms and stopwords in a text file and save them overwriting your old configuration files.

之后,也许您已经知道,您必须重新加载核心/集合配置,并根据分析器链重新索引所有涉及的文档.

After that, maybe you already know, you have to reload the core/collection configuration and, depending from your analyzer chain, reindex all the documents involved.

另一方面,如果您真的想遵循这种方式,请看您的问题我可以给您以下建议,您必须仔细检查:

On the other hand, if you really want follow this way, looking at your question I can give you the following suggestion, you have to double check:

  • jdbc驱动程序(检查是否已将postgresql-xxxxx.jdbc.jar复制到$ JETTY_HOME/lib/ext)
  • 网络(检查postgres实例是否启动并在localhost:5432上侦听)
  • 帐户(检查用户名和密码是否正确)
  • 数据库名称(检查该数据库是否存在并且用户具有权限)

这篇关于将停用词从Postgresql加载到Solr6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆