2019-12-01 02:44:57 +01:00
|
|
|
h1 Posts
|
2019-11-17 23:14:20 +01:00
|
|
|
|
2019-12-01 02:44:57 +01:00
|
|
|
= form_for :posts, Routes.post_path(@conn, :index), [method: "get", class: "hform", enforce_utf8: false], fn f ->
|
|
|
|
.field
|
2019-12-02 15:37:01 +01:00
|
|
|
= text_input f, :pq, name: :pq, value: @conn.params["pq"], class: "input hform__text", placeholder: "Search posts", autocapitalize: "none"
|
2019-12-08 15:43:47 +01:00
|
|
|
= submit "Search", class: "hform__button button"
|
2019-11-17 23:14:20 +01:00
|
|
|
|
2019-12-01 02:44:57 +01:00
|
|
|
.fieldlabel
|
|
|
|
' For more information, see the
|
|
|
|
a href="/pages/search_syntax" search syntax documentation
|
|
|
|
' . Search results are sorted by creation date.
|
2019-11-17 23:14:20 +01:00
|
|
|
|
2019-12-01 02:44:57 +01:00
|
|
|
h2 Search Results
|
2019-11-17 23:14:20 +01:00
|
|
|
|
2019-12-01 02:44:57 +01:00
|
|
|
= cond do
|
|
|
|
- Enum.any?(@posts) ->
|
|
|
|
- route = fn p -> Routes.post_path(@conn, :index, p) end
|
2019-12-08 06:12:23 +01:00
|
|
|
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, params: [pq: @conn.params["pq"]], conn: @conn
|
2019-11-17 23:14:20 +01:00
|
|
|
|
2019-12-01 02:44:57 +01:00
|
|
|
= for {body, post} <- @posts, post.topic.hidden_from_users == false do
|
2021-05-09 19:21:45 +02:00
|
|
|
div
|
|
|
|
h3
|
|
|
|
=<> link post.topic.forum.name, to: Routes.forum_path(@conn, :show, post.topic.forum)
|
|
|
|
| »
|
|
|
|
=<> link post.topic.title, to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic)
|
|
|
|
| »
|
|
|
|
- post_link = Routes.forum_topic_path(@conn, :show, post.topic.forum, 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
|
|
|
|
= render PhilomenaWeb.PostView, "_post.html", body: body, post: post, conn: @conn
|
2019-11-17 23:14:20 +01:00
|
|
|
|
|
|
|
.block
|
2020-12-11 17:53:40 +01:00
|
|
|
.block__header.block__header--light.page__header
|
|
|
|
.page__pagination = pagination
|
|
|
|
.page__info
|
|
|
|
span.block__header__title
|
|
|
|
= render PhilomenaWeb.PaginationView, "_pagination_info.html", page: @posts, conn: @conn
|
2019-12-01 02:44:57 +01:00
|
|
|
|
|
|
|
- assigns[:error] ->
|
|
|
|
p
|
|
|
|
' Oops, there was an error evaluating your query:
|
|
|
|
pre = assigns[:error]
|
|
|
|
|
|
|
|
- true ->
|
|
|
|
p
|
|
|
|
' No posts found!
|
|
|
|
|
|
|
|
h3 Default search
|
|
|
|
p
|
|
|
|
' 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
|
|
|
|
em word stems
|
|
|
|
' . For example, posts containing the words
|
|
|
|
code winged humanization
|
|
|
|
' ,
|
|
|
|
code wings
|
|
|
|
' , and
|
|
|
|
code> spread wings
|
|
|
|
' would all be found by a search for
|
|
|
|
code wing
|
|
|
|
' , but
|
|
|
|
code> sewing
|
|
|
|
' would not be.
|
2019-11-17 23:14:20 +01:00
|
|
|
|
2019-12-01 02:44:57 +01:00
|
|
|
h3 Allowed fields
|
|
|
|
table.table
|
|
|
|
thead
|
|
|
|
tr
|
|
|
|
th Field Selector
|
|
|
|
th Type
|
|
|
|
th Description
|
|
|
|
th Example
|
|
|
|
tbody
|
|
|
|
tr
|
|
|
|
td
|
|
|
|
code author
|
|
|
|
td Literal
|
|
|
|
td Matches the author of this post. Anonymous authors will never match this term.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "author:Joey", to: Routes.post_path(@conn, :index, pq: "author:Joey")
|
2019-12-01 02:44:57 +01:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code body
|
|
|
|
td Full Text
|
|
|
|
td Matches the body of this post. This is the default field.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "body:test", to: Routes.post_path(@conn, :index, pq: "body:test")
|
2019-12-01 02:44:57 +01:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code created_at
|
|
|
|
td Date/Time Range
|
|
|
|
td Matches the creation time of this post.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "created_at:2015", to: Routes.post_path(@conn, :index, pq: "created_at:2015")
|
2019-12-01 02:44:57 +01:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code id
|
|
|
|
td Numeric Range
|
|
|
|
td Matches the numeric surrogate key for this post.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "id:1000000", to: Routes.post_path(@conn, :index, pq: "id:1000000")
|
2019-12-01 02:44:57 +01:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code my
|
|
|
|
td Meta
|
|
|
|
td
|
|
|
|
code> my:posts
|
|
|
|
' matches posts you have posted if you are signed in.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "my:posts", to: Routes.post_path(@conn, :index, pq: "my:posts")
|
2019-12-01 02:44:57 +01:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code subject
|
|
|
|
td Full Text
|
|
|
|
td Matches the title of the topic.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "subject:time wasting thread", to: Routes.post_path(@conn, :index, pq: "subject:time wasting thread")
|
2019-12-01 02:44:57 +01:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code topic_id
|
|
|
|
td Literal
|
|
|
|
td Matches the numeric surrogate key for the topic this post belongs to.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "topic_id:7000", to: Routes.post_path(@conn, :index, pq: "topic_id:7000")
|
|
|
|
tr
|
|
|
|
td
|
|
|
|
code topic_position
|
|
|
|
td Numeric Range
|
|
|
|
td Matches the offset from the beginning of the topic of this post. Positions begin at 0.
|
|
|
|
td
|
|
|
|
code = link "topic_position:0", to: Routes.post_path(@conn, :index, pq: "topic_position:0")
|
2019-12-01 02:44:57 +01:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code updated_at
|
|
|
|
td Date/Time Range
|
|
|
|
td Matches the creation or last edit time of this post.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "updated_at.gte:2 weeks ago", to: Routes.post_path(@conn, :index, pq: "updated_at.gte:2 weeks ago")
|
2019-12-01 02:44:57 +01:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code user_id
|
|
|
|
td Literal
|
|
|
|
td Matches posts with the specified user_id. Anonymous users will never match this term.
|
|
|
|
td
|
2020-01-22 14:51:27 +01:00
|
|
|
code = link "user_id:211190", to: Routes.post_path(@conn, :index, pq: "user_id:211190")
|
2021-05-09 19:21:45 +02:00
|
|
|
tr
|
|
|
|
td
|
|
|
|
code forum
|
|
|
|
td Literal
|
|
|
|
td Matches the short name for the forum this post belongs to.
|
|
|
|
td
|
|
|
|
code = link "forum:meta", to: Routes.post_path(@conn, :index, pq: "forum:meta")
|