welcome to xlongwei.com

欢迎大家一起学习、交流、分享


QQ:9167702333 邮箱:admin@xlongwei.com

solr.war发布


分类 Java   关键字 分享   标签 java   web   tomcat   发布 hongwei  1429263850145
注意 转载须保留原文链接,译文链接,作者译者等信息。  
solr.war可以直接部署到tomcat,减少tomcat实例以节省内存

上下文path="/solr",solr.war包解压路径docBase="/soft/solr/solr"(解压后复制IKAnalyzer3.2.5Stable.jar到WEB-INF/lib目录即可),solr.home路径:/soft/solr/solr-ite
<Context docBase="/soft/solr/solr" debug="0" crossContext="true" path="/solr">
   <Environment name="solr/home" type="java.lang.String" value="/soft/solr/solr-ite" override="true" />
</Context>

solr.home目录(从example/multicore复制即可),solr.xml和conf/solrconfig.xml不变,conf/schema.xml内容:
<schema name="example core zero" version="1.1">
<types>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldtype name="binary" class="solr.BinaryField"/>
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>

<fieldType name="text" class="solr.TextField">
<analyzer type="index">
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" useSmart="false"/>
</analyzer>
<analyzer type="query">
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" useSmart="false"/>
</analyzer>
</fieldType>

</types>

<fields>
<field name="id" type="long" indexed="true" stored="true" multiValued="false" required="true" />
<field name="articleId" type="long" indexed="true" stored="true" multiValued="false" />
<field name="title" type="text" indexed="true" stored="true" multiValued="false" />
<field name="categoryId" type="long" indexed="true" stored="true" multiValued="false" />
<field name="categoryName" type="text" indexed="true" stored="true" multiValued="false" />
<field name="authorId" type="long" indexed="true" stored="true" multiValued="false" />
<field name="authorName" type="text" indexed="true" stored="true" multiValued="false" />
<field name="authorNamePinyin" type="string" indexed="true" stored="true" multiValued="false" />
<field name="authorNamePinyinHeader" type="string" indexed="true" stored="true" multiValued="false" />
<field name="body" type="text" indexed="true" stored="true" multiValued="false" />
<field name="tags" type="text" indexed="true" stored="true" multiValued="false" />
</fields>

<!-- field to use to determine and enforce document uniqueness. -->
<uniqueKey>id</uniqueKey>

<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>title</defaultSearchField>

<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
<solrQueryParser defaultOperator="OR"/>
<enableLazyFieldLoading>true</enableLazyFieldLoading>
</schema>

资源下载:IKAnalyzer3.2.5Stable.jar,Solr.war,solr-ite.tar.gz