Closed sroertgen closed 2 years ago
@dr0i please deploy to test for me to do a functional review. @literarymachine kindly agreed to review the code later on.
Deployed to test.You can go trigger new build @acka47 .
I made a new build for a HCRT fork at https://test.skohub.io/acka47/hcrt/heads/master/index.de.html and it all works as expected: Depending on my choice of language at the top (de/en), I can search the prefLabel
s of that language.
(However, I noticed that results will only show up if a string matches thre beginning of a word, e.g. searching for "spiel" won't give me "Lernspiel" back. That might be a limitation of FlexSearch or – if FlexSearch can handle this – we should create another issue to address this shortcoming.)
Thanks @literarymachine for looking at the code. Please see this commit message for my intention: https://github.com/skohub-io/skohub-vocabs/commit/12b9c27a1c357312e2c146405d1cd60b9d687156
(However, I noticed that results will only show up if a string matches thre beginning of a word, e.g. searching for "spiel" won't give me "Lernspiel" back. That might be a limitation of FlexSearch or – if FlexSearch can handle this – we should create another issue to address this shortcoming.)
I think this might be possible. We might have to change the tokenizer: https://github.com/nextapps-de/flexsearch/tree/0.6.32#tokenizer
Should this be changed here or do we want to open a seperate issue for that?
Should this be changed here or do we want to open a seperate issue for that?
I'll open another issue.
In general I am wondering if this would be a good time to (a) switch to a newer version of flexsearch and (b) perhaps use the built-in multi-lingual capabilities to build separate indexes for each language that we could then lazy-load?
Thanks for your feedback @literarymachine.
I will check out the newer flexsearch version and have a look at the multi-language capabilities. I will also test on nested lists.
@literarymachine
The v0.7 of flexsearch had some breaking changes. As well it has some issues using the export function (see. e.g. https://github.com/nextapps-de/flexsearch/issues/235). As long as this is not fixed I suggest we fix things in v0.6 and will migrate later.
Based on your comments, especially the lazy loading of the index, I took a much simpler approach, which is also less intrusive. It seems to work on nested lists as well.
If you have time I appreciate your feedback.
@dr0i would you mind deploying to test?
@sroertgen with https://github.com/skohub-io/skohub-vocabs/issues/115 you should be able to do this on your own. You just have to reset the dev
branch with your code and push to dev
. If this doesn't work don't hesitate to let me know.
Thank you! I will try out
@literarymachine would you mind having a look at the changes?
+1 I tested it both with https://test.skohub.io/acka47/hcrt/heads/master/w3id.org/kim/hcrt/scheme.de.html and with nested lists at https://test.skohub.io/acka47/hochschulfaechersystematik/heads/add-english-translations/w3id.org/kim/hochschulfaechersystematik/scheme.en.html and it both works as expected.
@dr0i please deploy to production.
Deployed to production. Closed.
Resolves #127.
Now all prefLabels should be indexed.
With line:
https://github.com/skohub-io/skohub-vocabs/blob/cb72bdf51d32ae314bde2ae2e0b55484364aa9e6/src/searchIndex.js#L21
it should also be possible to add further skos properties to FlexSearch index as wanted in #128
I deleted the test for node v10. As stated in #151, we don't want to support node v10 anymore. One check failed because I'm using the method
Object.fromEntries
which is supported in node since v12 (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries#browser_compatibility).