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

Not all skos:prefLabels are indexed in FlexSearch #127

Closed
acka47 opened this issue Feb 8, 2021 · 5 comments · Fixed by #152
Closed

Not all skos:prefLabels are indexed in FlexSearch #127

acka47 opened this issue Feb 8, 2021 · 5 comments · Fixed by #152
Assignees
Labels
bug Something isn't working

Comments

@acka47
Copy link
Member

acka47 commented Feb 8, 2021

Taking a deeper look at the FlexSearch index of some vocabularies, I noticed that not all skos:prefLabels are indexed. In HCRT, I found that "Abbildung" from https://w3id.org/kim/hcrt/image isn't indexed:

image

@literarymachine
Copy link
Contributor

image

Confirmed, it looks like the problem is that one language overwrites the others.

@sroertgen sroertgen self-assigned this Sep 2, 2021
@sroertgen
Copy link
Contributor

What is the wanted behaviour here? Do we also want to show results if search term was in another language? There maybe two options:

  1. Show Concepts even if the search term is another language:

Screenshot 2021-09-02 at 10 19 43
Screenshot 2021-09-02 at 10 19 54

  1. Only show results for the given language:

Screenshot 2021-09-02 at 10 27 50
Screenshot 2021-09-02 at 10 27 56

I think the first approach might be a bit confusing for users, but I'm open for discussion and feedback.

sroertgen added a commit that referenced this issue Sep 2, 2021
The problem was that through multiple calls of `index.add(concept.id, i18n(language)(concept.prefLabel))` the content for the respective id got overwritten.
This way only the last added label was present in the flexSearch index.
To overcome this I added two functions in a new file `searchIndex.js`. `buildIndexAndScheme` creates the index scheme and the index dependent on how many languages are present.
In `addToIndex` labels are concatenated to their language.
With the array labelsToAdd, we have the possibility to later add on more labels per language, e.g. `skos:example` or `skos:altLabel`.
We then save it just like the `.index` file, to later load it in the `App.js`template.
With the adjustemnt in line 79 it is possible to choose whether to search across all languages or just the current chosen one from pageContext.

Might resolve: #127, #128
@acka47
Copy link
Member Author

acka47 commented Sep 3, 2021

We should also consider #128 ("Add strings from skos:altLabel & skos:example to FlexSearch index") in this discussion as implementing it might also lead to showing a concept label as result that does not match the search term. When broadening the context like this, I also see two options:

  1. Show concepts if the search term matches prefLabel, altLabel or example in the chosen language. (The question why this concept is shown as result will then be answered when clicking on the link where altLabels and examples are shown.)
  2. Show concepts if the search term matches prefLabel, altLabel or example in any language.

I think, here, the first approach makes more sense, i.e. to even show a concept when the search term matches its prefLabel, altLabel or example in the given language.

This would mean, for this issue, to chose your second approach from #127 (comment) which you already favoured.

@dr0i
Copy link
Member

dr0i commented Oct 29, 2021

I think the vocab has to be rebuild to become effective?

@dr0i dr0i reopened this Oct 29, 2021
@acka47
Copy link
Member Author

acka47 commented Nov 4, 2021

I rebuilt HCRT and Hochschulfächersystematik. Closing.

@acka47 acka47 closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants