Hi James, now you should make a FilterFactory, there are a few examples in c:\solr-nightly\src\java\org\apache\solr\analysis . You should also place your FilterFactory in this directory and rerun 'ant dist'. I have made a DutchStemFilterFactory class and this is the code:
package org.apache.solr.analysis; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.nl.DutchStemFilter; import java.util.HashMap; import java.util.Map; import java.io.File; public class DutchStemFilterFactory extends BaseTokenFilterFactory { private Map stemdict = new HashMap(); public TokenStream create(TokenStream input) { File file = new File(org.apache.solr.core.Config.getInstanceDir() + "conf/stems.txt"); stemdict = org.apache.lucene.analysis.nl.WordlistLoader.getStemDict (file); /*org.apache.lucene.analysis.nl.DutchStemFilter.setStemDictionary (stemdict);*/ return new DutchStemFilter(input, null, stemdict); } } Then I could change text_lu in schema.xml to: <fieldtype name="text_lu" class="solr.TextField" positionIncrementGap="100"> <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.ISOLatin1AccentFilterFactory"/> <filter class="solr.StandardFilterFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.StopFilterFactory" words="dutch-stopwords.txt" ignoreCase="true"/> <filter class="solr.DutchStemFilterFactory"/> </analyzer> </fieldtype> Notice how DutchStemFilterFactory gets called. Hope that solves your problem. Kind regards, Nick On 9/19/06, James liu <[EMAIL PROTECTED]> wrote:
thank u, with your step and add junit, it is ok. you can analyzer your language? i modify schema: <fieldtype name="text_lu" class="solr.TextField"> <analyzer class="org.apache.lucene.analysis.cjk.CJKAnalyzer"/> <tokenizer class="org.apache.lucene.analysis.cjk.CJKTokenizer"/> <filter class="solr.StandardFilterFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.StopFilterFactory"/> <filter class="solr.EnglishPorterFilterFactory"/> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </fieldtype> but nothing changed. 2006/9/19, Nick Snels <[EMAIL PROTECTED]>: > > Hi James, > > I also needed the DutchAnalyzer from Lucene in my Solr project. I did it > the > following way. Which is probably the hard way, because my Java knowledge > isn't that great. > > 1. I unzipped the solr-nightly build > 2. I downloaded the latest code from lucene, preferrably from svn : > http://svn.apache.org/viewvc/lucene/java/ and all necessary analyzers from > the lucene sandbox > 3. I put it into c:\solr-nightly\src\java\org\apache\lucene > 4. I installed ant (unzip it and add ANT_HOME to your path) > 5. than open a DOS prompt and go to c:\solr-nightly and run 'ant dist', > this > makes a new solr-1.0.war file in c:\solr-nightly\dist. That war file > contains also the lucene code along with your analyzers > > This is how I did it, don't know if this is the right or the easiest way > to > do it. > > Kind regards, > > Nick > > > On 9/18/06, James liu <[EMAIL PROTECTED]> wrote: > > > > Hi Nick, > > > > It is very funny. when i reboot my pc,it is ok and i do nothing. > > > > my new question is how to add lucene-analyzers-2.0.0.jar to tomcat or > > jetty. > > > > i add useful classes to solr.war which exist > > "C:\cygwin\tmp\solr-nightly\example\webapps\solr.war",,,but it is not > > effect... > > > > do u know how to solve it? > > > > > > Regards, > > > > JL > > > > 2006/9/18, Nick Snels <[EMAIL PROTECTED]>: > > > > > > Hi James, > > > > > > the problem is most likely a xml error in either schema.xml or > > > solrconfig.xml. Go through your Tomcat logs, if it is an xml error you > > > should find the line where the xml parsing went wrong. > > > > > > Kind regards, > > > > > > Nick > > > > > > On 9/18/06, James liu <[EMAIL PROTECTED]> wrote: > > > > > > > > thk Nick. > > > > > > > > i do you tell me and i can see admin page. > > > > > > > > but when i click search ,,,error information: > > > > > > > > java.lang.NullPointerException > > > > at org.apache.solr.search.SolrQueryParser.<init>( > SolrQueryParser.java > > > :37) > > > > at org.apache.solr.search.QueryParsing.parseQuery( QueryParsing.java > > :47) > > > > at org.apache.solr.request.StandardRequestHandler.handleRequest( > > > > StandardRequestHandler.java:94) > > > > at org.apache.solr.core.SolrCore.execute(SolrCore.java:586) > > > > at org.apache.solr.servlet.SolrServlet.doGet(SolrServlet.java:91) > > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) > > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > > > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > > > > ApplicationFilterChain.java:252) > > > > at org.apache.catalina.core.ApplicationFilterChain.doFilter( > > > > ApplicationFilterChain.java:173) > > > > at org.apache.catalina.core.StandardWrapperValve.invoke( > > > > StandardWrapperValve.java:213) > > > > at org.apache.catalina.core.StandardContextValve.invoke( > > > > StandardContextValve.java:178) > > > > at org.apache.catalina.core.StandardHostValve.invoke( > > > > StandardHostValve.java > > > > :126) > > > > at org.apache.catalina.valves.ErrorReportValve.invoke( > > > > ErrorReportValve.java > > > > :105) > > > > at org.apache.catalina.core.StandardEngineValve.invoke( > > > > StandardEngineValve.java:107) > > > > at org.apache.catalina.connector.CoyoteAdapter.service( > > > CoyoteAdapter.java > > > > :148) > > > > at org.apache.coyote.http11.Http11Processor.process( > > Http11Processor.java > > > > :869) > > > > at > > > > > > > > > > > > > > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection > > > > (Http11BaseProtocol.java:664) > > > > at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( > > > > PoolTcpEndpoint.java:527) > > > > at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( > > > > LeaderFollowerWorkerThread.java:80) > > > > at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( > > > > ThreadPool.java:684) > > > > at java.lang.Thread.run(Thread.java:595) > > > > > > > > > > > > > > > > -- regards jl