lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject [03/17] lucene-solr:jira/solr-8668: LUCENE-7791: add tests for index sorting with sparse text fields and norms
Date Tue, 25 Apr 2017 13:59:30 GMT
LUCENE-7791: add tests for index sorting with sparse text fields and norms


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/3316f47b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/3316f47b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/3316f47b

Branch: refs/heads/jira/solr-8668
Commit: 3316f47bcf110851ebf7f70b835027a9769bccd2
Parents: 0404e37
Author: Jim Ferenczi <jimczi@apache.org>
Authored: Fri Apr 21 12:01:09 2017 +0200
Committer: Jim Ferenczi <jimczi@apache.org>
Committed: Fri Apr 21 12:01:09 2017 +0200

----------------------------------------------------------------------
 .../src/test/org/apache/lucene/index/TestIndexSorting.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3316f47b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
index ef5d4ef..be3a2af 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
@@ -2411,12 +2411,15 @@ public class TestIndexSorting extends LuceneTestCase {
     Sort indexSort = new Sort(sortField);
     iwc.setIndexSort(indexSort);
     IndexWriter w = new IndexWriter(dir, iwc);
+    Field textField = newTextField("sparse_text", "", Field.Store.NO);
     for (int i = 0; i < 128; i++) {
       Document doc = new Document();
       doc.add(new NumericDocValuesField("dense_int", i));
       if (i < 64) {
         doc.add(new NumericDocValuesField("sparse_int", i));
         doc.add(new BinaryDocValuesField("sparse_binary", new BytesRef(Integer.toString(i))));
+        textField.setStringValue("foo");
+        doc.add(textField);
       }
       w.addDocument(doc);
     }
@@ -2429,6 +2432,7 @@ public class TestIndexSorting extends LuceneTestCase {
     NumericDocValues denseValues = leafReader.getNumericDocValues("dense_int");
     NumericDocValues sparseValues = leafReader.getNumericDocValues("sparse_int");
     BinaryDocValues sparseBinaryValues = leafReader.getBinaryDocValues("sparse_binary");
+    NumericDocValues normsValues = leafReader.getNormValues("sparse_text");
     for(int docID = 0; docID < 128; docID++) {
       assertTrue(denseValues.advanceExact(docID));
       assertEquals(127-docID, (int) denseValues.longValue());
@@ -2436,12 +2440,14 @@ public class TestIndexSorting extends LuceneTestCase {
         assertTrue(denseValues.advanceExact(docID));
         assertTrue(sparseValues.advanceExact(docID));
         assertTrue(sparseBinaryValues.advanceExact(docID));
-        assertEquals(docID, sparseValues.docID());
+        assertTrue(normsValues.advanceExact(docID));
+        assertEquals(124, normsValues.longValue());
         assertEquals(127-docID, (int) sparseValues.longValue());
         assertEquals(new BytesRef(Integer.toString(127-docID)), sparseBinaryValues.binaryValue());
       } else {
         assertFalse(sparseBinaryValues.advanceExact(docID));
         assertFalse(sparseValues.advanceExact(docID));
+        assertFalse(normsValues.advanceExact(docID));
       }
     }
     IOUtils.close(r, w, dir);


Mime
View raw message