我spell:suggest
用来查询字典.我会假设结果按距离排序.但事实并非如此,如spell:suggest-detailed
以下示例所示.
例:
spell:suggest-detailed("/my-dictionary.xml", "cohn",
<options xmlns="http://marklogic.com/xdmp/spell">
<distance-threshold>10</distance-threshold>
<maximum>3</maximum>
</options>
)
Run Code Online (Sandbox Code Playgroud)
结果:
<spell:suggestion original="cohn" dictionary="/my-dictionary.xml" xmlns:spell="http://marklogic.com/xdmp/spell">
<spell:word distance="10" key-distance="0" word-distance="50" levenshtein-distance="1">coin</spell:word>
</spell:suggestion>
<spell:suggestion original="cohn" dictionary="/my-dictionary.xml" xmlns:spell="http://marklogic.com/xdmp/spell">
<spell:word distance="10" key-distance="0" word-distance="50" levenshtein-distance="1">conn</spell:word>
</spell:suggestion>
<spell:suggestion original="cohn" dictionary="/my-dictionary.xml" xmlns:spell="http://marklogic.com/xdmp/spell">
<spell:word distance="9" key-distance="1" word-distance="45" levenshtein-distance="1">crohn</spell:word>
</spell:suggestion>
Run Code Online (Sandbox Code Playgroud)
第三个结果的距离是9,小于距离为10的前两个结果的距离.排序中是否有错误?