title: Solr How to sorting suggestions by sales
body: <p>We are trying to use solr on our website as a search engine , but we have a problem , we can not sort the suggestions by the number of sales. </p>
  
  <p>I tried the components Facet, Terms, FreeTextLookupFactory and the spellcheck component, but in none of the above components are able to get the results that I want.</p>
  
  <p>The most important thing that I would understand its if we can sort the suggestion for a weight chosen by us.</p>
  
  <p>The version of solr we are using is the 5.0.</p>
  
  <p>schema.xml: </p>
  
  <pre><code>&lt;field name="name_complete" type="text_shingle" indexed="true" stored="true" required="false" multiValued="false" omitTermFreqAndPositions="true"/&gt;
  
  &lt;fieldType name="text_shingle" class="solr.TextField" positionIncrementGap="100"&gt; 
      &lt;analyzer&gt; 
          &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt; 
          &lt;filter class="solr.LowerCaseFilterFactory"/&gt; 
          &lt;filter class="solr.ShingleFilterFactory" maxShingleSize="4" outputUnigrams="true"/&gt; 
      &lt;/analyzer&gt; 
  &lt;/fieldType&gt;
  </code></pre>
  
  <p>solrconfig.xml
    FreeTextLookupFactory:</p>
  
  <pre><code>&lt;searchComponent name="suggest" class="solr.SuggestComponent"&gt;
      &lt;lst name="suggester"&gt;
          &lt;str name="name"&gt;suggest_product_free&lt;/str&gt;
          &lt;str name="lookupImpl"&gt;FreeTextLookupFactory&lt;/str&gt;
          &lt;str name="dictionaryImpl"&gt;DocumentDictionaryFactory&lt;/str&gt;
          &lt;str name="field"&gt;name_complete&lt;/str&gt;
          &lt;str name="indexPath"&gt;suggest_product_free&lt;/str&gt;
          &lt;str name="weightField"&gt;n_sales&lt;/str&gt;
          &lt;str name="buildOnCommit"&gt;true&lt;/str&gt;
  
          &lt;str name="suggestFreeTextAnalyzerFieldType"&gt;text_shingle&lt;/str&gt;
      &lt;int name="ngrams"&gt;3&lt;/int&gt;
      &lt;/lst&gt;
  &lt;/searchComponent&gt;
  
  &lt;requestHandler name="/suggest" class="solr.SearchHandler"&gt;
      &lt;lst name="defaults"&gt;
          &lt;str name="echoParams"&gt;explicit&lt;/str&gt;
          &lt;str name="wt"&gt;json&lt;/str&gt;
          &lt;str name="indent"&gt;true&lt;/str&gt;
          &lt;str name="suggest"&gt;true&lt;/str&gt;
          &lt;str name="suggest.count"&gt;10&lt;/str&gt;
      &lt;/lst&gt;
  
      &lt;arr name="components"&gt;
          &lt;str&gt;suggest&lt;/str&gt;
      &lt;/arr&gt;
  &lt;/requestHandler&gt;
  </code></pre>
  
  <p>spellcheck:</p>
  
  <pre><code>&lt;searchComponent name="spellcheck" class="solr.SpellCheckComponent"&gt;
      &lt;lst name="spellchecker"&gt;
          &lt;str name="queryAnalyzerFieldType"&gt;text_shingle&lt;/str&gt;
          &lt;str name="name"&gt;autocomplete&lt;/str&gt;
          &lt;str name="classname"&gt;org.apache.solr.spelling.suggest.Suggester&lt;/str&gt;
          &lt;str name="lookupImpl"&gt;org.apache.solr.spelling.suggest.fst.WFSTLookupFactory&lt;/str&gt;
          &lt;str name="field"&gt;name_complete&lt;/str&gt;
          &lt;str name="buildOnCommit"&gt;true&lt;/str&gt;
          &lt;float name="threshold"&gt;0.005&lt;/float&gt;
         &lt;str name="spellcheckIndexDir"&gt;./suggester_autocomplete&lt;/str&gt;
      &lt;/lst&gt;
  &lt;/searchComponent&gt;
  
  &lt;requestHandler name="/spell" class="solr.SearchHandler" startup="lazy"&gt;
      &lt;lst name="defaults"&gt;
        &lt;!-- Solr will use suggestions from both the 'default' spellchecker
             and from the 'wordbreak' spellchecker and combine them.
             collations (re-written queries) can include a combination of
             corrections from both spellcheckers --&gt;
          &lt;str name="spellcheck"&gt;true&lt;/str&gt;
          &lt;str name="spellcheck.count"&gt;10&lt;/str&gt;
          &lt;str name="spellcheck.onlyMorePopular"&gt;true&lt;/str&gt;
          &lt;str name="spellcheck.dictionary"&gt;autocomplete&lt;/str&gt;
          &lt;!--str name="spellcheck.dictionary"&gt;wordbreak&lt;/str&gt;
          &lt;str name="spellcheck.extendedResults"&gt;true&lt;/str&gt;
          &lt;str name="spellcheck.alternativeTermCount"&gt;5&lt;/str&gt;
          &lt;str name="spellcheck.maxResultsForSuggest"&gt;5&lt;/str&gt;
          &lt;str name="spellcheck.collate"&gt;true&lt;/str&gt;
          &lt;str name="spellcheck.collateExtendedResults"&gt;true&lt;/str&gt;
          &lt;str name="spellcheck.maxCollationTries"&gt;10&lt;/str&gt;
          &lt;str name="spellcheck.maxCollations"&gt;5&lt;/str--&gt;
      &lt;/lst&gt;
      &lt;arr name="last-components"&gt;
        &lt;str&gt;spellcheck&lt;/str&gt;
      &lt;/arr&gt;
    &lt;/requestHandler&gt;
  </code></pre>
  
  <p>any ideas how I can make to order the suggestion for the weight?</p>
  
  <p>Thanks to all and have a nice day.</p>
  
  <p>example:
  assume that I have these saved values on solr:</p>
  
  <pre><code>1: Reflex canon eos 7d (weight: 1)
  2: Reflex canon eos 6d (weight: 2)
  3: Reflex canon eos 70d (weight: 3)
  </code></pre>
  
  <p>and requested the string 'can'.
  the result that I want:</p>
  
  <pre><code>canon eos
  canon eos 70d
  canon eos 6d
  canon eos 7d
  </code></pre>
  
  <p>in practice would that it were a autocomplete that I can order for the weight.</p>