search - Solr 5.5.0 error when overriding ClassicSimilarityFactory -


context:: getting error in solr-core 5.5.0 when overriding classicsimilarityfactory. have pasted logs , class. overriding classicsimilarityfactory throws error- context:: getting error in solr-core 5.5.0 when overriding classicsimilarityfactory. have pasted logs , class. overriding classicsimilarityfactory throws error-

package com.others; import org.apache.lucene.analysis.payloads.payloadhelper; import org.apache.lucene.search.similarities.classicsimilarity; import org.apache.lucene.search.similarities.similarity; import org.apache.lucene.util.bytesref; import org.apache.solr.common.params.solrparams; import org.apache.solr.search.similarities.classicsimilarityfactory; import org.slf4j.logger; import org.slf4j.loggerfactory;  public class payloadsimilarityfactory extends classicsimilarityfactory {   @override   public void init(solrparams params) {     super.init(params);   }    @override   public similarity getsimilarity() {     return new payloadsimilarity();   } }  class payloadsimilarity extends classicsimilarity  {   private final static logger logger = loggerfactory.getlogger(payloadsimilarity.class);   //here's decode payload , return it.   @override   public float scorepayload(int doc, int start, int end, bytesref payload) {      logger.info("payloadsimilarity ---- " + payload);     if (payload == null)       return 1.0f;      return payloadhelper.decodefloat(payload.bytes, payload.offset);   } }    schema.xml file :      <fieldtype name="payloads" class="solr.textfield" indexed="true" stored="true">         <analyzer>           <tokenizer class="solr.whitespacetokenizerfactory"/>           <filter class="solr.delimitedpayloadtokenfilterfactory" encoder="float" delimiter="|"/>         </analyzer>         <similarity class="com.others.payloadsimilarityfactory"/>     </fieldtype>     </types>  error logs :   error creating core [catalog]: not load conf core catalog: can't load schema /users/z002cww/repo/jarvis-solr-config/config/catalog/conf/schema.xml: fieldtype 'payloads' configured similarity, global similarity not support it: class org.apache.solr.search.similarities.classicsimilarityfactory org.apache.solr.common.solrexception: not load conf core catalog: can't load schema /users/z002cww/repo/jarvis-solr-config/config/catalog/conf/schema.xml: fieldtype 'payloads' configured similarity, global similarity not support it: class org.apache.solr.search.similarities.classicsimilarityfactory     @ org.apache.solr.core.configsetservice.getconfig(configsetservice.java:84)     @ org.apache.solr.core.corecontainer.create(corecontainer.java:812)     @ org.apache.solr.core.corecontainer.access$000(corecontainer.java:87)     @ org.apache.solr.core.corecontainer$1.call(corecontainer.java:467) 

you'll have use schemasimilarityfactory configured default similarity support using per field similarities.

<similarity class="solr.schemasimilarityfactory"/> 

see 1 of answers solr lucene scorer , the mailinglist answer same question.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -