Created 09-12-2016 05:16 PM
Hi,
Let's say I only have 2 fields in a document: "animal" and "born_date"
A few examples of document:
{animal:"cat", born_date:"1/1/2015" },{animal:"dog", born_date:"1/1/2015" },{animal:"snake", born_date:"1/3/2015" },...........
Is it possible to write a facet query to generate the following result?
{ "cat": [ "1/1/2015", 123, "1/2/2015",423, "1/3/2015",32, .... "12/31/2015",32], "dog": [ "1/1/2015", 23, "1/2/2015",43, "1/3/2015",88, .... "12/31/2015",4], "snake": [ "1/1/2015", 23, "1/2/2015",67, "1/3/2015",2, .... "12/31/2015",6] }
-Wing
Created 09-12-2016 06:36 PM
What do you want to do with the results?
Are you going to summarize the results?
let me know if this is what you where looking for.
Created 09-12-2016 06:36 PM
What do you want to do with the results?
Are you going to summarize the results?
let me know if this is what you where looking for.
Created 09-13-2016 02:55 PM
Thanks for the suggestions and I'll look them up. Basically I want to visualize the data on a line chart. Each line represent one type of animal and I don't know how many types of animal in the solr collection.
Can I use facet range with group? then I can show the count on each day within the group?
Created 09-13-2016 06:22 PM
From what you have told me sounds like you should use a facet pivot and specifically checkout "Combining Facet Queries And Facet Ranges With Pivot Facets" it has an example that fits right into what you want to do.
Created 09-13-2016 09:21 PM
The facet pivot is exactly what I need! Thank you so much, Matt!
Created 09-13-2016 09:37 PM
Hi @Wing Lo If facet pivot is exactly what you need how about accepting and upvoting Matt's answer? Thanks!