Skip to content

Commit

Permalink
Merge pull request #294 from pulibrary/270-dash
Browse files Browse the repository at this point in the history
Remove trailing dashes from title slugs
  • Loading branch information
tpendragon authored Jan 13, 2025
2 parents cd05d36 + 15b46d1 commit 6251a4b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions solr/conf/slug.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions test/dpul_collections/solr_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ defmodule DpulCollections.SolrTest do
"él-no-responde-mis-mensajes"
end

test "slug generation when the slug is truncated with a trailing dash" do
doc = %{
"id" => "3cb7627b-defc-401b-9959-42ebc4488f74",
"title_txtm" => ["¿Cómo la reforma educacional beneficia a mi familia?"]
}

Solr.add([doc], active_collection())
Solr.commit(active_collection())

assert Solr.find_by_id("3cb7627b-defc-401b-9959-42ebc4488f74")["slug_s"] ==
"cómo-reforma-educacional-beneficia"
end

test "an exception is logged when indexing a document raises a solr error" do
doc = %{
# No title
Expand Down

0 comments on commit 6251a4b

Please sign in to comment.