I fixed this problem by writing an external Java class and changing completly
to Lucene-2.4.0.
The SpellChecker now returns results but it is very slow.
My index contains about 20000 words, I don't think this is too much.
How can I speed it up?
My temporary method:
public static Vector suggest(String query, String indexName, String field,
float accuracy) {
Vector v = new Vector();
String[] suggestions = null;
try {
SpellChecker spellchecker = new SpellChecker(new
RAMDirectory()/*, new
JaroWinklerDistance()*/);
spellchecker.indexDictionary(new
LuceneDictionary(IndexReader.open(indexName), field));
spellchecker.setAccuracy(accuracy);
suggestions = spellchecker.suggestSimilar(query, 5);
} catch (Exception e) {}
for(int i = 0; i < suggestions.length; i++) {
v.add(suggestions[i]);
}
return v;
}
Matthias W. wrote:
>
> Hi,
> I'm using Lucene's SpellChecker (Lucene 2.1.0) class to get suggestions.
> Till now my testing server was a VMWare-Image from
> http://es.cohesiveft.com http://es.cohesiveft.com (Ubuntu 8.10, Tomcat6,
> Java5).
> Now I'm using a Debian Etch Server with Tomcat5.5 and Java6.
>
> Code-Sample:
> String indexName = indexLocation;
> String queryString = null;
> queryString = URLDecoder.decode(request.getParameter("q"), "UTF-8");
> SpellChecker spellchecker = new
> SpellChecker(FSDirectory.getDirectory(indexName));
> String[] suggestions = spellchecker.suggestSimilar(queryString, 5,
> IndexReader.open(indexName), "content", false);
> for(int i = 0; i < suggestions.length; i++) {
> out.println(suggestions[i]);
> }
>
> This worked fine on the old server, but on my new server this returns
> nothing.
> The index is generated by the nutch crawler, but this shouldn't be the
> problem.
>
> I've got the lucene-spellchecker-2.1.0.jar in the WEB-INF/lib/ (If I
> remove it, I get the expected errormessage.)
>
> So I don't know why I neither get results, nor an errormessage.
>
--
View this message in context:
http://www.nabble.com/Lucene-SpellChecker-returns-no-suggetions-after-changing-Server-tp20910159p21015278.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]