Oneric
a3840e7d1f
This lets us: - avoid issues with broken hash indices for PostgreSQL <10 - drop runtime checks and legacy codepaths for <11 in db search - always enable custom query plans for performance optimisation PostgreSQL 11 is already EOL since 2023-11-09, so in theory everyone should already have moved on to 12 anyway.
30 lines
909 B
Elixir
30 lines
909 B
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.Search.DatabaseSearchTest do
|
|
alias Pleroma.Search.DatabaseSearch
|
|
alias Pleroma.Web.CommonAPI
|
|
import Pleroma.Factory
|
|
|
|
use Pleroma.DataCase, async: true
|
|
|
|
test "it finds something" do
|
|
user = insert(:user)
|
|
{:ok, post} = CommonAPI.post(user, %{status: "it's wednesday my dudes"})
|
|
|
|
[result] = DatabaseSearch.search(nil, "wednesday")
|
|
|
|
assert result.id == post.id
|
|
end
|
|
|
|
test "using websearch_to_tsquery" do
|
|
user = insert(:user)
|
|
{:ok, _post} = CommonAPI.post(user, %{status: "it's wednesday my dudes"})
|
|
{:ok, other_post} = CommonAPI.post(user, %{status: "it's wednesday my bros"})
|
|
|
|
assert [result] = DatabaseSearch.search(nil, "wednesday -dudes")
|
|
|
|
assert result.id == other_post.id
|
|
end
|
|
end
|