You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Xelion <f....@gmail.com> on 2015/03/14 16:40:15 UTC

Solr How to sorting suggestions by sales

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. 

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.

The most important thing that I would understand its if we can sort the
suggestion for a weight chosen by us.

The version of solr we are using is the 5.0.

schema.xml: 

    <field name="name_complete" type="text_shingle" indexed="true"
stored="true" required="false" multiValued="false"
omitTermFreqAndPositions="true"/>

    <fieldType name="text_shingle" class="solr.TextField"
positionIncrementGap="100"> 
    	<analyzer> 
    		<tokenizer class="solr.StandardTokenizerFactory"/> 
    		<filter class="solr.LowerCaseFilterFactory"/> 
    		<filter class="solr.ShingleFilterFactory" maxShingleSize="4"
outputUnigrams="true"/> 
    	</analyzer> 
    </fieldType>

solrconfig.xml
  FreeTextLookupFactory:

    <searchComponent name="suggest" class="solr.SuggestComponent">
    	<lst name="suggester">
    		<str name="name">suggest_product_free</str>
    		<str name="lookupImpl">FreeTextLookupFactory</str>
    		<str name="dictionaryImpl">DocumentDictionaryFactory</str>
    		<str name="field">name_complete</str>
    		<str name="indexPath">suggest_product_free</str>
    		<str name="weightField">n_sales</str>
    		<str name="buildOnCommit">true</str>
    		
    		<str name="suggestFreeTextAnalyzerFieldType">text_shingle</str>
    	<int name="ngrams">3</int>
    	</lst>
    </searchComponent>
    
    <requestHandler name="/suggest" class="solr.SearchHandler">
    	<lst name="defaults">
    		<str name="echoParams">explicit</str>
    		<str name="wt">json</str>
    		<str name="indent">true</str>
    		<str name="suggest">true</str>
    		<str name="suggest.count">10</str>
    	</lst>
    	
    	<arr name="components">
    		<str>suggest</str>
    	</arr>
    </requestHandler>

   spellcheck:

    <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
    	<lst name="spellchecker">
    		<str name="queryAnalyzerFieldType">text_shingle</str>
    		<str name="name">autocomplete</str>
    		<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
    		<str
name="lookupImpl">org.apache.solr.spelling.suggest.fst.WFSTLookupFactory</str>
    		<str name="field">name_complete</str>
    		<str name="buildOnCommit">true</str>
    		<float name="threshold">0.005</float>
           <str name="spellcheckIndexDir">./suggester_autocomplete</str>
    	</lst>
    </searchComponent>

    <requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
        <lst name="defaults">
    		<str name="spellcheck">true</str>
    		<str name="spellcheck.count">10</str>
    		<str name="spellcheck.onlyMorePopular">true</str>
    		<str name="spellcheck.dictionary">autocomplete</str>
        </lst>
        <arr name="last-components">
          <str>spellcheck</str>
        </arr>
      </requestHandler>

any ideas how I can make to order the suggestion for the weight?

Thanks to all and have a nice day.



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-How-to-sorting-suggestions-by-sales-tp4193009.html
Sent from the Solr - User mailing list archive at Nabble.com.