将停用词从 Postgresql 加载到 Solr6

Loading stopwords from Postgresql to Solr6

我是 solr 新手。我想在分析阶段从数据库而不是 txt 文件加载同义词或停用词到 solr。我怎样才能在 solr 6 中实现它。

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

<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 与:

<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 时遇到了以下错误。

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

此外,所需的库已添加到正确的文件夹中。

老实说,我认为这个解决方案一团糟,我强烈建议将您的同义词和停用词导出到一个文本文件中,并保存它们以覆盖您的旧配置文件。

在那之后,也许您已经知道,您必须重新加载 core/collection 配置,并根据您的分析器链,重新索引所有涉及的文档。

另一方面,如果你真的想这样,看你的问题我可以给你以下建议,你要仔细检查:

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

是的,已经修复了,我已经下载了jetty-jndi.jar但是忘记添加到lib文件夹中了。

  • 所以不要忘记将 postgresql-xxxx、jetty-jndi 和 jetty-plus 添加到 server/lib