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

Unique flag not working? #429

Closed
danmichaelo opened this issue Jan 11, 2016 · 9 comments
Closed

Unique flag not working? #429

danmichaelo opened this issue Jan 11, 2016 · 9 comments
Assignees
Labels
Milestone

Comments

@danmichaelo
Copy link
Contributor

I would expect one result here, but get three: https://skosmos.biblionaut.net/rest/v1/search?query=nanomedi*&unique=true

(Btw. my Skosmos installation is at @2947b94c434)

@henriyli henriyli added the bug label Jan 11, 2016
@henriyli henriyli added this to the 1.5 milestone Jan 11, 2016
@osma
Copy link
Member

osma commented Jan 11, 2016

The problem is that there are no hints in the REST query about which language to prefer. All three languages end up having the same priority. If you add a labellang parameter you will get just one result:

https://skosmos.biblionaut.net/rest/v1/search?query=nanomedi*&labellang=nb&unique=true

Note that the labellang parameter doesn't restrict the matching to that language. This also gives essentially the same result even if it matches only the English label:

https://skosmos.biblionaut.net/rest/v1/search?query=nanomedic*&labellang=nb&unique=true

Not sure if this is a bug or a feature, at least it should be documented somewhere.

@osma osma self-assigned this Jan 11, 2016
@danmichaelo
Copy link
Contributor Author

Aha, mainly a documentation issue then. The behaviour is acceptable once you understand it, but it's not straightforward intuitive :)

@osma
Copy link
Member

osma commented Jan 14, 2016

It surprised me too! I think this might still be a bug, but I haven't yet investigated in detail why this happens.

@osma
Copy link
Member

osma commented Jan 14, 2016

Even if the REST query doesn't specify any language, we could fall back to the default language of the vocabulary, as is done for other REST methods.

@danmichaelo
Copy link
Contributor Author

Seems like a good idea. Even if documented, the current behaviour could still be confusing in the standard UI:

skjermbilde 2016-01-15 kl 12 24 02

@osma
Copy link
Member

osma commented Jan 15, 2016

The REST call made by the UI doesn't set the unique flag at all, so it is not directly affected by this issue.

This is done deliberately, in order to not hide matches from the user. For example, if the query in your screenshot only showed a match for "Nanomedisin"@nb, the user might erroneously conclude that "Nanomedicine”@en and "Nanomedisin"@nn are not in the vocabulary. We've had situations like this before and have decided to opt for showing all the matches, even though there are duplicates.

@osma
Copy link
Member

osma commented Jan 18, 2016

This actually doesn't affect the current development version anymore, probably as a side effect of the refactoring done in #393.

finto.fi is running v1.4-maintenance and shows the problem:
http://finto.fi/rest/v1/yso/search?query=ufolog*&unique=true

dev.finto.fi is running current master and doesn't have the problem:
http://dev.finto.fi/rest/v1/yso/search?query=ufolog*&unique=true

Unfortunately the refactoring in #393 is extensive, it cannot be backported to v1.4. If this is a real problem for current 1.4 usage then we can consider making a quick fix (probably just identifying the situation where unique=true but no search language is given, and setting the label language to the default language of the vocabulary).

@danmichaelo
Copy link
Contributor Author

Cool, I'll pull in the latest version then.

@osma
Copy link
Member

osma commented Jan 19, 2016

I've verified that the language now always defaults to the vocabulary default language, so this problem should be fixed for good in 1.5.

@osma osma closed this as completed Jan 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants