cofacts / rumors-api

GraphQL API server for clients like rumors-site and rumors-line-bot
https://api.cofacts.tw
MIT License
111 stars 26 forks source link

Provide date range filter for ListArticles and ListReplies #148

Closed MrOrz closed 4 years ago

MrOrz commented 4 years ago

From 20200212 meeting note, it would be great if we can provide date range search on createdAt for articles and replies, lastRequestedAt or having article reply createdAt for articles.

To achieve this, we plan to:

  1. Replace current existing script queries with range queries so that the operators can compatible with date type
  2. Simulate current EQ operator with gte + lte operator so that it is compatible with range queries.
MrOrz commented 4 years ago

最近 elasticsearch 的 docker container 有一些 warning 如下: https://gist.github.com/MrOrz/d60b1fb33a89f240afa4147538c2688e 看起來下 /articles/doc/_count request 時, doc['replyRequestCount'].value > params.operand 這個條件偶爾會觸發 runtime error,每小時會觸發個幾次的樣子。

希望 range operator 改下去之後可以讓這個 warning 消失

MrOrz commented 4 years ago

Partially fixed in #154 ; we can move other arithmetic operators like lastRequestedAt to range filters as well.