Skip to content

Commit

Permalink
Lower jaro_distance
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjos committed Jun 14, 2024
1 parent 402cec4 commit ec7b253
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/absinthe/utils/suggestion.ex
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit ec7b253

Please sign in to comment.