下载 Apache Solr 1.3 http://apache.etoak.com/lucene/solr/1.3.0/apache-solr-1.3.0.zip ,解压。

To create a project in Eclipse

File > New > Java Project

In ‘Create Java Project’ dialog:

Select ‘Create Project from existing source’. Select directory where the TOP of the code tree lives. Leave other defaults alone.

Select ‘Finish’
Setup build file as an Eclipse build file

Project > Properties > Builders > New > Ant Builder

On ‘Main’ tab:

    * Locate ‘build.xml’
    * Set base directory to top of build tree
    * For argument, add ‘compile’
    * Apply

On ‘Targets’ tab:

    * Manual build ‘compilel’
    * Automatic build ‘compile’
 

solr 安装到 tomcat。修改 E:\apache-tomcat-6.0.18\conf\server.xml,加个 URIEncoding="UTF-8",把 8080 的那一块改为:

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>

把下面的内容保存到 E:\apache-tomcat-6.0.18\conf\Catalina\localhost\solr.xml,没有这个目录自行创建。

    <Context docBase="E:/apache-solr-1.3.0/dist/apache-solr-1.3.0.war" reloadable="true" >  
        <Environment name="solr/home" type="java.lang.String" value="E:/apache-solr-1.3.0/example/solr" override="true" />  
    </Context> 

提交数据做索引,到 E:\apache-solr-1.3.0\example\exampledocs,运行:

E:\apache-solr-1.3.0\example\exampledocs>java -Durl=http://localhost:8080/solr/update -Dcommit=yes -jar post.jar demo-doc*.xml
SimplePostTool: version 1.2
SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, other encodings are not currently supported
SimplePostTool: POSTing files to http://localhost:8080/solr/update..
SimplePostTool: POSTing file demo-doc1.xml
SimplePostTool: POSTing file demo-doc2.xml
SimplePostTool: COMMITting Solr index changes..

 
运行:   http://localhost:8080/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on

 

 

 

 

 


只有注册用户登录后才能发表评论。


网站导航: