You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "azagniotov (via GitHub)" <gi...@apache.org> on 2024/11/27 04:50:13 UTC
[PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
azagniotov opened a new pull request, #2886:
URL: https://github.com/apache/solr/pull/2886
https://issues.apache.org/jira/browse/SOLR-17575
<!--
_(If you are a project committer then you may remove some/all of the following template.)_
Before creating a pull request, please file an issue in the ASF Jira system for Solr:
* https://issues.apache.org/jira/projects/SOLR
For something minor (i.e. that wouldn't be worth putting in release notes), you can skip JIRA.
To create a Jira issue, you will need to create an account there first.
The title of the PR should reference the Jira issue number in the form:
* SOLR-####: <short description of problem or changes>
SOLR must be fully capitalized. A short description helps people scanning pull requests for items they can work on.
Properly referencing the issue in the title ensures that Jira is correctly updated with code review comments and commits. -->
# Description
Making sure that backwards compatibility with the legacy `"langid.whitelist"` config in Solr Langid works as expected. In other words, the language detection runtime behavior should be the same when the ISO 639-1 language codes specified in the legacy `"langid.whitelist"` OR the current (default) `"langid.allowlist"`.
# Solution
Making sure that if the legacy `"langid.whitelist"` is configured, its value is used as the default value when reading the `LANG_ALLOWLIST` parameter.
# Tests
- Added a sanity unit test to demonstrate that the behavior using the current (default) `"langid.allowlist"` is as expected.
- Added a unit test to demonstrate that the backwards compatibility with the legacy `"langid.whitelist"` works as expected.
# Checklist
Please review the following and check all that apply:
- [x] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability.
- [x] I have created a Jira issue and added the issue ID to my pull request title.
- [x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
- [x] I have developed this patch against the `main` branch.
- [x] I have run `./gradlew check`.
- [x] I have added tests for my changes.
- [ ] (**N/A**) I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on PR #2886:
URL: https://github.com/apache/solr/pull/2886#issuecomment-2503984122
> glad to see we are tackling fixing a bug. In 10x we should move forward and delete the langid.whitelist.....
For sure. I expect there to be lots of such cleanup commits on the main branch in the coming weeks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "azagniotov (via GitHub)" <gi...@apache.org>.
azagniotov commented on code in PR #2886:
URL: https://github.com/apache/solr/pull/2886#discussion_r1860642411
##########
solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java:
##########
@@ -111,18 +111,21 @@ private void initParams(SolrParams params) {
overwrite = params.getBool(OVERWRITE, false);
langAllowlist = new HashSet<>();
threshold = params.getDouble(THRESHOLD, DOCID_THRESHOLD_DEFAULT);
- String legacyAllowList = params.get(LANG_WHITELIST, "");
- if (legacyAllowList.length() > 0) {
+ final String legacyAllowList = params.get(LANG_WHITELIST, "").trim();
+ if (!legacyAllowList.isEmpty()) {
// nowarn compile time string concatenation
log.warn(
LANG_WHITELIST
+ " parameter is deprecated; use "
+ LANG_ALLOWLIST
+ " instead."); // nowarn
}
- if (params.get(LANG_ALLOWLIST, legacyAllowList).length() > 0) {
- for (String lang : params.get(LANG_ALLOWLIST, "").split(",")) {
- langAllowlist.add(lang);
+ if (!params.get(LANG_ALLOWLIST, legacyAllowList).isEmpty()) {
+ for (String lang : params.get(LANG_ALLOWLIST, legacyAllowList).split(",")) {
+ if (lang.trim().isEmpty()) {
+ continue;
+ }
+ langAllowlist.add(lang.trim());
Review Comment:
@janhoy thanks! I was considering the similar to be honest. But, contribution guidelines suggest to "try to adhere to the coding style of files you edit", so I chose not to follow the functional style. I am happy to apply the suggestion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #2886:
URL: https://github.com/apache/solr/pull/2886#discussion_r1860286943
##########
solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java:
##########
@@ -464,6 +466,101 @@ public void testMapIndividual() throws Exception {
assertTrue(mappedIndividual.containsKey("text2_ru"));
}
+ @Test
+ public void testAllowlistWithFallback() throws Exception {
+ ModifiableSolrParams parameters = new ModifiableSolrParams();
+ parameters.add("langid.fl", "name,subject");
+ parameters.add("langid.langField", "language_s");
+ parameters.add("langid.allowlist", "no,en ,,,sv"); // Any other language will fallback to EN
+ parameters.add("langid.fallback", "en");
+ liProcessor = createLangIdProcessor(parameters);
+
+ // Make sure that empty language codes have been filtered out and others trimmed.
Review Comment:
Should be no need to do an actual detection here (which currently fails tests). Suffice to check that the `langAllowList` got populated, and delete all the `assertLang`s.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "azagniotov (via GitHub)" <gi...@apache.org>.
azagniotov commented on code in PR #2886:
URL: https://github.com/apache/solr/pull/2886#discussion_r1860812062
##########
solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java:
##########
@@ -111,19 +111,20 @@ private void initParams(SolrParams params) {
overwrite = params.getBool(OVERWRITE, false);
langAllowlist = new HashSet<>();
threshold = params.getDouble(THRESHOLD, DOCID_THRESHOLD_DEFAULT);
- String legacyAllowList = params.get(LANG_WHITELIST, "");
- if (legacyAllowList.length() > 0) {
+ final String legacyAllowList = params.get(LANG_WHITELIST, "").trim();
+ if (!legacyAllowList.isEmpty()) {
// nowarn compile time string concatenation
log.warn(
LANG_WHITELIST
+ " parameter is deprecated; use "
+ LANG_ALLOWLIST
+ " instead."); // nowarn
}
- if (params.get(LANG_ALLOWLIST, legacyAllowList).length() > 0) {
- for (String lang : params.get(LANG_ALLOWLIST, "").split(",")) {
- langAllowlist.add(lang);
- }
+ if (!params.get(LANG_ALLOWLIST, legacyAllowList).isEmpty()) {
Review Comment:
Yes, I will simplify ððž
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #2886:
URL: https://github.com/apache/solr/pull/2886#issuecomment-2503966827
glad to see we are tackling fixing a bug. In 10x we should move forward and delete the langid.whitelist.....
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #2886:
URL: https://github.com/apache/solr/pull/2886#discussion_r1860287923
##########
solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java:
##########
@@ -464,6 +466,101 @@ public void testMapIndividual() throws Exception {
assertTrue(mappedIndividual.containsKey("text2_ru"));
}
+ @Test
+ public void testAllowlistWithFallback() throws Exception {
+ ModifiableSolrParams parameters = new ModifiableSolrParams();
+ parameters.add("langid.fl", "name,subject");
+ parameters.add("langid.langField", "language_s");
+ parameters.add("langid.allowlist", "no,en ,,,sv"); // Any other language will fallback to EN
+ parameters.add("langid.fallback", "en");
+ liProcessor = createLangIdProcessor(parameters);
+
+ // Make sure that empty language codes have been filtered out and others trimmed.
+ assertEquals(new HashSet<>(Arrays.asList("no", "en", "sv")), liProcessor.langAllowlist);
+ assertLang(
+ "no",
+ "id",
+ "1no",
+ "name",
+ "Lucene",
+ "subject",
+ "Lucene er et fri/ÃĨpen kildekode programvarebibliotek for informasjonsgjenfinning, opprinnelig utviklet i programmeringssprÃĨket Java av Doug Cutting. Lucene stÃļttes av Apache Software Foundation og utgis under Apache-lisensen.");
+ assertLang(
+ "en",
+ "id",
+ "2en",
+ "name",
+ "Lucene",
+ "subject",
+ "Apache Lucene is a free/open source information retrieval software library, originally created in Java by Doug Cutting. It is supported by the Apache Software Foundation and is released under the Apache Software License.");
+ assertLang(
+ "sv",
+ "id",
+ "3sv",
+ "name",
+ "Maven",
+ "subject",
+ "Apache Maven ÃĪr ett verktyg utvecklat av Apache Software Foundation och anvÃĪnds inom systemutveckling av datorprogram i programsprÃĨket Java. Maven anvÃĪnds fÃķr att automatiskt paketera (bygga) programfilerna till en distribuerbar enhet. Maven anvÃĪnds inom samma omrÃĨde som Apache Ant men dess byggfiler ÃĪr deklarativa till skillnad ifrÃĨn Ants skriptbaserade.");
+ // Based on our langid.allowlist config,
+ // the Thai document is an unknown language, thus, language detection must fall back to EN
+ assertLang(
+ "en",
+ "id",
+ "6th",
+ "name",
+ "āļāļāļāļ§āļēāļĄāļāļąāļāļŠāļĢāļĢāđāļāļ·āļāļāļāļĩāđ",
+ "subject",
+ "āļāļąāļāđāļāļāļĨāļĩāļŠ āļĄāļēāļĢāļĩ āļāļąāļāđāļāļ āļāļĢāļąāļāļāđ āļŦāļĢāļ·āļāļĄāļąāļāļĢāļđāđāļāļąāļāđāļāļ āļēāļĐāļēāđāļāļĒāļ§āđāļē āđāļāļāļāđ āđāļāļĢāļāļāđ āđāļāđāļāđāļāđāļāļŦāļāļīāļāļāļēāļ§āļĒāļīāļ§ āđāļāļīāļāļāļĩāđāđāļĄāļ·āļāļāđāļāļĢāļāļāđāđāļāļīāļĢāđāļ āļāļĢāļ°āđāļāļĻāđāļĒāļāļĢāļĄāļāļĩ āđāļāļāļĄāļĩāļāļ·āđāļāđāļŠāļĩāļĒāļāđāļāđāļāļāļąāļāđāļāļāļēāļāļ°āļāļđāđāđāļāļĩāļĒāļāļāļąāļāļāļķāļāļāļĢāļ°āļāļģāļ§āļąāļāļāļķāđāļāļāđāļāļĄāļēāđāļāđāļĢāļąāļāļāļēāļĢāļāļĩāļāļīāļĄāļāđāđāļāđāļāļŦāļāļąāļāļŠāļ·āļ āļāļĢāļĢāļĒāļēāļĒāđāļŦāļāļļāļāļēāļĢāļāđāļāļāļ°āļŦāļĨāļāļāđāļāļāļāļąāļ§āļāļēāļāļāļēāļĢāļĨāđāļēāļāļēāļ§āļĒāļīāļ§āđāļāļāļĢāļ°āđāļāļĻāđāļāđāļāļāļĢāđāđāļĨāļāļāđ āļĢāļ°āļŦāļ§āđāļēāļāļāļĩāđāļāļđāļāđāļĒāļāļĢāļĄāļāļĩāđāļāđāļēāļāļĢāļāļāļāļĢāļāļāđāļāļāđāļ§āļāļŠāļāļāļĢāļēāļĄāđāļĨāļāļāļĢāļąāđāļāļāļĩāđāļŠāļāļ");
+ }
+
+ @Test
+ public void testAllowlistBackwardsCompatabilityWithLegacyAllowlist() throws Exception {
+ // The "legacy allowlist" is "langid.whitelist"
+ ModifiableSolrParams parameters = new ModifiableSolrParams();
+ parameters.add("langid.fl", "name,subject");
+ parameters.add("langid.langField", "language_s");
+ parameters.add("langid.whitelist", "no,en ,,,sv"); // Any other language will fallback to EN
+ parameters.add("langid.fallback", "en");
+ liProcessor = createLangIdProcessor(parameters);
+
+ // Make sure that empty language codes have been filtered out and others trimmed.
Review Comment:
Same is true here, just test that the allowList got populated:
```suggestion
assertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "azagniotov (via GitHub)" <gi...@apache.org>.
azagniotov commented on PR #2886:
URL: https://github.com/apache/solr/pull/2886#issuecomment-2505404727
> [janhoy](/janhoy)
@janhoy done!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on PR #2886:
URL: https://github.com/apache/solr/pull/2886#issuecomment-2505386291
Good. Only one thing missing now. Add a CHANGES.txt line under 9.8.0 Bugfix section, with your own and my name. Iâll then merge and backport.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #2886:
URL: https://github.com/apache/solr/pull/2886#discussion_r1860712358
##########
solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java:
##########
@@ -111,19 +111,20 @@ private void initParams(SolrParams params) {
overwrite = params.getBool(OVERWRITE, false);
langAllowlist = new HashSet<>();
threshold = params.getDouble(THRESHOLD, DOCID_THRESHOLD_DEFAULT);
- String legacyAllowList = params.get(LANG_WHITELIST, "");
- if (legacyAllowList.length() > 0) {
+ final String legacyAllowList = params.get(LANG_WHITELIST, "").trim();
+ if (!legacyAllowList.isEmpty()) {
// nowarn compile time string concatenation
log.warn(
LANG_WHITELIST
+ " parameter is deprecated; use "
+ LANG_ALLOWLIST
+ " instead."); // nowarn
}
- if (params.get(LANG_ALLOWLIST, legacyAllowList).length() > 0) {
- for (String lang : params.get(LANG_ALLOWLIST, "").split(",")) {
- langAllowlist.add(lang);
- }
+ if (!params.get(LANG_ALLOWLIST, legacyAllowList).isEmpty()) {
Review Comment:
We don't even need the if clause and isEmpty test here, cause the array.stream will end up with an empty string and do nothing if not configured, i.e. it is implicitly conditional. Agree?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #2886:
URL: https://github.com/apache/solr/pull/2886#discussion_r1860286943
##########
solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java:
##########
@@ -464,6 +466,101 @@ public void testMapIndividual() throws Exception {
assertTrue(mappedIndividual.containsKey("text2_ru"));
}
+ @Test
+ public void testAllowlistWithFallback() throws Exception {
+ ModifiableSolrParams parameters = new ModifiableSolrParams();
+ parameters.add("langid.fl", "name,subject");
+ parameters.add("langid.langField", "language_s");
+ parameters.add("langid.allowlist", "no,en ,,,sv"); // Any other language will fallback to EN
+ parameters.add("langid.fallback", "en");
+ liProcessor = createLangIdProcessor(parameters);
+
+ // Make sure that empty language codes have been filtered out and others trimmed.
Review Comment:
Should be no need to do an actual detection here (which currently fails tests). Suffice to check that the allowList got populated:
```suggestion
assertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist);
```
##########
solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java:
##########
@@ -111,18 +111,21 @@ private void initParams(SolrParams params) {
overwrite = params.getBool(OVERWRITE, false);
langAllowlist = new HashSet<>();
threshold = params.getDouble(THRESHOLD, DOCID_THRESHOLD_DEFAULT);
- String legacyAllowList = params.get(LANG_WHITELIST, "");
- if (legacyAllowList.length() > 0) {
+ final String legacyAllowList = params.get(LANG_WHITELIST, "").trim();
+ if (!legacyAllowList.isEmpty()) {
// nowarn compile time string concatenation
log.warn(
LANG_WHITELIST
+ " parameter is deprecated; use "
+ LANG_ALLOWLIST
+ " instead."); // nowarn
}
- if (params.get(LANG_ALLOWLIST, legacyAllowList).length() > 0) {
- for (String lang : params.get(LANG_ALLOWLIST, "").split(",")) {
- langAllowlist.add(lang);
+ if (!params.get(LANG_ALLOWLIST, legacyAllowList).isEmpty()) {
+ for (String lang : params.get(LANG_ALLOWLIST, legacyAllowList).split(",")) {
+ if (lang.trim().isEmpty()) {
+ continue;
+ }
+ langAllowlist.add(lang.trim());
Review Comment:
An alternative is functional style, but up to you:
```java
params.get(LANG_ALLOWLIST, legacyAllowList)
.flatMap(line -> Arrays.stream(line.split(",")))
.map(String::trim)
.filter(lang -> !lang.isEmpty())
.forEach(langAllowlist::add);
```
##########
solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java:
##########
@@ -464,6 +466,101 @@ public void testMapIndividual() throws Exception {
assertTrue(mappedIndividual.containsKey("text2_ru"));
}
+ @Test
+ public void testAllowlistWithFallback() throws Exception {
+ ModifiableSolrParams parameters = new ModifiableSolrParams();
+ parameters.add("langid.fl", "name,subject");
+ parameters.add("langid.langField", "language_s");
+ parameters.add("langid.allowlist", "no,en ,,,sv"); // Any other language will fallback to EN
+ parameters.add("langid.fallback", "en");
+ liProcessor = createLangIdProcessor(parameters);
+
+ // Make sure that empty language codes have been filtered out and others trimmed.
+ assertEquals(new HashSet<>(Arrays.asList("no", "en", "sv")), liProcessor.langAllowlist);
+ assertLang(
+ "no",
+ "id",
+ "1no",
+ "name",
+ "Lucene",
+ "subject",
+ "Lucene er et fri/ÃĨpen kildekode programvarebibliotek for informasjonsgjenfinning, opprinnelig utviklet i programmeringssprÃĨket Java av Doug Cutting. Lucene stÃļttes av Apache Software Foundation og utgis under Apache-lisensen.");
+ assertLang(
+ "en",
+ "id",
+ "2en",
+ "name",
+ "Lucene",
+ "subject",
+ "Apache Lucene is a free/open source information retrieval software library, originally created in Java by Doug Cutting. It is supported by the Apache Software Foundation and is released under the Apache Software License.");
+ assertLang(
+ "sv",
+ "id",
+ "3sv",
+ "name",
+ "Maven",
+ "subject",
+ "Apache Maven ÃĪr ett verktyg utvecklat av Apache Software Foundation och anvÃĪnds inom systemutveckling av datorprogram i programsprÃĨket Java. Maven anvÃĪnds fÃķr att automatiskt paketera (bygga) programfilerna till en distribuerbar enhet. Maven anvÃĪnds inom samma omrÃĨde som Apache Ant men dess byggfiler ÃĪr deklarativa till skillnad ifrÃĨn Ants skriptbaserade.");
+ // Based on our langid.allowlist config,
+ // the Thai document is an unknown language, thus, language detection must fall back to EN
+ assertLang(
+ "en",
+ "id",
+ "6th",
+ "name",
+ "āļāļāļāļ§āļēāļĄāļāļąāļāļŠāļĢāļĢāđāļāļ·āļāļāļāļĩāđ",
+ "subject",
+ "āļāļąāļāđāļāļāļĨāļĩāļŠ āļĄāļēāļĢāļĩ āļāļąāļāđāļāļ āļāļĢāļąāļāļāđ āļŦāļĢāļ·āļāļĄāļąāļāļĢāļđāđāļāļąāļāđāļāļ āļēāļĐāļēāđāļāļĒāļ§āđāļē āđāļāļāļāđ āđāļāļĢāļāļāđ āđāļāđāļāđāļāđāļāļŦāļāļīāļāļāļēāļ§āļĒāļīāļ§ āđāļāļīāļāļāļĩāđāđāļĄāļ·āļāļāđāļāļĢāļāļāđāđāļāļīāļĢāđāļ āļāļĢāļ°āđāļāļĻāđāļĒāļāļĢāļĄāļāļĩ āđāļāļāļĄāļĩāļāļ·āđāļāđāļŠāļĩāļĒāļāđāļāđāļāļāļąāļāđāļāļāļēāļāļ°āļāļđāđāđāļāļĩāļĒāļāļāļąāļāļāļķāļāļāļĢāļ°āļāļģāļ§āļąāļāļāļķāđāļāļāđāļāļĄāļēāđāļāđāļĢāļąāļāļāļēāļĢāļāļĩāļāļīāļĄāļāđāđāļāđāļāļŦāļāļąāļāļŠāļ·āļ āļāļĢāļĢāļĒāļēāļĒāđāļŦāļāļļāļāļēāļĢāļāđāļāļāļ°āļŦāļĨāļāļāđāļāļāļāļąāļ§āļāļēāļāļāļēāļĢāļĨāđāļēāļāļēāļ§āļĒāļīāļ§āđāļāļāļĢāļ°āđāļāļĻāđāļāđāļāļāļĢāđāđāļĨāļāļāđ āļĢāļ°āļŦāļ§āđāļēāļāļāļĩāđāļāļđāļāđāļĒāļāļĢāļĄāļāļĩāđāļāđāļēāļāļĢāļāļāļāļĢāļāļāđāļāļāđāļ§āļāļŠāļāļāļĢāļēāļĄāđāļĨāļāļāļĢāļąāđāļāļāļĩāđāļŠāļāļ");
+ }
+
+ @Test
+ public void testAllowlistBackwardsCompatabilityWithLegacyAllowlist() throws Exception {
+ // The "legacy allowlist" is "langid.whitelist"
+ ModifiableSolrParams parameters = new ModifiableSolrParams();
+ parameters.add("langid.fl", "name,subject");
+ parameters.add("langid.langField", "language_s");
+ parameters.add("langid.whitelist", "no,en ,,,sv"); // Any other language will fallback to EN
+ parameters.add("langid.fallback", "en");
+ liProcessor = createLangIdProcessor(parameters);
+
+ // Make sure that empty language codes have been filtered out and others trimmed.
Review Comment:
Same is true here, just test that the allowList got populated:
```suggestion
assertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid [solr]
Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy merged PR #2886:
URL: https://github.com/apache/solr/pull/2886
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org