0

I am using Solr 6. I have a stream of data (date ranges) with for a specific id. I want to see only the gaps (dates) in them. Example: Here's is what I have

{"start":"2016-04-20",
"end":"2016-04-21",      
"file_id":"538b3274"},
{
"start":"2016-04-24",
"end":"2016-04-25",
"file_id":"538b3274"},
{
"start":"2016-04-25",      
"end":"2016-04-26",
"file_id":"538b3274"},
{
"start":"2016-04-29",       
"end":"2016-04-30",
}

Here's something I would like to see. Example:

{
missing: [2016-04-22 TO 2016-04-25]         
"file_id":"538b3274"},
{
missing: [2016-04-27 TO 2016-04-28]       
"file_id":"538b3274"},    
}

Response can also be one entry with multiple dates

<pre>{
missing: [2016-04-22 TO 2016-04-23], [2016-04-27 TO 2016-04-28]       
"file_id":"538b3274"},    
}</pre>

1 Answers1

1

you are not going to get this functionality out of Solr. I see several options:

  1. just do this on the client side. Probably the easiest and simplest.

  2. you could write a custom QueryResponseWriter that returns the docs in the way you need. But, I am not sure if this is possible, as you don't want to format your docs differently, you need to create new docs out of the ones Solr returned. You would have to try.

  3. also you could try Streaming Expressions, you could plug in your custom java code there too.

    But I see 2 and 3 as much, much more work than 1.

Community
  • 1
  • 1
Persimmonium
  • 15,593
  • 11
  • 47
  • 78