Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

-afix the KAMI-31, ImmutableIntArrayDocIdSets bug, however, this one …

…is not called by anywhere else except the test, so, should not affect applications of kamikaze
  • Loading branch information...
commit fc9f240af74c1b52a18b5eb3b45822905a44f5c5 1 parent 10cecc6
hao yan authored
View
2  src/main/java/com/kamikaze/docidset/impl/ImmutableIntArrayDocIdSet.java
@@ -56,7 +56,7 @@ public int advance(int target) throws java.io.IOException{
if (cursor >= _array.length || _array.length == -1) return DocIdSetIterator.NO_MORE_DOCS;
if (target <= _doc) target = _doc + 1;
int index = Arrays.binarySearch(_array, target);
- if (index > 0){
+ if (index >= 0){
cursor = index;
_doc = _array[cursor];
return _doc;
View
21 src/test/java/com/kamikaze/test/PForDeltaTestKamikazeTest.java
@@ -172,13 +172,15 @@ public void testPartialEmptyAnd() throws IOException
@Test
public void testImmutableSet() throws IOException{
- int[] data = new int[]{20,30,40};
+ int[] data = new int[]{10, 20,30,40};
ImmutableIntArrayDocIdSet dsImmutable = new
ImmutableIntArrayDocIdSet(data);
IntArrayDocIdSet dsRegular = new IntArrayDocIdSet();
dsRegular.addDocs(data, 0, data.length);
DocIdSetIterator dsImmutableIt = dsImmutable.iterator();
DocIdSetIterator dsRegualIt = dsRegular.iterator();
+ assertEquals(10, dsRegualIt.advance(10));
+ assertEquals(10, dsImmutableIt.advance(10));
assertEquals(20, dsRegualIt.advance(0));
assertEquals(20, dsImmutableIt.advance(0));
assertEquals(30, dsRegualIt.advance(29));
@@ -186,4 +188,21 @@ public void testImmutableSet() throws IOException{
assertEquals(DocIdSetIterator.NO_MORE_DOCS,dsRegualIt.advance(50));
assertEquals(DocIdSetIterator.NO_MORE_DOCS,dsImmutableIt.advance(50));
}
+
+// @Test
+// public void testImmutableSet() throws IOException{
+// int[] data = new int[]{20,30,40};
+// ImmutableIntArrayDocIdSet dsImmutable = new
+// ImmutableIntArrayDocIdSet(data);
+// IntArrayDocIdSet dsRegular = new IntArrayDocIdSet();
+// dsRegular.addDocs(data, 0, data.length);
+// DocIdSetIterator dsImmutableIt = dsImmutable.iterator();
+// DocIdSetIterator dsRegualIt = dsRegular.iterator();
+// assertEquals(20, dsRegualIt.advance(0));
+// assertEquals(20, dsImmutableIt.advance(0));
+// assertEquals(30, dsRegualIt.advance(29));
+// assertEquals(30, dsImmutableIt.advance(29));
+// assertEquals(DocIdSetIterator.NO_MORE_DOCS,dsRegualIt.advance(50));
+// assertEquals(DocIdSetIterator.NO_MORE_DOCS,dsImmutableIt.advance(50));
+// }
}
Please sign in to comment.
Something went wrong with that request. Please try again.