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

Local typehead search #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lokal-profil
Copy link
Contributor

Bug: T317109

@lokal-profil
Copy link
Contributor Author

This is a tentative patch for T317109 and the issue mentioned at the end of wbstack/cradle#2

Not used to vue and couldn't test this locally but it matches the pattern applied to public_html/resources/vue/wd-link.html

@lokal-profil
Copy link
Contributor Author

Might also be that wd_api_base + 'api.php?callback=?' could be replaced by wd.api per how this gets overridden by https://github.com/wbstack/cradle/blob/514f299e78db048d99afc3662afed7eda4a28631/public_html/vue.js#L78 and

this.set_custom_api = function ( api , callback ) {
let self = this ;
api += "?callback=?"

@tarrow
Copy link
Contributor

tarrow commented Jun 6, 2023

Thanks for this patch; it was indeed rather tricky to test locally. I am happy to report that it does appear to fix the search aspect of the problem (e.g. you only see results from your wikibase)

However, I noticed that after testing it locally that the items it created after using this adjustment were malformed. Specifically they target an item with the id of the the page title rather than the item id. See this screenshot below:
image

The fact that this is possible seems to me to also be a wikibase bug but this request should also not happen from cradle/widar.

I was hoping to just merge this PR as "not perfect but better than the status quo" but I fear that doing so will result in people on wikibase.cloud creating a load of items that are rather malformed. I'm going to have to investigate this a little further. Thanks for your patience :)

@lokal-profil
Copy link
Contributor Author

@tarrow
Since local testing of this is still an issue for me. Are these malformed values ones that didn't occur before the patch? I.e. If you were to manually enter Q2 and choose the local hit.

@lokal-profil
Copy link
Contributor Author

lokal-profil commented Sep 21, 2023

Actually I realised that there is probably a namespace issue as well in that public_html/resources/vue/typeahead-search.htmlon L124 (in this patch L121 otherwise) assumes Properties on namespace 120 and (presumably) Items on namespace 0. Whereas on a wikibase-cloud instance Items are on 120 and Properties on 122.

@lokal-profil
Copy link
Contributor Author

@tarrow Since local testing of this is still an issue for me. Are these malformed values ones that didn't occur before the patch? I.e. If you were to manually enter Q2 and choose the local hit.

I believe the issue might lie with the use of v.title on L148 (L131) rather than v.id. These are identical on Wikidata but not so on a Wikibase.cloud instance.

Also if you have tips about a local testing setup I'd be happy to try that.

@lokal-profil
Copy link
Contributor Author

Actually I realised that there is probably a namespace issue as well in that public_html/resources/vue/typeahead-search.htmlon L124 (in this patch L121 otherwise) assumes Properties on namespace 120 and (presumably) Items on namespace 0. Whereas on a wikibase-cloud instance Items are on 120 and Properties on 122.

Separated this issue out into a patch at #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants