0
我有以下網址:如何使用SOLR URL對結果集進行排序?
http://webaddress:8994/solr/crossmedia/select?q=MEM_ED_NUMBER:136250%20AND%20CM_TYPE:WEB_MOBILE&rows=0&wt=json&indent=true&json.facet={Level1:{type:terms,field:ENTRY_DATE,limit:100,facet:{Level2: {type:terms,field:NAME_URL,limit:100,facet:{sum:"sum(PAGE_IMPRESSIONS)",sum2:"sum(PAGE_IMPRESSIONS)"}}}}}
產生以下結果:
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"MEM_ED_NUMBER:136250 AND CM_TYPE:WEB_MOBILE",
"json.facet":"{Level1:{type:terms,field:ENTRY_DATE,limit:100,facet:{Level2:{type:terms,field:NAME_URL,limit:100,facet:{sum:\"sum(PAGE_IMPRESSIONS)\",sum2:\"sum(PAGE_IMPRESSIONS)\"}}}}}",
"indent":"true",
"rows":"0",
"wt":"json"}},
"response":{"numFound":32,"start":0,"docs":[]
},
"facets":{
"count":32,
"Level1":{
"buckets":[{
"val":"2015-01-01T00:00:01Z",
"count":2,
"Level2":{
"buckets":[{
"val":"www.newarkadvocate.com",
"count":2,
"sum":7118768.0,
"sum2":7118768.0}]}},
{
"val":"2015-02-01T00:00:01Z",
"count":2,
"Level2":{
"buckets":[{
"val":"www.newarkadvocate.com",
"count":2,
"sum":7458540.0,
"sum2":7458540.0}]}},
{
"val":"2015-03-01T00:00:01Z",
"count":2,
"Level2":{
"buckets":[{
"val":"www.newarkadvocate.com",
"count":2,
"sum":7737596.0,
"sum2":7737596.0}]}},
{
"val":"2015-04-01T00:00:01Z",
"count":2,
"Level2":{
"buckets":[{
"val":"www.newarkadvocate.com",
"count":2,
"sum":8968393.0,
我想這樣做是爲了它ENTRY_DATE DESCENDING,但我不能讓它正確的。
我已經試過
http://webaddress:8994/solr/crossmedia/select?q=MEM_ED_NUMBER:136250%20AND%20CM_TYPE:WEB_MOBILE&sort=ENTRY_DATE%20desc&rows=0&wt=json&indent=true&json.facet={Level1:{type:terms,field:ENTRY_DATE,limit:100,facet:{Level2:{type:terms,field:NAME_URL,limit:100,facet:{sum:"sum(PAGE_IMPRESSIONS)",sum2:"sum(PAGE_IMPRESSIONS)"}}}}}
這給了我同樣的結果集,沒有順序的變化。
我已經試過
http://webaddress:8994/solr/crossmedia/select?q=MEM_ED_NUMBER:136250%20AND%20CM_TYPE:WEB_MOBILE&rows=0&wt=json&indent=true&json.facet={Level1:{type:terms,field:ENTRY_DATE,sort:"ENTRY_DATE%20desc",limit:100,facet:{Level2:{type:terms,field:NAME_URL,limit:100,facet:{sum:%22sum(PAGE_IMPRESSIONS)%22,sum2:%22sum(PAGE_IMPRESSIONS)%22}}}}}
這給了我一個錯誤。
有人可以幫忙嗎?
感謝, 鮑勃
下面是從固定的大括號最新的URL的錯誤消息。
{
"responseHeader":{
"status":500,
"QTime":0,
"params":{
"q":"MEM_ED_NUMBER:136250 AND CM_TYPE:WEB_MOBILE",
"json.facet":" {Level1: {sort: {ENTRY_DATE: desc}, type:terms, field:ENTRY_DATE, limit:100, facet:{Level2: {type:terms,field:NAME_URL,limit:100,facet: {sum:\"sum(PAGE_IMPRESSIONS)\",sum2:\"sum(PAGE_IMPRESSIONS)\"}}}}}",
"indent":"true",
"rows":"0",
"wt":"json"}},
"response":{"numFound":32,"start":0,"docs":[]
},
"error":{
"trace":"java.lang.NullPointerException\r\n\tat org.apache.solr.search.facet.FacetFieldProcessorNumeric$5.lessThan(FacetFieldProcessorNumeric.java:371)\r\n\tat org.apache.solr.search.facet.FacetFieldProcessorNumeric$5.lessThan(FacetFieldProcessorNumeric.java:367)\r\n\tat org.apache.lucene.util.PriorityQueue.upHeap(PriorityQueue.java:258)\r\n\tat org.apache.lucene.util.PriorityQueue.add(PriorityQueue.java:135)\r\n\tat org.apache.lucene.util.PriorityQueue.insertWithOverflow(PriorityQueue.java:151)\r\n\tat org.apache.solr.search.facet.FacetFieldProcessorNumeric.calcFacets(FacetFieldProcessorNumeric.java:397)\r\n\tat org.apache.solr.search.facet.FacetFieldProcessorNumeric.process(FacetFieldProcessorNumeric.java:151)\r\n\tat org.apache.solr.search.facet.FacetProcessor.processSubs(FacetRequest.java:267)\r\n\tat org.apache.solr.search.facet.FacetProcessor.fillBucket(FacetRequest.java:354)\r\n\tat org.apache.solr.search.facet.FacetQueryProcessor.process(FacetQuery.java:57)\r\n\tat org.apache.solr.search.facet.FacetModule.process(FacetModule.java:87)\r\n\tat org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:255)\r\n\tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)\r\n\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:2064)\r\n\tat org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:654)\r\n\tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:450)\r\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:227)\r\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:196)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\r\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)\r\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:497)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\r\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)\r\n\tat org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)\r\n\tat java.lang.Thread.run(Unknown Source)\r\n",
"code":500}}
這裏是我的SOLR要求:
http://webdev:8994/solr/crossmedia/select?q=MEM_ED_NUMBER:136250%20AND%20CM_TYPE:WEB_MOBILE&rows=0&wt=json&indent=true&json.facet=%20{Level1:%20{sort:%20{ENTRY_DATE:%20desc},%20type:terms,%20field:ENTRY_DATE,%20limit:100,%20facet:{Level2:%20{type:terms,field:NAME_URL,limit:100,facet:%20{sum:%22sum(PAGE_IMPRESSIONS)%22,sum2:%22sum(PAGE_IMPRESSIONS)%22}}}}}
我複製了你的上面的URL,把webaddress改成了實際的地址並運行它,並得到了下面的錯誤信息。看下一個答案。 –
修正了排序必須執行的級別,現在試試吧? – Persimmonium
這次有不同的錯誤。它張貼在下面。感謝您花時間幫助我解決這個問題。 –