diff --git a/lib/philomena/comments/query.ex b/lib/philomena/comments/query.ex index dc282072..4f581d47 100644 --- a/lib/philomena/comments/query.ex +++ b/lib/philomena/comments/query.ex @@ -5,7 +5,7 @@ defmodule Philomena.Comments.Query do case Integer.parse(data) do {int, _rest} -> { - :ok, + :ok, %{ bool: %{ must: [ @@ -23,7 +23,7 @@ defmodule Philomena.Comments.Query do def author_transform(_ctx, data) do { - :ok, + :ok, %{ bool: %{ must: [ diff --git a/lib/philomena_web/controllers/comment_controller.ex b/lib/philomena_web/controllers/comment_controller.ex index 1fa7f29c..38f8d7e8 100644 --- a/lib/philomena_web/controllers/comment_controller.ex +++ b/lib/philomena_web/controllers/comment_controller.ex @@ -5,7 +5,7 @@ defmodule PhilomenaWeb.CommentController do import Ecto.Query def index(conn, params) do - cq = params["cq"] || "created_at.gt:1 week ago" + cq = params["cq"] || "created_at.gte:1 week ago" {:ok, query} = Query.compile(conn.assigns.current_user, cq) diff --git a/lib/philomena_web/templates/comment/index.html.slime b/lib/philomena_web/templates/comment/index.html.slime index f12e3503..111a4726 100644 --- a/lib/philomena_web/templates/comment/index.html.slime +++ b/lib/philomena_web/templates/comment/index.html.slime @@ -2,7 +2,7 @@ h1 Comments = form_for :comments, Routes.comment_path(@conn, :index), [method: "get", class: "hform", enforce_utf8: false], fn f -> .field - = text_input f, :cq, name: :cq, value: @conn.params["cq"] || "created_at.gt:1 week ago", class: "input hform__text", placeholder: "Search comments", autocapitalize: "none" + = text_input f, :cq, name: :cq, value: @conn.params["cq"] || "created_at.gte:1 week ago", class: "input hform__text", placeholder: "Search comments", autocapitalize: "none" = submit "Search", class: "hform__button button", data: [disable_with: false] .fieldlabel diff --git a/lib/search/date_parser.ex b/lib/search/date_parser.ex index 6a54772c..580a7d2d 100644 --- a/lib/search/date_parser.ex +++ b/lib/search/date_parser.ex @@ -91,10 +91,10 @@ defmodule Search.DateParser do end defp relative_datetime([count, scale]) do - now = NaiveDateTime.utc_now() + now = DateTime.utc_now() - lower = NaiveDateTime.add(now, count * -scale, :second) - upper = NaiveDateTime.add(now, (count - 1) * -scale, :second) + lower = DateTime.add(now, count * -scale, :second) + upper = DateTime.add(now, (count - 1) * -scale, :second) [lower, upper] end