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

Can't set "languages" for fields of type langdetect when profile is shorttext #47

Open
ptanov opened this issue Feb 18, 2022 · 2 comments

Comments

@ptanov
Copy link

ptanov commented Feb 18, 2022

There is a check (

) and when the profile is shorttext then languages_short_text is used but it is never set in builder/parser: (only languages are set)

ptanov added a commit to ptanov/elasticsearch-plugin-bundle that referenced this issue Feb 18, 2022
@ptanov
Copy link
Author

ptanov commented Feb 18, 2022

In this fix we first try to get the value of languages list (if available) before using the default value for languages_short_text. We don't need initialization of languages in DEFAULT_SETTINGS because we provide a default value when getting the languages (

). By doing that we ensure that DEFAULT_LANGUAGES_SHORT_TEXT will be used if no configuration is provided (default constructor). The only drawback of this approach is if someone provide settings that contains languages but not contains languages_short_text and actually want to use DEFAULT_LANGUAGES_SHORT_TEXT. This case could be avoided if the default constructor is used in the situation.

However test case needs to be created...

@jprante
Copy link
Owner

jprante commented Feb 22, 2022

Nice catch, thanks

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

No branches or pull requests

2 participants