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