gbv / cocoda-sdk

SDK for Cocoda and coli-conc services
https://gbv.github.io/cocoda-sdk/
MIT License
5 stars 1 forks source link

LabelSearchSuggestionProvider: Use truncated prefLabel? #40

Closed stefandesu closed 2 years ago

stefandesu commented 2 years ago

Currently, LabelSearchSuggestionProvider uses the full prefLabel to find concepts in the target scheme. However, if the label contains multiple things separated by commas, like DDC 612.6 "Fortpflanzung, Entwicklung, Reifung", there usually won't be any results.

In Cocoda, when labels are inserted in the target search field, they are actually truncated using a certain heuristic, see here. Would it make sense to apply something similar here? We could also perform two search request for each direction, one with the full label (where the results are prioritized higher) and one with the truncated label. This would mean that one function call could actually be cause four API request because we need separate requests for both sides (if given).

@nichtich What do you think?

stefandesu commented 2 years ago

I used the same regex to truncate the label as is used in Cocoda.

I also think we should improve this at some point in the future, and even if behavior changes, it doesn't need to be a new major release even if it's technically a breaking change.