Help,
(Solr 6.3)
Trying to do a "sub-facet" using the new json faceting API, but can't
seem to figure out how to get the "max" date in the subfacet?
I've tried a couple of different ways:
== query ==
json.facet={
code_s:{
limit:-1,
type:terms,field:code_s,facet:{
issuedate_tdt:"max(issuedate_tdt)"
}
}
}
== partial response ==
facets":{
"count":1310359,
"code_s":{
"buckets":[{
"val":"5W",
"count":255437,
"issuedate_tdt":1.4794452E12},
{
"val":"LS",
"count":201407,
"issuedate_tdt":1.479186E12},
-- the date values seem to come back out as longs converted to
float/double which are then truncated and put into scientific notation? --
== query that barfs with fatal exception ==
json.facet={
code_s:{
limit:-1,
type:terms,
field:code_s,
facet:{
issuedate_tdt:{
type:terms,
field:issuedate_tdt,
sort:{val:desc},
limit:1
}
}
}
}
== barfed response ==
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException"],
"msg":"org.apache.solr.client.solrj.SolrServerException: No live
SolrServers available to handle this
request:[http://solr-0001:8983/solr/newsletters_shard1_replica0,
http://solr-0002:8983/solr/newsletters_shard1_replica1,
http://solr-0003:8983/solr/newsletters_shard2_replica0]",
"trace":"org.apache.solr.common.SolrException:
org.apache.solr.client.solrj.SolrServerException: No live SolrServers
available to handle this
request:[http://solr-0001:8983/solr/newsletters_shard1_replica0,
http://solr-0002:8983/solr/newsletters_shard1_replica1,
http://solr-0003:8983/solr/newsletters_shard2_replica0]\n\tat
...<snip>...
org.apache.solr.client.solrj.impl.LBHttpSolrClient.doRequest(LBHttpSolrClient.java:435)\n\tat
org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:387)\n\t...
9 more\n",
"code":500}
== query with null pointer barfed response ==
json.facet={
code_s:{
limit:-1,
type:terms,
field:code_s,
facet:{
issuedate_tdt:{
type:terms,
field:issuedate_tdt,
sort:{issuedate_tdt:desc},
limit:1
}
}
}
}
== response with NPE ==
"metadata":[
"error-class","org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException",
"root-error-class","org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException"],
"msg":"Error from server at
http://solr-0003:8983/solr/newsletters_shard2_replica0:
java.lang.NullPointerException\n",
"trace":"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:
Error from server at
http://solr-0003:8983/solr/newsletters_shard2_replica0:
java.lang.NullPointerException\n\n\tat
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:593)\n\tat
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:262)\n\tat
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:251)\n\tat
org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1219)\n\tat
org.apache.solr.handler.component.HttpShardHandler.lambda$submit$0(HttpShardHandler.java:195)\n\tat
java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat
java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat
org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)\n\tat
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat
java.lang.Thread.run(Thread.java:745)\n",
"code":500}
Any thoughts on how I can accomplish getting the max date per code where
each code has many dates?