11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<br />

solr.IndexBasedSpellChecker<br />

./spellchecker<br />

content<br />

true<br />

<br />

<br />

<br />

The first element defines the searchComponent to use the solr.SpellCheckComponent. The classname i<br />

s the specific implementation of the SpellCheckComponent, in this case solr.IndexBasedSpellChecker.<br />

Defining the classname is optional; if not defined, it will default to IndexBasedSpellChecker.<br />

The spellcheckIndexDir defines the location of the directory that holds the spellcheck index, while the fiel<br />

d defines the source field (defined in the Schema) for spell check terms. When choosing a field for the spellcheck<br />

index, it's best to avoid a heavily processed field to get more accurate results. If the field has many word<br />

variations from processing synonyms and/or stemming, the dictionary will be created with those variations in<br />

addition to more valid spelling data.<br />

Finally, buildOnCommit defines whether to build the spell check index at every commit (that is, every time new<br />

documents are added to the index). It is optional, and can be omitted if you would rather set it to false.<br />

Direct<strong>Solr</strong>SpellChecker<br />

The Direct<strong>Solr</strong>SpellChecker uses terms from the <strong>Solr</strong> index without building a parallel index like the Index<br />

BasedSpellChecker. This spell checker has the benefit of not having to be built regularly, meaning that the<br />

terms are always up-to-date with terms in the index. Here is how this might be configured in solrconfig.xml<br />

<br />

<br />

default<br />

name<br />

solr.Direct<strong>Solr</strong>SpellChecker<br />

internal<br />

0.5<br />

2<br />

1<br />

5<br />

4<br />

0.01<br />

.01<br />

<br />

<br />

When choosing a field to query for this spell checker, you want one which has relatively little analysis<br />

performed on it (particularly analysis such as stemming). Note that you need to specify a field to use for the<br />

suggestions, so like the IndexBasedSpellChecker, you may want to copy data from fields like title, body,<br />

etc., to a field dedicated to providing spelling suggestions.<br />

Many of the parameters relate to how this spell checker should query the index for term suggestions. The dista<br />

nceMeasure defines the metric to use during the spell check query. The value "internal" uses the default<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

324

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!