Skip to content

Instantly share code, notes, and snippets.

<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<int name="rows">10</int>
<str name="df">name</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
http://localhost:8983/solr/collection1/select?q=name:(ipod%20AND%20aple)&spellcheck=true&fl=name&spellcheck.collate=true&spellcheck.collateExtendedResults=true
@vinicius85
vinicius85 / gist:5686740
Last active December 17, 2015 23:08
Solr spellcheck response
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">18</int>
<str name="q">name:(ipod AND aple)</str>
</lst>
<result name="response" numFound="0" start="0"/>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="aple">
@vinicius85
vinicius85 / gist:5687341
Last active November 20, 2021 17:06
Lucene StringDistance sample
import java.util.ArrayList;
import java.util.List;
import org.apache.lucene.search.spell.JaroWinklerDistance;
import org.apache.lucene.search.spell.LevensteinDistance;
import org.apache.lucene.search.spell.NGramDistance;
import org.apache.lucene.search.spell.StringDistance;
public class TestLuceneDistanceImplementations
{
public static void main(String[] args)
@vinicius85
vinicius85 / gist:5687379
Last active December 17, 2015 23:09
lucene stringdistance example output
class org.apache.lucene.search.spell.LevensteinDistance
misspelled=notebuk word=notebook distance=0.75
misspelled=notebuk word=notebooks distance=0.6666666
misspelled=notebuk word=netbook distance=0.4285714
class org.apache.lucene.search.spell.JaroWinklerDistance
misspelled=notebuk word=notebook distance=0.9345238
misspelled=notebuk word=notebooks distance=0.92063487
misspelled=notebuk word=netbook distance=0.76857144