[ 
https://issues.apache.org/jira/browse/NUTCH-3122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18015626#comment-18015626
 ] 

ASF GitHub Bot commented on NUTCH-3122:
---------------------------------------

TamimEhsan commented on PR #859:
URL: https://github.com/apache/nutch/pull/859#issuecomment-3213775644

   is this test enough to check the backward compatibility? I tried to recreate 
the old behaviour by reassigning HashMap to metadata. Thus simulating a writing 
by old instance and reading from new. 
   
   ```java
     @Test
     public void testWritableCaseInsensitive() {
       SpellCheckedMetadata result = null;
       SpellCheckedMetadata meta = new SpellCheckedMetadata() {
         {
             this.metadata = new HashMap<>();
         }
       };
   
       result = writeRead(meta);
       Assert.assertEquals(0, result.size());
   
       meta.add("name-One", "value-1.1");
       result = writeRead(meta);
       Assert.assertEquals(1, result.size());
       Assert.assertEquals(1, result.getValues("naMe-one").length);
       Assert.assertEquals("value-1.1", result.get("nAme-oNe"));
   
       meta.add("Contenttype", "text/html");
       meta.add("name-Two", "value-2.1");
       meta.add("namE-two", "value-2.2");
       result = writeRead(meta);
       Assert.assertEquals(3, result.size());
       Assert.assertEquals(1, result.getValues("name-onE").length);
       Assert.assertEquals("value-1.1", result.getValues("namE-one")[0]);
       Assert.assertEquals(2, result.getValues("name-two").length);
       Assert.assertEquals("value-2.1", result.getValues("nAme-tWo")[0]);
       Assert.assertEquals("value-2.2", result.getValues("namE-Two")[1]);
       Assert.assertEquals("text/html", result.get(Metadata.CONTENT_TYPE));
     }
     ```




> Make SpellCheckedMetadata case-insensitive for all Metadata names
> -----------------------------------------------------------------
>
>                 Key: NUTCH-3122
>                 URL: https://issues.apache.org/jira/browse/NUTCH-3122
>             Project: Nutch
>          Issue Type: Improvement
>          Components: metadata
>    Affects Versions: 1.21
>            Reporter: Sebastian Nagel
>            Priority: Major
>             Fix For: 1.22
>
>
> See NUTCH-3002 and the discussion in 
> [stormcrawler#1588|https://github.com/apache/stormcrawler/issues/1588]:
> - we have CaseInsensitiveMetadata (used by protocol-okhttp) and
> - SpellCheckedMetadata (used elsewhere) which does case-insensitive look-ups 
> only for header listed in 
> [HttpHeaders|https://github.com/apache/nutch/blob/master/src/java/org/apache/nutch/metadata/HttpHeaders.java]
> We might consider to make SpellCheckedMetadata case-insensitive in general.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to