![]() |
||
NAGRYWARKI | PROGRAMY | TESTY | DYSKI TWARDE/SSD | BIOSY | ARTYKUŁY | FAQ | NAGRYWANIE od A do Z | ENCYKLOPEDIA | FORUM | Nośniki | Konsole | Zabezpieczenia płyt | Zaloguj |
setup do %Post{} |> Post.changeset(% title: "Elixir Full-Text Search", content: "This article explains how to implement full-text search" ) |> Repo.insert!()
render(conn, "index.html", query: query, results: results, total_count: length(results) ) end uni ecto plugin
:noreply, assign(socket, search_term: query, results: results, searching: query != "" ) end setup do %Post{} |> Post
base_query |> apply_filters(params) |> apply_full_text_search(params) |> rank_by_relevance(params[:search_term]) end setup do %Post{} |>
def changeset(post, attrs) do post |> Ecto.Changeset.cast(attrs, [:title, :content, :tags]) |> update_search_vector() end
def index(conn, %"q" => query) do results = Blog.search_posts(query, category: conn.params["category"])
json(conn, %suggestions: suggestions) end end # lib/my_app_web/live/search_live.ex defmodule MyAppWeb.SearchLive do use MyAppWeb, :live_view alias MyApp.Blog