Tuesday, May 5, 2009

Solr, multiple core in one web application

To test Solr, we need a web application. We can use the apache-solr-1.3.0.war from the solr dist.

Setup solr home

This step is important. Solr get configuration from solr home. There are 3 ways to configure solr home

  1. set system property solr.solr.home
  2. set JNDI to look up solr home
  3. “solr” dir in current working directory

To support multiple core in one web application, a configuration file should be put in solr home.

<solr persistent="true" sharedLib="lib">
<cores adminPath="/admin/cores">
<core name="category" instanceDir="." config="category.config.xml" schema="category.schema.xml"/>
<core name="customer" instanceDir="." config="customer.config.xml" schema="customer.schema.xml" />
<core name="order" instanceDir="." config="order.config.xml" schema="order.schema.xml" />
<core name="orderreturn" instanceDir="." config="orderreturn.config.xml" schema="orderreturn.schema.xml" />
<core name="product" instanceDir="." config="product.config.xml" schema="product.schema.xml" />
<core name="promotion" instanceDir="." config="promotion.config.xml" schema="promotion.schema.xml" />

Sample project: https://yao-proj.googlecode.com/svn/trunk/solr

No comments:

Post a Comment