Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST search with no language doesn't return results for all languages #302

Closed
osma opened this issue Sep 21, 2015 · 2 comments
Closed

REST search with no language doesn't return results for all languages #302

osma opened this issue Sep 21, 2015 · 2 comments

Comments

@osma
Copy link
Member

osma commented Sep 21, 2015

At which URL did you encounter the problem?

http://api.finto.fi/rest/v1/yso/search?query=bilar

What steps will reproduce the problem?

  1. Perform REST search on YSO with Swedish label and no lang parameter

What is the expected output? What do you see instead?

Expected to get results, instead (for above URL) getting this:

{
    "@context": {
    "skos": "http://www.w3.org/2004/02/skos/core#",
    "onki": "http://schema.onki.fi/onki#",
    "uri": "@id",
    "type": "@type",
    "results": 
        {
            "@id": "onki:results",
            "@container": "@list"
        },
        "prefLabel": "skos:prefLabel",
        "altLabel": "skos:altLabel",
        "hiddenLabel": "skos:hiddenLabel",
        "broader": "skos:broader",
        "@language": null
    },
    "uri": "",
    "results": [ ]
}

There are two problems here, probably related:

  1. The concept http://www.yso.fi/onto/yso/p1223 is not in the search results, when it should be matched via the Swedish term "bilar".
  2. The "@language": null value in the JSON-LD directive is suspicious and probably not what we want.

I tested this also with Skosmos 1.1, it does return the concept and has no @language directive.

@osma osma self-assigned this Sep 21, 2015
@osma osma added this to the 1.3 milestone Sep 21, 2015
@osma osma removed their assignment Sep 21, 2015
@osma
Copy link
Member Author

osma commented Sep 21, 2015

The problem is related to this line in rest.php:

    $lang = $request->getQueryParam('lang') ? $request->getQueryParam('lang') : $request->getVocab()->getDefaultLanguage();

This doesn't allow not having a lang value as it is forced to the default language if not set.

@osma
Copy link
Member Author

osma commented Sep 21, 2015

The problem is that changing this to allow empty values will affect all REST methods. For some of them (such as search), not setting lang makes sense. For other it doesn't. These have to be decided on a method-by-method basis based on what the earlier code (Skosmos 1.1) did and also what the REST API documentation says.

henriyli pushed a commit that referenced this issue Sep 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant