wheresrhys / keen-query

Terse, cypher-esque querying for keen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Idea: Generate filter timestamp values in real time

adambraimbridge opened this issue · comments

Example:

How many article pages have been viewed that were last published in the last 24 hours?

page:view
  ->count(content.uuid)
  ->filter(content.lastPublishDate>2017-01-11T14:30:00.000+00:00)

^ That query will return a count of articles viewed, published since 14:30 yesterday (which is 24 hours ago at time of writing)

What we need is something like this:

  ->filter(content.lastPublishDate<last_24_hours) 

^ whereby the last_24_hours assumes the same syntax as relTime().

I guess it could be added here: https://github.com/Financial-Times/keen-query/blob/master/lib/keen-query/filters.js#L5