Reputation: 13
I'm new to java, but i need to use solr as "full text search" engine... I was able to install it and run it successfully, but I need to use the "suggester component"
Here is my suggester configuration:
<searchComponent name="suggester" class="solr.SpellCheckComponent">
<lst name="spellchecker" >
<str name="name">suggester</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookupFactory</str>
<str name="field">name</str>
<!-- <str name="threshold">2</str> -->
</lst>
</searchComponent>
<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggester">
<lst name="defaults">
<str name="spellcheck" >true</str>
<str name="spellcheck.dictionary">suggester</str>
<str name="spellcheck.count">10</str>
</lst>
<arr name="component" >
<str>suggester</str>
</arr>
</requestHandler>
I'm running it with command java -jar start.jar ( like this website ) and get the following error
INFO: Closing Searcher@1220b36 main
fieldValueCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
filterCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
queryResultCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
documentCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Aug 9, 2012 5:14:32 PM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:600)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:480)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:332)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:216)
at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161)
at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.mortbay.start.Main.invokeMain(Main.java:194)
at org.mortbay.start.Main.start(Main.java:534)
at org.mortbay.start.Main.start(Main.java:441)
at org.mortbay.start.Main.main(Main.java:119)
Caused by: org.apache.solr.common.SolrException: Error loading class 'org.apache.solr.spelling.suggest.tst.TSTLookupFactory
'
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:394)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:409)
at org.apache.solr.spelling.suggest.Suggester.init(Suggester.java:100)
at org.apache.solr.handler.component.SpellCheckComponent.inform(SpellCheckComponent.java:598)
at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:527)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:594)
... 30 more
Caused by: java.lang.ClassNotFoundException: org.apache.solr.spelling.suggest.tst.TSTLookupFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:615)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:378)
... 35 more
I looked up the class and I found it in $SOLR_HOME/dist/apache-solr-core-[solr version].jar so I tried to run Solr with command
java -cp $SOLR_HOME/dist/apache-solr-core-3.6.1 -jar start.jar
But i got the same error
Upvotes: 1
Views: 2499
Reputation: 60245
You don't need to customize anything in order to use the Suggester, neither to find that class, which is already included in Solr. I would start with a fresh downloaded Solr 3.6.1 (or just revert the changes you made). The problem is in your configuration, which contains a line feed between the name of the class and the end of the xml element </str>
. That's why SOlr can't find that class. Just remove the line feed and everything will work!
Upvotes: 2
Reputation: 27604
TSTLookupFactory
should be present in the solr-core jar (at least in version 3.4.0). You can verify it manually (if you're using some other version) by opening the jar file in WinRAR or some other utility capable of opening RAR files and verify that it's in the directory org/apache/solr/spelling/suggest/tst in the jar. If it's not, you may be using an older version of SOLR and you'll have to upgrade.
Then make sure that the solr-core jar is indeed on your classpath (as well as lucene-spellchecker jar and the other solr/lucene jars).
Upvotes: 0