You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by SuoNayi <su...@163.com> on 2012/12/21 04:10:53 UTC

How to add the extra analyzer jar?

Hi all, for solrcloud(solr 4.0) how to add the third analyzer?
There is a third analyzer jar and I want to integrate it with solrcloud.
Here are my steps but the ClassNotFoundException is thrown at last when startup.
1.add the fieldType in the schema.xml and here is a snippet :
<!-- ikanalyzer -->
<fieldType name="text_ik" class="solr.TextField" >        
<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>        
<analyzer type="index">        
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="false"/>          
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>          
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>          
<filter class="solr.LowerCaseFilterFactory"/>          
<filter class="solr.EnglishPossessiveFilterFactory" protected="protwords.txt"/>          
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>        
</analyzer>        
<analyzer type="query">          
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="false"/>          
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>          
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>          
<filter class="solr.EnglishPossessiveFilterFactory" protected="protwords.txt"/>          
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>        
</analyzer>      
</fieldType>
2. add the IKAnalyzer.cfg.xml and stopword.dic files into the classes directory of the solr.war(open the war and add those two files).
3.use the start.jar to start up and the ClassNotFoundException is thrown.


Could some help me to figure out what's wrong or tell me where I can add the extra/third jar lib into the classpath of the solrcloud?


Thanks,


SuoNayi

Re: How to add the extra analyzer jar?

Posted by Erick Erickson <er...@gmail.com>.
What about the jar file that containsorg.wltea.analyzer.
solr.IKTokenizerFactory? You can change solrconfig.xml to include a new
<lib...> directive to path to new jars. You might start with absolute paths
to get it working at all then move to relative paths when you're sure it
works and it's just a matter of getting the relative path right. The
current working directory is visible on one of the admin screens, forget
just which now.

Best
Erick


On Thu, Dec 20, 2012 at 10:10 PM, SuoNayi <su...@163.com> wrote:

> Hi all, for solrcloud(solr 4.0) how to add the third analyzer?
> There is a third analyzer jar and I want to integrate it with solrcloud.
> Here are my steps but the ClassNotFoundException is thrown at last when
> startup.
> 1.add the fieldType in the schema.xml and here is a snippet :
> <!-- ikanalyzer -->
> <fieldType name="text_ik" class="solr.TextField" >
> <analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
> <analyzer type="index">
> <tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory"
> isMaxWordLength="false"/>
> <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords.txt"/>
> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1"
> generateNumberParts="1" catenateWords="1" catenateNumbers="1"
> catenateAll="0" splitOnCaseChange="1"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.EnglishPossessiveFilterFactory"
> protected="protwords.txt"/>
> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
> </analyzer>
> <analyzer type="query">
> <tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory"
> isMaxWordLength="false"/>
> <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords.txt"/>
> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1"
> generateNumberParts="1" catenateWords="1" catenateNumbers="1"
> catenateAll="0" splitOnCaseChange="1"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.EnglishPossessiveFilterFactory"
> protected="protwords.txt"/>
> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
> </analyzer>
> </fieldType>
> 2. add the IKAnalyzer.cfg.xml and stopword.dic files into the classes
> directory of the solr.war(open the war and add those two files).
> 3.use the start.jar to start up and the ClassNotFoundException is thrown.
>
>
> Could some help me to figure out what's wrong or tell me where I can add
> the extra/third jar lib into the classpath of the solrcloud?
>
>
> Thanks,
>
>
> SuoNayi

Reply:How to add the extra analyzer jar?

Posted by SuoNayi <su...@163.com>.
The issue has been solved and sorry for my negligence.




At 2012-12-21 11:10:53,SuoNayi <su...@163.com> wrote:
>Hi all, for solrcloud(solr 4.0) how to add the third analyzer?
>There is a third analyzer jar and I want to integrate it with solrcloud.
>Here are my steps but the ClassNotFoundException is thrown at last when startup.
>1.add the fieldType in the schema.xml and here is a snippet :
><!-- ikanalyzer -->
><fieldType name="text_ik" class="solr.TextField" >        
><analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>        
><analyzer type="index">        
><tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="false"/>          
><filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>          
><filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>          
><filter class="solr.LowerCaseFilterFactory"/>          
><filter class="solr.EnglishPossessiveFilterFactory" protected="protwords.txt"/>          
><filter class="solr.RemoveDuplicatesTokenFilterFactory"/>        
></analyzer>        
><analyzer type="query">          
><tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="false"/>          
><filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>          
><filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
><filter class="solr.LowerCaseFilterFactory"/>          
><filter class="solr.EnglishPossessiveFilterFactory" protected="protwords.txt"/>          
><filter class="solr.RemoveDuplicatesTokenFilterFactory"/>        
></analyzer>      
></fieldType>
>2. add the IKAnalyzer.cfg.xml and stopword.dic files into the classes directory of the solr.war(open the war and add those two files).
>3.use the start.jar to start up and the ClassNotFoundException is thrown.
>
>
>Could some help me to figure out what's wrong or tell me where I can add the extra/third jar lib into the classpath of the solrcloud?
>
>
>Thanks,
>
>
>SuoNayi