<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/spell.suggestDetailed.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>spell.suggestDetailed</api:function-name><api:suggest>spell.suggestdetailed</api:suggest><api:suggest>spell</api:suggest><api:suggest>suggestdetailed</api:suggest><api:function-link mode="xquery" fullname="spell:suggest-detailed">/apidoc/8.0/spell:suggest-detailed.xml</api:function-link><api:function mode="javascript" name="suggestDetailed" type="builtin" lib="spell" category="SpellBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="spell" namespace="http://marklogic.com/xdmp/spell" fullname="spell.suggestDetailed"><api:summary>
  Suggests a list of spellings for a word. Returns 
  
  <span class="javascript" xmlns="http://www.w3.org/1999/xhtml">an array of objects</span>
  describing each suggestion, including the suggested word, the distance,
  the key distance, the word distance, and the levenshtein distance.  You can
  use this extra information to make your own decisions about which suggestions
  to use.  If you do not want to use this information, use the
  
  <code class="javascript" xmlns="http://www.w3.org/1999/xhtml">spell.suggest</code> function instead.
</api:summary><api:params><api:param name="dictionary_uris" type="xs:string*"><api:param-description>
    The URIs of the dictionaries to use.
  </api:param-description><api:param-name>dictionary_uris</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="word" type="xs:string"><api:param-description>
    The word for which you get spelling suggestions.
  </api:param-description><api:param-name>word</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="options" type="(element()|map:map)?" optional="true"><api:param-description>
    The options node for this suggest operation. The default is
    <code xmlns="http://www.w3.org/1999/xhtml">
          <span class="javascript">null</span></code>.

    
    

    <p xmlns="http://www.w3.org/1999/xhtml">The <code>
                 <span class="javascript">spell.suggestDetailed</span>
                 </code>
    options include:</p>
    <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
    <dt>
        <span class="javascript">maximum</span>
        </dt>
    <dd>Specifies the maximum number of suggestions to be returned.
    The default is 10.</dd>
    <dt>
        <span class="javascript">distanceThreshold</span>
        </dt>
    <dd>Specifies a cut off threshold for suggestions having a distance
    less than the given number.  The distance is a weighted number
    indicating the "distance" between two words,  where lower numbers
    indicate a closer match.  The default is 100, which means that distances
    less than or equal to 100 are considered as suggestions.</dd>
    </dl></blockquote>
  </api:param-description><api:param-name>options</api:param-name><api:param-type>Object?</api:param-type></api:param></api:params><api:return class="javascript">Array</api:return><api:usage>
   <p xmlns="http://www.w3.org/1999/xhtml">The <code>
                <span class="javascript">spell.suggestDetailed</span>
                </code>
   function is built-in and does not require 
   <span class="javascript">importing any separate module</span>.
   </p>
   <p xmlns="http://www.w3.org/1999/xhtml">The <code>
                <span class="javascript">spell.suggestDetailed</span>
                </code>
   function only provides suggestions to words that are less than 64
   characters in length; words 64 characters or longer return no
   suggestions.  Also, it removes any dictionary entries that are 64
   characters or more, so it will never return a suggestion with
   greater than 64 characters.
   </p>
   <p xmlns="http://www.w3.org/1999/xhtml">The <code>
                <span class="javascript">keyDistance</span>
                </code>
   and <code>
             <span class="javascript">wordDistance</span>
             </code>
   values in the output are used by the double metaphone algorithm to
   calculate the <code>distance</code>, which is a weighted number
   indicating how close a word is to the one in the dictionary.</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
spell.suggestDetailed("myDictionary.xml","occasionally");

=&gt; ()
</pre></api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
two-words.xml:

   &lt;dictionary xmlns="http://marklogic.com/xdmp/spell"&gt;
   &lt;word&gt;albatross&lt;/word&gt;
   &lt;word&gt;albatrosses&lt;/word&gt;
   &lt;/dictionary&gt;

// preparatory

declareUpdate();
xdmp.documentLoad("/space/two-words.xml");

// then run spell.suggestDetailed

spell.suggestDetailed("/space/two-words.xml",
                      "albetros",
                      { 
		        "maximum": 5,
                        "distanceThreshold":500
                      });
==&gt;
[
{
"original": "albatros",
"word": "albatross",
"dictionary": "/space/two-words.xml",
"distance": 9,
"keyDistance": 0,
"wordDistance": 45,
"levenshteinDistance": 1
},
{
"original": "albatros",
"word": "albatrosses",
"dictionary": "/space/two-words.xml",
"distance": 48,
"keyDistance": 1,
"wordDistance": 135,
"levenshteinDistance": 3
}
]
</pre></api:example></api:function></api:function-page>