`
aaron_ch
  • 浏览: 172511 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

Apache Solr and Tomcat6 Search engine

    博客分类:
  • Java
阅读更多

Today, test the Solr and Tomcat6 search engine.

Now list the install and test case.

 

1.Download apache Solr(v1.2) And Tomcat6 from http://www.apache.org

 

2.Install Tomcat6 in C:/work/Tomcat/

 

3.unzip apache solr to a directory, and copy the <apache-solr>/example/solr to C:/work/

 

4.and copy the war file from <apache-solr>/dist,rename to solr.war to C:/work/Tomcat/webapps/

 

5.Configure JNDI for tomcat to reference to solr/home.

Create catalina/localhost folder  at C:/work/Tomcat/conf, and create solr.xml in C:/work/Tomcat/conf/catalina/localhost/,  xml file content is below:

<Context docBase="c:/work/Tomcat/webapps/solr.war" debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="c:/work/solr" override="true" />
</Context>

 

6.now can run the  http://localhost:8080/solr to test the configuration correct or not.

 

7.modify the schema.xml ,please see the attached.

 

7. Create a test.xml at C:/work/solr/exampledoc  and fill with below data in it

 

<add><doc>
  <field name="trackid">asid87f89asd7f9a</field>
  <field name="planet">Cybertron</field>
  <field name="icode">cbtron000</field>
  <field name="street">1 Optimus Prime Way</field>
  <field name="city">Prime City</field>
  <field name="country">Optimus</field>
  <field name="pcode">fd32as90</field>
  <field name="digits">+55555555 555.555.5555</field>
  <field name="weight">1000 lbs</field>
  <field name="dim">5x20x100</field>
  <field name="clocation">enroute to destination planet from earth</field>
</doc>
<doc>
  <field name="trackid">asid87f89asd7f9b</field>
  <field name="planet">Cybertronb</field>
  <field name="icode">cbtron0001</field>
  <field name="street">1 Optimus Prime Wayb</field>
  <field name="city">Prime Cityb</field>
  <field name="country">Optimusb</field>
  <field name="pcode">fd32as902</field>
  <field name="digits">+55555555 555.555.5556</field>
  <field name="weight">1100 lbs</field>
  <field name="dim">5x20x101</field>
  <field name="clocation">enroute to destination planet from mar</field>
</doc>
</add>

 

8. Startup tomcat, and use the CMD to submit the index at c:/work/solr/exampledoc/

java -Durl=http://localhost:8080/solr/update -jar post.jar test.xml

 

9. Then use http://localhost:8080/solr to query the asid87f89asd7f9a in Solr/Lucene Statement

 

and will response the result.

 

  • schema.rar (5.2 KB)
  • 描述: zip
  • 下载次数: 24
分享到:
评论
1 楼 tianhendi 2008-04-10  
  

相关推荐

Global site tag (gtag.js) - Google Analytics