Skip to content

Commit

Permalink
Update FAST to accept "idroot": ["id"] as well as "idroot": "id" in s…
Browse files Browse the repository at this point in the history
…earch responses
  • Loading branch information
mbklein committed Jun 4, 2024
1 parent 9da7c6b commit e9b0bdb
Show file tree
Hide file tree
Showing 49 changed files with 222 additions and 445 deletions.
2 changes: 2 additions & 0 deletions lib/authoritex/fast/base.ex
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ defmodule Authoritex.FAST.Base do
|> URI.encode()
end

defp uri_id_for_fast_id(base_uri, [fast_id]), do: uri_id_for_fast_id(base_uri, fast_id)

defp uri_id_for_fast_id(base_uri, fast_id) do
add_trailing_slash(base_uri) <> String.replace(fast_id, ~r/(^fst?0*)/, "")
end
Expand Down
4 changes: 2 additions & 2 deletions test/authoritex/fast/event_name_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ defmodule Authoritex.FAST.EventNameTest do
"WHCLIS"
]
],
search_result_term: "Library",
search_count_term: "Library",
search_result_term: "Library and Information",
search_count_term: "Library and Information",
default_results: 20,
explicit_results: 15
end
2 changes: 1 addition & 1 deletion test/authoritex/fast/form_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defmodule Authoritex.FAST.FormTest do
"Museum exhibition catalogs"
]
],
search_result_term: "art",
search_result_term: "art ex",
search_count_term: "art",
default_results: 20,
explicit_results: 15
Expand Down
6 changes: 3 additions & 3 deletions test/authoritex/fast/personal_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ defmodule Authoritex.FAST.PersonalTest do
"Tyui, Melbil, 1851-1931"
]
],
search_result_term: "dewey",
search_count_term: "dewey",
default_results: 20,
search_result_term: "dewey, m",
search_count_term: "dewey, m",
default_results: 17,
explicit_results: 15
end
4 changes: 2 additions & 2 deletions test/fixtures/vcr_cassettes/fast-base_fetch_failure.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
"type": "ok",
"body": "<html><head><title> - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /fast/wrong-id/</h1><HR size=\"1\" noshade=\"noshade\"><p><b>type</b> Status report</p><p><b>message</b> <u>/fast/wrong-id/</u></p><p><b>description</b> <u>The requested resource (/fast/wrong-id/) is not available.</u></p><HR size=\"1\" noshade=\"noshade\"><h3></h3></body></html>",
"headers": {
"Date": "Tue, 04 Jun 2024 19:27:32 GMT",
"Server": "Apache-Coyote/1.1",
"Content-Type": "text/html;charset=utf-8",
"Content-Length": "957",
"Date": "Thu, 02 May 2024 16:28:21 GMT"
"Content-Length": "957"
},
"status_code": 404
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/vcr_cassettes/fast-base_fetch_success.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"headers": {
"Content-Type": "application/xml;charset=UTF-8",
"Content-Length": "3823",
"Date": "Thu, 02 May 2024 16:28:21 GMT"
"Date": "Tue, 04 Jun 2024 19:27:41 GMT"
},
"status_code": 200
}
Expand Down
20 changes: 10 additions & 10 deletions test/fixtures/vcr_cassettes/fast-base_search_count.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"response": {
"binary": false,
"type": "ok",
"body": "{\n \"responseHeader\":{\n \"status\":0,\n \"QTime\":0,\n \"params\":{\n \"q\":\"suggestall:test\",\n \"fl\":\"suggestall,idroot,auth,type\",\n \"rows\":\"20\"}},\n \"response\":{\"numFound\":7222,\"start\":0,\"docs\":[\n {\n \"idroot\":\"fst01423780\",\n \"type\":\"alt\",\n \"auth\":\"Examinations\",\n \"suggestall\":[\n \"Practice tests\"]},\n {\n \"idroot\":\"fst01423780\",\n \"type\":\"alt\",\n \"auth\":\"Examinations\",\n \"suggestall\":[\n \"Test books\"]},\n {\n \"idroot\":\"fst01423780\",\n \"type\":\"alt\",\n \"auth\":\"Examinations\",\n \"suggestall\":[\n \"Tests\"]},\n {\n \"idroot\":\"fst01423888\",\n \"type\":\"alt\",\n \"auth\":\"Study guides\",\n \"suggestall\":[\n \"Test guides\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"auth\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Bible. Old Testament\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Antico Testamento\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Bible. Antico Testamento\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Bible. Stary Testament\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Bible. Velho Testamento\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Old Testament\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Stary Testament\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Velho Testamento\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"auth\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. New Testament\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. Nouveau Testament\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. Novo Testamento\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. Novum Testamentum\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. Nuevo Testamento\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. Nuovo Testamento\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. Nye Testamente\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"New Testament\"]}]\n }}",
"body": "{\"responseHeader\":{\"status\":0,\"QTime\":0,\"params\":{\"q\":\"suggestall:test\",\"fl\":\"suggestall,idroot,auth,type\",\"rows\":\"20\",\"wt\":\"json\"}},\"response\":{\"numFound\":7222,\"start\":0,\"docs\":[{\"idroot\":[\"fst00917492\"],\"type\":\"alt\",\"suggestall\":[\"Tests\"],\"auth\":\"Examinations\"},{\"idroot\":[\"fst01423780\"],\"type\":\"alt\",\"suggestall\":[\"Tests\"],\"auth\":\"Examinations\"},{\"idroot\":[\"fst00908804\"],\"type\":\"alt\",\"suggestall\":[\"EI tests\"],\"auth\":\"Emotional intelligence tests\"},{\"idroot\":[\"fst00908804\"],\"type\":\"alt\",\"suggestall\":[\"EQ tests\"],\"auth\":\"Emotional intelligence tests\"},{\"idroot\":[\"fst01055240\"],\"type\":\"alt\",\"suggestall\":[\"PN test\"],\"auth\":\"Pattenoire test\"},{\"idroot\":[\"fst00797374\"],\"type\":\"alt\",\"suggestall\":[\"ACI test\"],\"auth\":\"Adult-child interaction test\"},{\"idroot\":[\"fst00856536\"],\"type\":\"alt\",\"suggestall\":[\"CSC test\"],\"auth\":\"Children's self-conceptions test\"},{\"idroot\":[\"fst00975867\"],\"type\":\"alt\",\"suggestall\":[\"IQ tests\"],\"auth\":\"Intelligence tests\"},{\"idroot\":[\"fst01076529\"],\"type\":\"alt\",\"suggestall\":[\"PLT Test\"],\"auth\":\"Principles of Learning and Teaching Test\"},{\"idroot\":[\"fst01084938\"],\"type\":\"alt\",\"suggestall\":[\"QRI test\"],\"auth\":\"Qualitative Reading Inventory\"},{\"idroot\":[\"fst01131345\"],\"type\":\"alt\",\"suggestall\":[\"SSW Test\"],\"auth\":\"Staggered Spondaic Word Test\"},{\"idroot\":[\"fst01148240\"],\"type\":\"auth\",\"suggestall\":[\"Testing\"],\"auth\":\"Testing\"},{\"idroot\":[\"fst01148269\"],\"type\":\"auth\",\"suggestall\":[\"Testis\"],\"auth\":\"Testis\"},{\"idroot\":[\"fst01148269\"],\"type\":\"alt\",\"suggestall\":[\"Testes\"],\"auth\":\"Testis\"},{\"idroot\":[\"fst01148292\"],\"type\":\"auth\",\"suggestall\":[\"Testudo\"],\"auth\":\"Testudo\"},{\"idroot\":[\"fst01158423\"],\"type\":\"auth\",\"suggestall\":[\"Tua test\"],\"auth\":\"Tua test\"},{\"idroot\":[\"fst01169447\"],\"type\":\"alt\",\"suggestall\":[\"ISA test\"],\"auth\":\"Wada test\"},{\"idroot\":[\"fst01179673\"],\"type\":\"alt\",\"suggestall\":[\"WJ Test\"],\"auth\":\"Woodcock-Johnson Psycho-Educational Battery\"},{\"idroot\":[\"fst01052280\"],\"type\":\"auth\",\"suggestall\":[\"Pap test\"],\"auth\":\"Pap test\"},{\"idroot\":[\"fst01743793\"],\"type\":\"alt\",\"suggestall\":[\"HGN test\"],\"auth\":\"Horizontal gaze nystagmus test\"}]}}\n",
"headers": {
"Date": "Thu, 02 May 2024 16:28:22 GMT",
"Server": "Apache/2.0.63 (Unix)",
"Server": "Apache-Coyote/1.1",
"Access-Control-Allow-Origin": "*",
"Transfer-Encoding": "chunked",
"Content-Type": "application/json"
"Content-Type": "application/json",
"Content-Length": "2087",
"Date": "Tue, 04 Jun 2024 19:27:32 GMT"
},
"status_code": 200
}
Expand All @@ -38,13 +38,13 @@
"response": {
"binary": false,
"type": "ok",
"body": "{\n \"responseHeader\":{\n \"status\":0,\n \"QTime\":0,\n \"params\":{\n \"q\":\"suggestall:test\",\n \"fl\":\"suggestall,idroot,auth,type\",\n \"rows\":\"15\"}},\n \"response\":{\"numFound\":7222,\"start\":0,\"docs\":[\n {\n \"idroot\":\"fst01423780\",\n \"type\":\"alt\",\n \"auth\":\"Examinations\",\n \"suggestall\":[\n \"Practice tests\"]},\n {\n \"idroot\":\"fst01423780\",\n \"type\":\"alt\",\n \"auth\":\"Examinations\",\n \"suggestall\":[\n \"Test books\"]},\n {\n \"idroot\":\"fst01423780\",\n \"type\":\"alt\",\n \"auth\":\"Examinations\",\n \"suggestall\":[\n \"Tests\"]},\n {\n \"idroot\":\"fst01423888\",\n \"type\":\"alt\",\n \"auth\":\"Study guides\",\n \"suggestall\":[\n \"Test guides\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"auth\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Bible. Old Testament\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Antico Testamento\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Bible. Antico Testamento\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Bible. Stary Testament\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Bible. Velho Testamento\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Old Testament\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Stary Testament\"]},\n {\n \"idroot\":\"fst01808092\",\n \"type\":\"alt\",\n \"auth\":\"Bible. Old Testament\",\n \"suggestall\":[\n \"Velho Testamento\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"auth\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. New Testament\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. Nouveau Testament\"]},\n {\n \"idroot\":\"fst01808090\",\n \"type\":\"alt\",\n \"auth\":\"Bible. New Testament\",\n \"suggestall\":[\n \"Bible. Novo Testamento\"]}]\n }}",
"body": "{\"responseHeader\":{\"status\":0,\"QTime\":1,\"params\":{\"q\":\"suggestall:test\",\"fl\":\"suggestall,idroot,auth,type\",\"rows\":\"15\",\"wt\":\"json\"}},\"response\":{\"numFound\":7222,\"start\":0,\"docs\":[{\"idroot\":[\"fst00917492\"],\"type\":\"alt\",\"suggestall\":[\"Tests\"],\"auth\":\"Examinations\"},{\"idroot\":[\"fst01423780\"],\"type\":\"alt\",\"suggestall\":[\"Tests\"],\"auth\":\"Examinations\"},{\"idroot\":[\"fst00908804\"],\"type\":\"alt\",\"suggestall\":[\"EI tests\"],\"auth\":\"Emotional intelligence tests\"},{\"idroot\":[\"fst00908804\"],\"type\":\"alt\",\"suggestall\":[\"EQ tests\"],\"auth\":\"Emotional intelligence tests\"},{\"idroot\":[\"fst01055240\"],\"type\":\"alt\",\"suggestall\":[\"PN test\"],\"auth\":\"Pattenoire test\"},{\"idroot\":[\"fst00797374\"],\"type\":\"alt\",\"suggestall\":[\"ACI test\"],\"auth\":\"Adult-child interaction test\"},{\"idroot\":[\"fst00856536\"],\"type\":\"alt\",\"suggestall\":[\"CSC test\"],\"auth\":\"Children's self-conceptions test\"},{\"idroot\":[\"fst00975867\"],\"type\":\"alt\",\"suggestall\":[\"IQ tests\"],\"auth\":\"Intelligence tests\"},{\"idroot\":[\"fst01076529\"],\"type\":\"alt\",\"suggestall\":[\"PLT Test\"],\"auth\":\"Principles of Learning and Teaching Test\"},{\"idroot\":[\"fst01084938\"],\"type\":\"alt\",\"suggestall\":[\"QRI test\"],\"auth\":\"Qualitative Reading Inventory\"},{\"idroot\":[\"fst01131345\"],\"type\":\"alt\",\"suggestall\":[\"SSW Test\"],\"auth\":\"Staggered Spondaic Word Test\"},{\"idroot\":[\"fst01148240\"],\"type\":\"auth\",\"suggestall\":[\"Testing\"],\"auth\":\"Testing\"},{\"idroot\":[\"fst01148269\"],\"type\":\"auth\",\"suggestall\":[\"Testis\"],\"auth\":\"Testis\"},{\"idroot\":[\"fst01148269\"],\"type\":\"alt\",\"suggestall\":[\"Testes\"],\"auth\":\"Testis\"},{\"idroot\":[\"fst01148292\"],\"type\":\"auth\",\"suggestall\":[\"Testudo\"],\"auth\":\"Testudo\"}]}}\n",
"headers": {
"Date": "Thu, 02 May 2024 16:28:22 GMT",
"Server": "Apache/2.0.63 (Unix)",
"Server": "Apache-Coyote/1.1",
"Access-Control-Allow-Origin": "*",
"Transfer-Encoding": "chunked",
"Content-Type": "application/json"
"Content-Type": "application/json",
"Content-Length": "1608",
"Date": "Tue, 04 Jun 2024 19:27:33 GMT"
},
"status_code": 200
}
Expand Down
Loading

0 comments on commit e9b0bdb

Please sign in to comment.