2017-03-09 100 views

回答

0

是的,你可以在Jetty上使用Solr-JDBC,只需要爲它配置數據庫連接即可。與命名數據庫連接器web.xml中開始:

<resource-ref> 
    <description>My Stopword Datasource</description> 
    <res-ref-name>jdbc/stopwords</res-ref-name> 
    <res-type>javax.sql.DataSource</res-type> 
    <res-auth>Container</res-auth> 
</resource-ref> 

然後,在的jetty.xml文件與實際配置下去,一個WEB-INF /碼頭-env.xml文件,或上下文XML文件:

<New id="stopwords" class="org.eclipse.jetty.plus.jndi.Resource"> 
    <Arg></Arg> 
    <Arg>jdbc/stopwords</Arg> 
    <Arg> 
    <New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"> 
     <Set name="Url">jdbc:mysql://localhost:3306/databasename</Set> 
     <Set name="User">user</Set> 
     <Set name="Password">pass</Set> 
    </New> 
    </Arg> 
</New> 

在這一點上,你可以使用Solr的-JDBC,你會與Tomcat使用它:

<filter class="com.s24.search.solr.analysis.jdbc.JdbcStopFilterFactory" 
    sql="SELECT stopword FROM stopwords" 
    jndiName="jdbc/stopwords"/>