I listed the basic steps I took in the other thread (recently), which were: -Downloaded apache-solr-3.3.0 archive (I like to stick with releases vs. svn) -Untar (tar -xzvf) and cd -ant (to compile) -mkdir something, cd something (e.g. create a peer directory in apache-solr-3.3.0) -Wrote my class below (you have to create dirs == your package, so for me I neede com/civicscience) -javac -cp ../dist/apache-solr-core-3.3.0.jar:../lucene/build/lucene-core-3.3-SNAPSHOT.jar com/civicscience/SpellingQueryConverter.java -jar cf cs.jar com -Unzipped solr.war (under example) -Added my cs.jar to lib (under web-inf) -Rezipped solr.war -Added: <queryConverter name="queryConverter" class="com.civicscience.SpellingQueryConverter"/> to solrconfig.xml -Restarted jetty
The part that had me stuck for awhile was that dropping my class into example/lib didn't work, but putting it in the war did. I don't know if you can specify QueryConverters other than globally, I'm really new to solr myself. Good luck! will On Aug 22, 2011, at 9:02 AM, Valentin wrote: > I found the thread "Suggester Issues". You said to write a new java class : > > package com.civicscience; > > import java.util.ArrayList; > import java.util.Collection; > import java.util.Collections; > > import org.apache.lucene.analysis.Token; > import org.apache.solr.spelling.QueryConverter; > > /** > > > > * Converts the query string to a Collection of Lucene tokens. > > > **/ > public class SpellingQueryConverter extends QueryConverter { > > /** > > > * Converts the original query string to a collection of Lucene Tokens. > > > * @param original the original query string > > > * @return a Collection of Lucene Tokens > > > */ > @Override > public Collection<Token> convert(String original) { > if (original == null) { > > > return Collections.emptyList(); > } > Collection<Token> result = new ArrayList<Token>(); > Token token = new Token(original, 0, original.length(), "word"); > result.add(token); > return result; > } > > } > > > But I don't know where and how to write it. Can you help me ? > > Moreover, will it change my other spellcheckers too ? I have some other that > I don't want to be modified... > > Thanks. > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Full-sentence-spellcheck-tp3265257p3274956.html > Sent from the Solr - User mailing list archive at Nabble.com.