samvera / questioning_authority

Question your authorities
Other
54 stars 30 forks source link

OCLC_FAST linked data connection times out #327

Closed elrayle closed 3 years ago

elrayle commented 3 years ago

Description

Searching OCLC_FAST through the linked data module times out.

Expected behavior

Searching OCLC_FAST should return data.

Actual behavior

Searching OCLC_FAST times out.

Steps to reproduce

In rails console...

replacements = {"maximumRecords"=>"2"}
lda = Qa::Authorities::LinkedData::GenericAuthority.new(:OCLC_FAST)
ld_results = lda.search("Cornell University", replacements: replacements)

Produces error...

QA Linked Data search url: http://experimental.worldcat.org/fast/search?query=cql.any+all+%22Cornell University%22&sortKeys=usage&maximumRecords=2
Traceback (most recent call last):
        1: from (irb):3
Errno::ETIMEDOUT (Operation timed out)
elrayle commented 3 years ago

The generated URL does not have the query encoded.

Actual URL...

http://experimental.worldcat.org/fast/search?query=cql.any+all+%22Cornell University%22&sortKeys=usage&maximumRecords=2

This URL fails with CURL with the same error.

Expected URL...

http://experimental.worldcat.org/fast/search?query=cql.any+all+%22Cornell%20University%22&sortKeys=usage&maximumRecords=2

NOTE: The only difference is that the query Cornell University is encoded to be Cornell%20University

This encoded URL works with CURL.

This used to work without encoding, but it is an easy fix to add encoding.