下載 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

           

           

           

           

           


          只有注冊用戶登錄后才能發表評論。


          網站導航:
          博客園   IT新聞   Chat2DB   C++博客   博問  
           
          主站蜘蛛池模板: 神农架林区| 繁峙县| 长沙县| 岳阳县| 龙游县| 寻甸| 云龙县| 桐城市| 新兴县| 宝鸡市| 基隆市| 阿城市| 阿拉善盟| 托克托县| 航空| 晋州市| 务川| 永宁县| 万源市| 罗田县| 肥城市| 桦甸市| 青河县| 申扎县| 徐州市| 临沧市| 祁门县| 志丹县| 靖江市| 静宁县| 夏邑县| 大关县| 镇江市| 龙山县| 永平县| 凤冈县| 沿河| 额敏县| 林西县| 鄂托克旗| 临泉县|