• Bike Trials Bike Trials

    Rating Views 15K

    This game is another masterpiece of talented creators. A bright combination of realistic design ...

    Play now
  • Moto X3M 4 Winter Moto X3M 4 Winter

    Rating Views 43K

    What can be better than a Christmas Eve with a hot tea and gift boxes all around the house?...

    Play now
  • Moto X3M Spooky Land Moto X3M Spooky Land

    Rating Views 48K

    Witches, pumpkins, darkness, gravestones in the cemetery - this is the atmosphere of the eve ...

    Play now
  • Motor Ninja Motor Ninja

    Rating Views 17K

    If you enjoy smooth animation, beautiful game backgrounds and creative graphics, this extreme ...

    Play now
  • Offroad Offroad

    Rating Views 14K

    Are you ready to try a crazy offroad race for real masters? Prepare for some great extreme ...

    Play now

Uni Ecto Plugin _best_ Page

defp rank_by_relevance(query, nil), do: query defp rank_by_relevance(query, term) when term == "", do: query defp rank_by_relevance(query, term) do from q in query, select_merge: %, order_by: [desc: fragment("relevance")] end end # lib/my_app/blog/blog.ex defmodule MyApp.Blog do import Ecto.Query alias MyApp.Repo alias MyApp.Blog.Post def search_posts(search_term, filters \ []) do Post |> search(search_term) # From plugin |> apply_filters(filters) |> order_by_relevance(search_term) |> Repo.all() end

def render(assigns) do ~H""" <div> <form phx-submit="search" phx-change="search"> <input type="text" name="query" value=@search_term placeholder="Search posts..." class="w-full p-2 border rounded" /> <button type="submit">Search</button> </form> uni ecto plugin

defp apply_filters(query, %category: category) do from q in query, where: q.category == ^category end defp apply_filters(query, _), do: query do: query defp rank_by_relevance(query

base_query |> apply_filters(params) |> apply_full_text_search(params) |> rank_by_relevance(params[:search_term]) end term) when term == ""