Skip to content

Instantly share code, notes, and snippets.

@sparkertime
sparkertime / ecto_postgres_fulltext_search_querying_example.ex
Created November 22, 2021 22:21 — forked from renesugar/ecto_postgres_fulltext_search_querying_example.ex
How to set up postgres fulltext search triggers, index, and tsvector column on Elixir/Phoenix, with Ecto querying, including ranking and sorting by rank
defmodule YourAppName.Search do
# ...
@doc """
Queries listings.
"""
def query_listings(query, current_user) do
default_scope = from l in Listing, where: l.draft == false or l.user_id == ^current_user.id, order_by: [desc: l.updated_at], limit: 50
id = _try_integer(query)
@sparkertime
sparkertime / convert.sh
Last active April 19, 2022 16:32
Supplementary files for converting Pivotal to JIRA
sed -i -e "s/######/h6./" $1
sed -i -e "s/#####/h5./" $1
sed -i -e "s/####/h4./" $1
sed -i -e "s/###/h3./" $1
sed -i -e "s/##/h2./" $1