Wikidata / SQID

A tool to analyse, browse and query Wikidata
http://tools.wmflabs.org/sqid/
Apache License 2.0
84 stars 17 forks source link

Search field #86

Closed guenthermi closed 8 years ago

guenthermi commented 8 years ago

This adds a search field to the headline of the page to find arbitrary Wikidata Items. #37

mkroetzsch commented 8 years ago

I added two comments inline.

Why are some of the files called "search" and others "searchField"? Is it possible to use the "search" components without the "searchField" so they have a stand-alone identity?

I also note that "search" is a fairly general term. Should we maybe use a more specific label for this feature or is "search" ok since we will not have another "search"?

mkroetzsch commented 8 years ago

I also noted that the code does not handle language quite correctly. What it does now is to append lang=<code> to all URLs. However, we should distinguish the state where no language was set (but ne might have been auto-detected or default to "en") and the case where the language was set explicitly. The View view (and all code that is using it) distinguishes the "lang=en" from the absence of "lang" in the URL. Eventually, the method i18n.getEntityUrl(itemId) is used to get the correct behaviour.

mkroetzsch commented 8 years ago

I discovered more issues:

guenthermi commented 8 years ago

Why are some of the files called "search" and others "searchField"? Is it possible to use the "search" components without the "searchField" so they have a stand-alone identity?

I also note that "search" is a fairly general term. Should we maybe use a more specific label for this feature or is "search" ok since we will not have another "search"?

Ok, I can rename everything to entitySearch. This is more specific

However, we should distinguish the state where no language was set (but ne might have been auto-detected or default to "en") and the case where the language was set explicitly.

I used i18n.getLanguage() to detect the language. This Function automatically returns 'en' if no language information is available. I thought it is not the appropriated way for the searchField (entitySearch) controller to parse the lang attribute from the query string, because this should be done when the start page is opened. Is there another way to get the language settings or am I completely wrong?

The current dropdown sometimes shows some information which seems to be the alias. However, this behaves strangely in some cases

The Wikidata API returning one alias at most (action=wbsearchentities). The aliases which are shown are the same aliases you will note in the search of the Wikidata UI. I don't know which criteria are used to choose the alias.

mkroetzsch commented 8 years ago

Is there another way to get the language settings or am I completely wrong?

You can call the method i18n.fixedLanguage() to find out if the language has been set at all. However, you can also just use the URL generation methods of i18n to get the right place to link to without having to think about URL parameters. This would also fix the issue with the broken links.

The aliases which are shown are the same aliases you will note in the search of the Wikidata UI.

Ok, I see it now. Maybe this can be clarified with formatting, so set off the title from the alias (right now it looks like one string, which can be confusing to read).