lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Woodward (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-8715) TestLucene70NormsFormat is testing the wrong Codec
Date Fri, 01 Mar 2019 15:34:00 GMT

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

Alan Woodward commented on LUCENE-8715:
---------------------------------------

Lucene70Codec is read-only, so we need a small amount of trickery to use it in norms format
tests.  The patch looks like this:
{code:java}
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene70/TestLucene70NormsFormat.java
b/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene70/TestLucene70NormsFormat.java
index f7d77142db..d26761b00a 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene70/TestLucene70NormsFormat.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene70/TestLucene70NormsFormat.java
@@ -18,14 +18,27 @@ package org.apache.lucene.codecs.lucene70;


import org.apache.lucene.codecs.Codec;
-import org.apache.lucene.codecs.lucene80.Lucene80Codec;
+import org.apache.lucene.codecs.FilterCodec;
+import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat;
+import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
import org.apache.lucene.index.BaseNormsFormatTestCase;

/**
* Tests Lucene70NormsFormat
*/
public class TestLucene70NormsFormat extends BaseNormsFormatTestCase {
- private final Codec codec = new Lucene80Codec();
+ private final Codec codec = new FilterCodec("Lucene70", new Lucene70Codec()) {
+   @Override
+   public PostingsFormat postingsFormat() {
+     return new PerFieldPostingsFormat() {
+       @Override
+       public PostingsFormat getPostingsFormatForField(String field) {
+         return new Lucene50PostingsFormat();
+       }
+     };
+   }
+ };{code}

> TestLucene70NormsFormat is testing the wrong Codec
> --------------------------------------------------
>
>                 Key: LUCENE-8715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8715
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Adrien Grand
>            Priority: Minor
>
> TestLucene70NormsFormat is testing Lucene80Codec, rather than Lucene70.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message