Posts

<%= form_for :posts, ~p"/posts", [method: "get", class: "hform", enforce_utf8: false], fn f -> %>
<%= text_input(f, :pq, name: :pq, value: @conn.params["pq"], class: "input hform__text", placeholder: "Search posts", 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?(@posts) -> %> <% route = fn p -> ~p"/posts?#{p}" end %> <% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, params: [pq: @conn.params["pq"]], conn: @conn) %> <%= for {body, post} <- @posts, post.topic.hidden_from_users == false do %>

<%= link(post.topic.forum.name, to: ~p"/forums/#{post.topic.forum}") %> » <%= link(post.topic.title, to: ~p"/forums/#{post.topic.forum}/topics/#{post.topic}") %> » <% post_link = ~p"/forums/#{post.topic.forum}/topics/#{post.topic}?#{[post_id: post.id]}" <> "#post_#{post.id}" %> <%= if post.topic_position == 0 do %> <%= link("Topic Opener", to: post_link) %> <% else %> <%= link("Post #{post.topic_position}", to: post_link) %> <% end %>

<%= render(PhilomenaWeb.PostView, "_post.html", body: body, post: post, conn: @conn) %>
<% end %>
<% assigns[:error] -> %>

Oops, there was an error evaluating your query:

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

No posts found!

<% end %>

Default search

If you do not specify a field to search over, the search engine will search for posts with a body that is similar to the query's word stems. For example, posts 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 post. Anonymous authors will never match this term. <%= link("author:Joey", to: ~p"/posts?#{[pq: "author:Joey"]}") %>
body Full Text Matches the body of this post. This is the default field. <%= link("body:test", to: ~p"/posts?#{[pq: "body:test"]}") %>
created_at Date/Time Range Matches the creation time of this post. <%= link("created_at:2015", to: ~p"/posts?#{[pq: "created_at:2015"]}") %>
id Numeric Range Matches the numeric surrogate key for this post. <%= link("id:1000000", to: ~p"/posts?#{[pq: "id:1000000"]}") %>
my Meta my:posts matches posts you have posted if you are signed in. <%= link("my:posts", to: ~p"/posts?#{[pq: "my:posts"]}") %>
subject Full Text Matches the title of the topic. <%= link("subject:time wasting thread", to: ~p"/posts?#{[pq: "subject:time wasting thread"]}") %>
topic_id Literal Matches the numeric surrogate key for the topic this post belongs to. <%= link("topic_id:7000", to: ~p"/posts?#{[pq: "topic_id:7000"]}") %>
topic_position Numeric Range Matches the offset from the beginning of the topic of this post. Positions begin at 0. <%= link("topic_position:0", to: ~p"/posts?#{[pq: "topic_position:0"]}") %>
updated_at Date/Time Range Matches the creation or last edit time of this post. <%= link("updated_at.gte:2 weeks ago", to: ~p"/posts?#{[pq: "updated_at.gte:2 weeks ago"]}") %>
user_id Literal Matches posts with the specified user_id. Anonymous users will never match this term. <%= link("user_id:211190", to: ~p"/posts?#{[pq: "user_id:211190"]}") %>
forum Literal Matches the short name for the forum this post belongs to. <%= link("forum:meta", to: ~p"/posts?#{[pq: "forum:meta"]}") %>