From ec7b25378e209fa85fd57d44b483a99042e6b910 Mon Sep 17 00:00:00 2001 From: Bryan Joseph Date: Fri, 14 Jun 2024 08:52:14 -0500 Subject: [PATCH] Lower jaro_distance --- .github/workflows/elixir.yml | 6 +++--- lib/absinthe/utils/suggestion.ex | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index b31f733305..ff36fb7b2c 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -9,7 +9,7 @@ on: jobs: test: name: Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 strategy: matrix: @@ -59,12 +59,12 @@ jobs: - name: Run unit tests run: | mix clean - mix test test/absinthe/phase/document/validation/fields_on_correct_type_test.exs:110 + mix test - name: Run unit tests with persistent_term backend run: | mix clean - mix test test/absinthe/phase/document/validation/fields_on_correct_type_test.exs:110 + mix test env: SCHEMA_PROVIDER: persistent_term diff --git a/lib/absinthe/utils/suggestion.ex b/lib/absinthe/utils/suggestion.ex index eb92049f29..c8102d5359 100644 --- a/lib/absinthe/utils/suggestion.ex +++ b/lib/absinthe/utils/suggestion.ex @@ -1,5 +1,5 @@ defmodule Absinthe.Utils.Suggestion do - @jaro_threshold 0.70 + @jaro_threshold 0.60 @doc """ Sort a list of suggestions by Jaro distance to a target string, @@ -9,7 +9,7 @@ defmodule Absinthe.Utils.Suggestion do def sort_list(suggestions, target, threshold \\ @jaro_threshold) def sort_list(suggestions, target, threshold) do - Enum.map(suggestions, fn s -> IO.inspect({s, String.jaro_distance(s, target)}) end) + Enum.map(suggestions, fn s -> {s, String.jaro_distance(s, target)} end) |> Enum.filter(fn {_, x} -> x >= threshold end) |> Enum.sort_by(fn {_, x} -> x end) |> Enum.map(fn {s, _} -> s end)