solr 入门 (安装 mysql数据库安装 )

solr  入门 (安装)

 

 

非数据库安装

------------------------------------------------------------------------------------------------------------------------------

1.下载 solr

http://mirrors.cnnic.cn/apache/lucene/solr/4.10.4/solr-4.10.4.zip

 

2.解压solr

 拷贝 solr-4.10.4 \dist \solr.war 到tomcat7\webapps\下

   solr-xxx .war  改名为solr.war

 

3.

\solr-4.x\example\solr   拷贝到 D:\software\apache-tomcat-7.0.52 \ 下

 

4.

 将\solr-4.10.4\example\lib\ext下的jar包拷贝到\apache-tomcat-7.0.52 \lib下

 将\solr-4.10.4\example\resources\log4j.properties 拷贝到\apache-tomcat-7.0.52 \lib 下

 

 

5.

在\tomcat-7.x\conf\Catalina\localhost\下建立solr.xml文件,黏贴下面的内容。

 

<Context docBase="D:\software\apache-tomcat-7.0.52\webapps\solr.war" debug="0" crossContext="true" >
    <Environment name="solr/home" type="java.lang.String" value="D:\software\apache-tomcat-7.0.52\solr" override="true" />
</Context>

 

docBase是第2步war包的路径,下面的value是第3步的目录

 

 

6. 

   http://localhost:8080/solr

 

 
solr 入门 (安装 mysql数据库安装 )_第1张图片
 

 





 
 

 

数据库安装

------------------------------------------------------------------------------------------------------------------------------
 

0.修改D:\software\apache-tomcat-7.0.52\conf\Catalina\localhost 下 solr .xml

 

<Context docBase="D:/software/apache-tomcat-7.0.52/webapps/solr" debug="0" crossContext="true" >
    <Environment name="solr/home" type="java.lang.String" value="D:/software/mydbsolr" override="true" />
</Context>

 

 

1.

 将example\example-DIH\solr\ 下的db文件夹放入

 D:\software\mydbsolr


solr 入门 (安装 mysql数据库安装 )_第2张图片

2.solr.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<solr sharedLib="lib" persistent="true">  
    <cores adminPath="/admin/cores">  
        <core default="true" instanceDir="db" name="db"/>  
    </cores>  
</solr>  

 

 


 3.在D:\software\mydbsolr\db\lib 中 添加 以下jar包
solr 入门 (安装 mysql数据库安装 )_第3张图片
 

 

4.D:\software\mydbsolr\db\conf

 下 db-data-config.xml

<dataConfig>    
    <dataSource driver="com.mysql.jdbc.Driver"
	url="jdbc:mysql://localhost:3306/fusionweb?useUnicode=true&amp;characterEncoding=utf8" 
	user="root"
   password="root"/>    
    <document name="content">    
        <entity name="user" query="select userid,username,userpswd,nickname,contacts,telephone,enterprise,regtime,provinceid,roleid from user">    
            <field column="userid" name="userid" />    
            <field column="username" name="username" />    
            <field column="userpswd" name="userpswd" />    
            <field column="nickname" name="nickname" /> 
			 <field column="contacts" name="contacts" />    
            <field column="telephone" name="telephone" />    
            <field column="enterprise" name="enterprise" />    
            <field column="regtime" name="regtime" />
			 <field column="provinceid" name="provinceid" />    
            <field column="roleid" name="roleid" />

			
        </entity>    
    </document>    
</dataConfig>  

 

 

  下 schema.xml

 

<?xml version="1.0" encoding="UTF-8" ?>    
<schema name="user" version="1.5">    
  <types>        
  
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>   
   <fieldType name="string" class="solr.StrField" sortMissingLast="true"/> 
   <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/> 
   <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/> 
   <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
          <analyzer type="index">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
            <filter class="solr.LowerCaseFilterFactory"/>
          </analyzer>
          <analyzer type="query">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
            <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
            <filter class="solr.LowerCaseFilterFactory"/>
          </analyzer>
    </fieldType>  
 <!-- 
     <fieldType name="text" class="solr.TextField">   
          <analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>   
     </fieldType>  
   -->     
</types>    
    
    
 <fields>    
	<field   name="userid" type="string" indexed="true" stored="true" required="true" />    
	<field  name="username"  type="string" indexed="true" stored="true" multiValued="false"/>    
	<field   name="userpswd" type="string" indexed="true" stored="true" multiValued="false"/>    
	<field  name="nickname" type="string" indexed="true" stored="true" multiValued="false"/> 
	 <field   name="contacts" type="string" indexed="true" stored="true" multiValued="false"/>    
	<field   name="telephone" type="string"  indexed="true" stored="true" multiValued="false"/>    
	<field  name="enterprise" type="string"  indexed="true" stored="true" multiValued="false"/>    
	<field   name="regtime" type="string" indexed="true" stored="true" multiValued="false"/>
	 <field   name="provinceid" type="long" indexed="true" stored="true" multiValued="false"/>    
	<field  name="roleid" type="long"  indexed="true" stored="true"  />
 
	<field name="_version_" type="long" indexed="true" stored="true"/>  
    <field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
 </fields>    
  <uniqueKey>userid</uniqueKey>    
 <!-- <defaultSearchField>contacts</defaultSearchField>    
 <solrQueryParser defaultOperator="OR"/>    
<copyField source="username" dest="contacts"/>    
<copyField source="nickname" dest="contacts"/>  
  -->  
    
</schema>    

 

 

  下 solrconfig.xml

 注释 所有的lib

 

<!--  20150529 
   <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-cell-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/clustering/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-clustering-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />
   -->

 

 

 
solr 入门 (安装 mysql数据库安装 )_第4张图片
 

 

 

 
solr 入门 (安装 mysql数据库安装 )_第5张图片
 

 

你可能感兴趣的:(mysql,入门,安装,Sol)