windows搭建solr5.4.1全文檢索搜尋引擎

來源:互聯網
上載者:User


一.   搭建solr伺服器

         1.下載solr http://archive.apache.org/dist/lucene/solr/5.4.1/ ,並解壓

         2.將..\solr-5.4.1\example\example-DIH目錄下的solr檔案夾複製到tomcat根目錄下

         3.將..\solr-5.4.1\server\solr-webapp目錄下的webapp複製到tomcat\webapp下並命名為為solr

         4.將..\solr-5.4.1\server\lib\ext目錄下的所有jar包複製到..\apache-tomcat-7.0.67\webapps\solr\WEB-INF\lib下

         5.將..\solr-5.4.1\dist目錄下的solr-dataimporthandler-5.4.1.jar和solr-dataimporthandler-extras-5.4.1.jar複製到..\apache-tomcat-7.0.67\webapps\solr\WEB-INF\lib下

         6.將..\solr-5.4.1\server\resources目錄下的log4j.properties複製到..\apache-tomcat-7.0.67\webapps\solr\WEB-INF\classes下

         如果沒有classes檔案,則建立一個

         7.修改..\apache-tomcat-7.0.67\webapps\solr\WEB-INF目錄下的web.xml

         找到<env-entry>節點,刪除注釋,修改如下 [html]  view plain  copy  print ? <span style="white-space:pre">    </span>  <env-entry>                   <env-entry-name>solr/home</env-entry-name>                               <!--指向tomcat根目錄下的solr檔案夾 -->                  <env-entry-value>E:\apache-tomcat-7.0.67\solr</env-entry-value>                  <env-entry-type>java.lang.String</env-entry-type>             </env-entry>             

         8.啟動tomcat,訪問 http://localhost:8080/solr/index.html#/, 出現如下頁面說明搭建成功


二.   串連資料庫   

         1.SQL配置

         以MySQL為例,需要下載mysql-connector-Java-bin.jar到..\apache-tomcat-7.0.67\webapps\solr\WEB-INF\lib目錄下

         http://dev.mysql.com/downloads/file/?id=462849

         2.建立查詢

         進入在solr/home 目錄下也就是本例的..\apache-tomcat-7.0.67\solr目錄下

         複製db得到collection

         進入..\apache-tomcat-7.0.67\solr\collection目錄下,編輯conf檔案夾下的db-data-config.xml檔案 [html]  view plain  copy  print ? <dataConfig>       <dataSourcedriverdataSourcedriver="com.mysql.jdbc.Driver"url="jdbc:mysql://localhost:3306/dubbotest?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull"user="root" password="123456" />       <document>           <entity name="Student" query="select* from t_student"                   deltaQuery="select * fromt_student where last_modified > '${dataimporter.last_index_time}'"                                         deltaImportQuery="SELECT* FROM t_student where last_modified >'${dataimporter.last_index_time}'">               <field column="id"name="id" />                               <fieldcolumnfieldcolumn="name" name="name" />                               <fieldcolumnfieldcolumn="sex" 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.