- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Solr query question
- Labels:
-
Apache Solr
Created ‎09-12-2016 05:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What do you want to do with the results?
Are you going to summarize the results?
- You may want to look at pivoting a facet for summarizing the result.
- If you just want to group them. Don't forget to set a limit so a reasonable result is returned.
let me know if this is what you where looking for.
Created ‎09-12-2016 06:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What do you want to do with the results?
Are you going to summarize the results?
- You may want to look at pivoting a facet for summarizing the result.
- If you just want to group them. Don't forget to set a limit so a reasonable result is returned.
let me know if this is what you where looking for.
Created ‎09-13-2016 02:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The facet pivot is exactly what I need! Thank you so much, Matt!
Created ‎09-13-2016 09:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Wing Lo If facet pivot is exactly what you need how about accepting and upvoting Matt's answer? Thanks!
