samvera / questioning_authority

Question your authorities
Other
54 stars 30 forks source link

LOC bug when using "--" #61

Open scande3 opened 10 years ago

scande3 commented 10 years ago

Setup / Expected

The documentation gives the following example:

/qa/search/loc/subjects?q=History--

QA then presents this data to you in JSON format:

[
    {"id":"info:lc/authorities/subjects/sh2008121753","label":"History--Philosophy--History--20th century"},
    {"id":"info:lc/authorities/subjects/sh2008121752","label":"History--Philosophy--History--19th century"},
    etc...
]

Actual

The data actually returned is more like the following

[
    {"id":"info:lc/authorities/subjects/sh85111862","label":"Reconstruction (U.S. history, 1865-1877)"},
    {"id":"info:lc/authorities/subjects/sh85061255","label":"History publishing"},
    etc...
    {"id":"info:lc/authorities/subjects/sh85068444","label":"Islamic Empire"},
]

The Issue

A "--" does not seem to be processed correctly. For example, searching for "History Philosophy" will return results more like the first example. As is, about half of the results currently do not contain the word "history" nor any "--". I have no yet done appropriate research into details of this behavior besides noticing it during recent testing.

scande3 commented 10 years ago

Related unit test that doesn't work:

it "should be retrieved via search" do
  @authority.search("History--", "subjects")
  @authority.results.first["label"].should == "History--Philosophy--History--20th century"
end
awead commented 10 years ago

The problem seems to lie with LOC itself. This returns the same result http://id.loc.gov/search/?q=History--&q= However, if you add a wildcard to the query it works: History--* We could automatically append the wildcard to all searches.

scande3 commented 10 years ago

We automatically appended the wildcard in the past but that seemed to cause other issues. See the discussion over the removal of the wildcard in pull request #49 . Possibly need some logic to only append it in certain cases? Or make it a setting of some sort?

awead commented 10 years ago

Ah, thanks for pointing that out... completely forgot about it. I guess I'd lean towards an option to pass via the url or something, as it will vary per authority.

miledrousset commented 5 years ago

Hi, I saw in the documentation this uri : qa/search/getty/aat?q=amphora do you have the full URL to get this result : {"id":"http://vocab.getty.edu/aat/300198849","label":"Nolan amphorae"}, {"id":"http://vocab.getty.edu/aat/300200366","label":"Panathenaic amphorae"} I try with : http://vocab.getty.edu/qa/search/getty/aat?q=amphora or https://vocab.getty.edu/qa/search/getty/aat?q=amphora but, no result ! Can you help me please ? thank you