Sent from my iPhone

On Aug 21, 2011, at 5:54 AM, "Kuba Krzemien" <krzemi...@aster.pl> wrote:

Finally got it working - turns out you can't just add it to the lib dir as the wiki suggests. Unfortunately the only way is adding it to solr.war.

Thanks for your help.

--------------------------------------------------
From: "William Oberman" <ober...@civicscience.com>
Sent: Friday, August 19, 2011 5:07 PM
To: <solr-user@lucene.apache.org>
Subject: Re: suggester issues

Hard to say, so I'll list the exact steps I took:
-Downloaded apache-solr-3.3.0 (I like to stick with releases vs. svn)
-Untar and cd
-ant
-Wrote my class below (under a peer directory in apache-solr-3.3.0)
-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

And, that seemed to all work.

will

On Aug 19, 2011, at 10:44 AM, Kuba Krzemien wrote:

As far as I checked creating a custom query converter is the only way to make this work. Unfortunately I have some problems with running it - after creating a JAR with my class (Im using your source code, obviously besides package and class names) and throwing it into the lib dir I've added <queryConverter name="queryConverter" class="mypackage.MySpellingQueryConverter"/> to solrconfig.xml.

I get a "SEVERE: org.apache.solr.common.SolrException: Error Instantiating QueryConverter, mypackage.MySpellingQueryConverter is not a org.apache.solr.spelling.QueryConverter".

What am I doing wrong?

--------------------------------------------------
From: "William Oberman" <ober...@civicscience.com>
Sent: Thursday, August 18, 2011 10:35 PM
To: <solr-user@lucene.apache.org>
Subject: Re: suggester issues

I tried this:
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;
}

}

And added it to the classpath, and now it does what I expect.

will


On Aug 18, 2011, at 2:33 PM, Alexei Martchenko wrote:

It can be done, I did that with shingles, but it's not the way it's meant to be. The main problem with suggester is that we want compound words and we never get them. I try to get "internet explorer" but when i enter in the
second word, "internet e" the suggester never finds "explorer".

2011/8/18 oberman_cs <ober...@civicscience.com>

I was trying to deal with the exact same issue, with the exact same
results.
Is there really no way to feed a phrase into the suggester (spellchecker)
without it splitting the input phrase into words?

--
View this message in context:
http://lucene.472066.n3.nabble.com/suggester-issues-tp3262718p3265803.html
Sent from the Solr - User mailing list archive at Nabble.com.




--

*Alexei Martchenko* | *CEO* | Superdownloads
ale...@superdownloads.com.br | ale...@martchenko.com.br | (11)
5083.1018/5080.3535/5080.3533

Reply via email to