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

Add strings from skos:altLabel & skos:example to FlexSearch index #128

Closed
acka47 opened this issue Feb 8, 2021 · 13 comments · Fixed by #269
Closed

Add strings from skos:altLabel & skos:example to FlexSearch index #128

acka47 opened this issue Feb 8, 2021 · 13 comments · Fixed by #269
Assignees

Comments

@acka47
Copy link
Member

acka47 commented Feb 8, 2021

Requested by V.P. via email on 2021-02-21:

Die Suchfunktion ist ein tolles Feature der
Visualisierung, die Suche sucht aber nur in den Klassenbezeichnungen und
nicht in den Scope Notes und Examples. Ist dies mit Absicht so gewählt
oder einfach schwieriger zu implementieren? Die Frage kam deshalb auf,
weil bei unserer Klassifikation das Szenario durchaus gesehen wird, dass
die Nutzenden ein Wort aus den Examples eingeben, um zu suchen, in
welcher Klasse dies ist.

It looks like that currently the FlexSearch index is only built from skos:prefLabel in all languages that are provided (although there seem to be some problems with this, see #127). The use case to find concepts via altLabel or example definitely makes sense to me.

@ghertko
Copy link

ghertko commented Jun 9, 2021

... The use case to find concepts via altLabel or example definitely makes sense to me.

Oh, yes, it would be good to have this feature. Then the content of altLabel should also be visible on the concept's page.

@acka47
Copy link
Member Author

acka47 commented Jun 10, 2021

Then the content of altLabel should also be visible on the concept's page.

Thanks for the request. I opened an issue at #142 .

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
@sroertgen sroertgen self-assigned this Sep 2, 2021
@TobiasNx
Copy link

TobiasNx commented Nov 2, 2021

Also notation is not indexed. See #161

@acka47
Copy link
Member Author

acka47 commented Apr 7, 2022

With using the "full" tokenizer with #180 adding more fields could blow up index size for bigger vocabs with lots of alt labels and maybe long scopeNote texts. We will have to take this into account when addressing this.

@sroertgen
Copy link
Contributor

This could also be configured with the config file #185

@sroertgen
Copy link
Contributor

sroertgen commented Aug 11, 2023

#267 also suggested to search for definitions

To summarize, these fields are wanted to be searched additional to skos:prefLabel:

This might blow up the index clients have to download. @acka47 maybe we are now reaching the point, where we need support for a dedicated search engine.

Tasks:

  • make search fields configurable
  • check size of created index
  • (maybe add a dedicated search engine. should be a dedicated issue then)

@acka47
Copy link
Member Author

acka47 commented Aug 11, 2023

maybe we are now reaching the point, where we need support for a dedicated search engine

Yes. I could imagine the following approach:

  • using FlexSearch for smaller vocabs, e.g. value lists (something like up to 50 concepts)
  • for larger vocabs, implement lookup via the reconciliation API suggest endpoint (reconciliation support only makes sense after a certain amount of concepts anyway)

@sroertgen
Copy link
Contributor

sroertgen commented Aug 17, 2023

To work on this issue I decided to first fix #186.

This was long due and will help us on this issue.

Question I have is: How do we want to show the user that a concept matches though it is not the skos:prefLabel that matches?

I'm thinking of displaying the concept in italics and then maybe providing something like a tooltip?

Any other suggestions? Will post something here when I have a first prototype

cc @acka47 @carlschuurbiers

@acka47
Copy link
Member Author

acka47 commented Aug 17, 2023

What about somehow adding the field in brackets after the preflabel? E.g. like:

Search for "dialekt" in https://test.skohub.io/hbz/lobid-vocabs/heads/master/nwbib.de/subjects.de.html:

Show:

@sroertgen
Copy link
Contributor

sroertgen commented Aug 30, 2023

image

I think I'm pretty close. I just asked myself why just:

  • skos:altLabel
  • skos:example
  • skos:notation
  • skos:definition

shouldn't hiddenLabel, scopeNote and note be searchable as well? @acka47

@sroertgen
Copy link
Contributor

tagging also @carlschuurbiers if he has any opinions on that

@sroertgen sroertgen linked a pull request Aug 31, 2023 that will close this issue
@carlschuurbiers
Copy link

carlschuurbiers commented Sep 1, 2023

sure, that would be very useful, I think if one is searching for some expression, you will probably want to look everywhere. I only hope it will not clutter the interface too much if you add a checkbox for every expression... But it is a great feature!

One of the possible use cases would be: editors that need to determine which school subject(s) they should allocate to a certain learning object that are confronted with a huge list of possible school subjects (Sachgebietssystematik) can use various search expressions, and these expressions will be found in definitions/altLabels/examples/notations etc. and this will point them to a narrowed down set of possible subjects which they will then consider, choose from and allocate.

@carlschuurbiers
Copy link

is it possible to highlight the other places where an expression was found in the right window? So if nothing is highlighted in the left window, one can click on the entry and in the right window, where all data is displayed, the corresponding text is highlighted?

adding just the altLabel in the left window is great though. But we can't add all labels there...

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

Successfully merging a pull request may close this issue.

5 participants