Closed guenthermi closed 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"?
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.
I discovered more issues:
http://localhost/#/view?id=Q64&lang=en
). This might also be fixed when using the i11n method to create the correct URLs.Berlin Q64
but this form of entries is not supported as an input (auto-completion does not work if you delete 4
and type 4
again: you get "no results found"; the only way to get back to the original search result is to delete all the extra Qid/alias part).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.
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).
This adds a search field to the headline of the page to find arbitrary Wikidata Items. #37