Could you just sort the suggestions at the app level? That is, read them
all into a list and sort before presenting them to the user?

Best
Erick


On Sun, Nov 11, 2012 at 10:52 PM, 徐郑 <eyun...@gmail.com> wrote:

> following is my config , it suggests words well .
> i want to get a sorted result when it suggest, so i added a transformer ,
> it will add a tab(\t) separated float weight string
> to the end of the Suggestion field , but the suggestion result still does't
> sorted correctly.
>
> my suggest result( note the float number at the end is the weight)
>
> <lst name="spellcheck">
> <lst name="suggestions">
> <lst name="我">
> <int name="numFound">10</int>
> <int name="startOffset">1</int>
> <int name="endOffset">2</int>
> <arr name="suggestion">
> <str>我脑中的橡皮擦 2.12</str>
> <str>我老婆是大佬3 2.07</str>
> <str>我老婆是大佬2 2.12</str>
>
>
>
>
> schema.xml
>
> <field name="Suggestion" type="string" indexed="true" stored="true"/>
>
>
>
> solrconfig.xml
>
>   <searchComponent class="solr.SpellCheckComponent" name="suggest">
>         <lst name="spellchecker">
>             <str name="name">suggest</str>
>             <str name="field">Suggestion</str>
>             <str
> name="classname">org.apache.solr.spelling.suggest.Suggester</str>
>             <str
> name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
>             <!-- <float name="threshold">0.0001</float> -->
>             <str name="spellcheckIndexDir">spellchecker</str>
>             <str name="comparatorClass">freq</str>
>             <str name="buildOnCommit">true</str>
>
>         </lst>
>     </searchComponent>
>     <requestHandler class="org.apache.solr.handler.component.SearchHandler"
>                     name="/suggest">
>         <lst name="defaults">
>             <str name="spellcheck">true</str>
>             <str name="spellcheck.dictionary">suggest</str>
>             <str name="spellcheck.count">10</str>
>             <str name="spellcheck.onlyMorePopular">true</str>
>             <str name="spellcheck.collate">true</str>
>         </lst>
>         <arr name="components">
>             <str>suggest</str>
>         </arr>
>     </requestHandler>
>
> --
>
> eyun
>
> The truth, whether or not
>
> Q:276770341   G+:eyun...@gmail.com
>

Reply via email to