Comments

<%= form_for :comments, ~p"/comments", [method: "get", class: "hform", enforce_utf8: false], fn f -> %>
<%= text_input(f, :cq, name: :cq, value: @conn.params["cq"], class: "input hform__text", placeholder: "Search comments", autocapitalize: "none") %> <%= submit("Search", class: "hform__button button") %>
For more information, see the search syntax documentation . Search results are sorted by creation date.
<% end %>

Search Results

<%= cond do %> <% Enum.any?(@comments) -> %> <% route = fn p -> ~p"/comments?#{p}" end %> <% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @comments, route: route, params: [cq: @conn.params["cq"]], conn: @conn) %> <%= for {body, comment} <- @comments, comment.image.hidden_from_users == false do %> <%= render(PhilomenaWeb.CommentView, "_comment_with_image.html", body: body, comment: comment, conn: @conn) %> <% end %>
<% assigns[:error] -> %>

Oops, there was an error evaluating your query:

      <%= assigns[:error] %>
    
<% true -> %>

No comments found!

<% end %>

Default search

If you do not specify a field to search over, the search engine will search for comments with a body that is similar to the query's word stems . For example, comments containing the words winged humanization , wings , and spread wings would all be found by a search for wing , but sewing would not be.

Allowed fields

Field Selector Type Description Example
author Literal Matches the author of this comment. Anonymous authors will never match this term. <%= link("author:Joey", to: ~p"/comments?#{[cq: "author:Joey"]}") %>
body Full Text Matches the body of this comment. This is the default field. <%= link("body:test", to: ~p"/comments?#{[cq: "body:test"]}") %>
created_at Date/Time Range Matches the creation time of this comment. <%= link("created_at:2015", to: ~p"/comments?#{[cq: "created_at:2015"]}") %>
id Numeric Range Matches the numeric surrogate key for this comment. <%= link("id:1000000", to: ~p"/comments?#{[cq: "id:1000000"]}") %>
image_id Literal Matches the numeric surrogate key for the image this comment belongs to. <%= link("image_id:1000000", to: ~p"/comments?#{[cq: "image_id:1000000"]}") %>
my Meta my:comments matches comments you have posted if you are signed in. <%= link("my:comments", to: ~p"/comments?#{[cq: "my:comments"]}") %>
user_id Literal Matches comments with the specified user_id. Anonymous users will never match this term. <%= link("user_id:211190", to: ~p"/comments?#{[cq: "user_id:211190"]}") %>