[solr ] solr函数权重排序问题请教

hito123 2016-10-29
加入一个查询Handler到solrconfig.xml的<config/>当中:
    <requestHandler name="/browse" class="solr.SearchHandler" default="true" >
        <lst name="defaults">
            <str name="defType">edismax</str>
            <str name="bf">
                sum(linear(vip,1000,0),linear(sqrt(log(linear(point,1,2))),100,0),sqrt(log(ms(createTime))))
            </str>
            <!--<str name="pf">
            searchText
            </str>
            <str name="qf">
            subject^1 content^0.8
            </str>-->
        </lst>
    </requestHandler>

重启solr后查询,一直报下面的错误(把这行sum(linear(vip,1000,0),linear(sqrt(log(linear(point,1,2))),100,0),sqrt(log(ms(createTime))))注释掉就不报错了,说明是函数使用有问题吧,求问问题在那里?):

o.a.s.s.HttpSolrCall null:java.lang.UnsupportedOperationException
    at org.apache.lucene.queries.function.FunctionValues.floatVal(FunctionValues.java:44)
    at org.apache.lucene.queries.function.valuesource.SumFloatFunction.func(SumFloatFunction.java:39)
    at org.apache.lucene.queries.function.valuesource.MultiFloatFunction$1.floatVal(MultiFloatFunction.java:82)
    at org.apache.lucene.queries.function.FunctionQuery$AllScorer.score(FunctionQuery.java:123)
    at org.apache.lucene.search.ReqOptSumScorer.score(ReqOptSumScorer.java:82)
    at org.apache.lucene.search.TopScoreDocCollector$SimpleTopScoreDocCollector$1.collect(TopScoreDocCollector.java:64)
    at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:221)
    at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:172)
    at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39)
    at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:821)
    at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:535)
    at org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:206)
    at org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1792)
    at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1611)
    at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:573)
    at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:524)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:272)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:155)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2082)
    at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:670)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:458)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:225)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:183)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
冰糖葫芦 2016-11-28
检查你的vip、point、createtime字段是不是为空了,目测vip和point出问题的几率比较大
Global site tag (gtag.js) - Google Analytics