You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/07/19 17:59:32 UTC
svn commit: r1363400 [16/31] - in /lucene/dev/branches/pforcodec_3892: ./
dev-tools/ dev-tools/eclipse/ dev-tools/idea/.idea/
dev-tools/idea/.idea/copyright/ dev-tools/idea/.idea/libraries/
dev-tools/idea/lucene/ dev-tools/maven/ dev-tools/maven/lucene...
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java Thu Jul 19 15:58:54 2012
@@ -219,7 +219,7 @@ public class TestNumericUtils extends Lu
/** Note: The neededBounds Iterable must be unsigned (easier understanding what's happening) */
private void assertLongRangeSplit(final long lower, final long upper, int precisionStep,
final boolean useBitSet, final Iterable<Long> expectedBounds, final Iterable<Integer> expectedShifts
- ) throws Exception {
+ ) {
// Cannot use FixedBitSet since the range could be long:
final OpenBitSet bits=useBitSet ? new OpenBitSet(upper-lower+1) : null;
final Iterator<Long> neededBounds = (expectedBounds == null) ? null : expectedBounds.iterator();
@@ -460,7 +460,7 @@ public class TestNumericUtils extends Lu
/** Note: The neededBounds Iterable must be unsigned (easier understanding what's happening) */
private void assertIntRangeSplit(final int lower, final int upper, int precisionStep,
final boolean useBitSet, final Iterable<Integer> expectedBounds, final Iterable<Integer> expectedShifts
- ) throws Exception {
+ ) {
final FixedBitSet bits=useBitSet ? new FixedBitSet(upper-lower+1) : null;
final Iterator<Integer> neededBounds = (expectedBounds == null) ? null : expectedBounds.iterator();
final Iterator<Integer> neededShifts = (expectedShifts == null) ? null : expectedShifts.iterator();
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java Thu Jul 19 15:58:54 2012
@@ -17,7 +17,9 @@
package org.apache.lucene.util;
+import java.util.Iterator;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Random;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.Executors;
@@ -42,9 +44,18 @@ public class TestWeakIdentityMap extends
assertNotSame(key2, key3);
assertEquals(key2, key3);
+ // try null key & check its iterator also return null:
+ map.put(null, "null");
+ {
+ Iterator<String> it = map.keyIterator();
+ assertTrue(it.hasNext());
+ assertNull(it.next());
+ assertFalse(it.hasNext());
+ assertFalse(it.hasNext());
+ }
+ // 2 more keys:
map.put(key1, "bar1");
map.put(key2, "bar2");
- map.put(null, "null");
assertEquals(3, map.size());
@@ -84,6 +95,25 @@ public class TestWeakIdentityMap extends
map.put(key3, "bar3");
assertEquals(3, map.size());
+ int c = 0, keysAssigned = 0;
+ for (Iterator<String> it = map.keyIterator(); it.hasNext();) {
+ assertTrue(it.hasNext()); // try again, should return same result!
+ final String k = it.next();
+ assertTrue(k == key1 || k == key2 | k == key3);
+ keysAssigned += (k == key1) ? 1 : ((k == key2) ? 2 : 4);
+ c++;
+ }
+ assertEquals(3, c);
+ assertEquals("all keys must have been seen", 1+2+4, keysAssigned);
+
+ c = 0;
+ for (Iterator<String> it = map.valueIterator(); it.hasNext();) {
+ final String v = it.next();
+ assertTrue(v.startsWith("bar"));
+ c++;
+ }
+ assertEquals(3, c);
+
// clear strong refs
key1 = key2 = key3 = null;
@@ -93,7 +123,13 @@ public class TestWeakIdentityMap extends
System.runFinalization();
System.gc();
Thread.sleep(100L);
- assertTrue(size >= map.size());
+ c = 0;
+ for (Iterator<String> it = map.keyIterator(); it.hasNext();) {
+ assertNotNull(it.next());
+ c++;
+ }
+ assertTrue(size >= c);
+ assertTrue(c >= map.size());
size = map.size();
} catch (InterruptedException ie) {}
@@ -101,6 +137,14 @@ public class TestWeakIdentityMap extends
assertEquals(0, map.size());
assertTrue(map.isEmpty());
+ Iterator<String> it = map.keyIterator();
+ assertFalse(it.hasNext());
+ try {
+ it.next();
+ fail("Should throw NoSuchElementException");
+ } catch (NoSuchElementException nse) {
+ }
+
key1 = new String("foo");
key2 = new String("foo");
map.put(key1, "bar1");
@@ -133,7 +177,7 @@ public class TestWeakIdentityMap extends
final int count = atLeast(rnd, 10000);
for (int i = 0; i < count; i++) {
final int j = rnd.nextInt(keyCount);
- switch (rnd.nextInt(4)) {
+ switch (rnd.nextInt(5)) {
case 0:
map.put(keys.get(j), Integer.valueOf(j));
break;
@@ -150,6 +194,12 @@ public class TestWeakIdentityMap extends
// renew key, the old one will be GCed at some time:
keys.set(j, new Object());
break;
+ case 4:
+ // check iterator still working
+ for (Iterator<Object> it = map.keyIterator(); it.hasNext();) {
+ assertNotNull(it.next());
+ }
+ break;
default:
fail("Should not get here.");
}
@@ -173,7 +223,13 @@ public class TestWeakIdentityMap extends
System.runFinalization();
System.gc();
Thread.sleep(100L);
- assertTrue(size >= map.size());
+ int c = 0;
+ for (Iterator<Object> it = map.keyIterator(); it.hasNext();) {
+ assertNotNull(it.next());
+ c++;
+ }
+ assertTrue(size >= c);
+ assertTrue(c >= map.size());
size = map.size();
} catch (InterruptedException ie) {}
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/automaton/TestBasicOperations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/automaton/TestBasicOperations.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/automaton/TestBasicOperations.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/automaton/TestBasicOperations.java Thu Jul 19 15:58:54 2012
@@ -17,10 +17,35 @@ package org.apache.lucene.util.automaton
* limitations under the License.
*/
-import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.UnicodeUtil;
+import java.util.*;
+
+import org.apache.lucene.util.*;
+
+import com.carrotsearch.randomizedtesting.generators.RandomInts;
+
+public class TestBasicOperations extends LuceneTestCase {
+ /** Test string union. */
+ public void testStringUnion() {
+ List<BytesRef> strings = new ArrayList<BytesRef>();
+ for (int i = RandomInts.randomIntBetween(random(), 0, 1000); --i >= 0;) {
+ strings.add(new BytesRef(_TestUtil.randomUnicodeString(random())));
+ }
+
+ Collections.sort(strings);
+ Automaton union = BasicAutomata.makeStringUnion(strings);
+ assertTrue(union.isDeterministic());
+ assertTrue(BasicOperations.sameLanguage(union, naiveUnion(strings)));
+ }
+
+ private static Automaton naiveUnion(List<BytesRef> strings) {
+ Automaton [] eachIndividual = new Automaton [strings.size()];
+ int i = 0;
+ for (BytesRef bref : strings) {
+ eachIndividual[i++] = BasicAutomata.makeString(bref.utf8ToString());
+ }
+ return BasicOperations.union(Arrays.asList(eachIndividual));
+ }
-public class TestBasicOperations extends LuceneTestCase {
/** Test optimization to concatenate() */
public void testSingletonConcatenate() {
Automaton singleton = BasicAutomata.makeString("prefix");
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java Thu Jul 19 15:58:54 2012
@@ -53,6 +53,7 @@ import org.apache.lucene.store.MockDirec
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IntsRef;
import org.apache.lucene.util.LineFileDocs;
+import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.UnicodeUtil;
@@ -67,6 +68,7 @@ import org.apache.lucene.util.fst.PairOu
import org.apache.lucene.util.packed.PackedInts;
@SuppressCodecs({ "SimpleText", "Memory" })
+@Slow
public class TestFSTs extends LuceneTestCase {
private MockDirectoryWrapper dir;
@@ -1296,7 +1298,7 @@ public class TestFSTs extends LuceneTest
ord++;
if (ord % 500000 == 0) {
System.out.println(
- String.format(Locale.ENGLISH,
+ String.format(Locale.ROOT,
"%6.2fs: %9d...", ((System.currentTimeMillis() - tStart) / 1000.0), ord));
}
if (ord >= limit) {
@@ -1635,7 +1637,7 @@ public class TestFSTs extends LuceneTest
String idString;
if (cycle == 0) {
// PKs are assigned sequentially
- idString = String.format("%07d", id);
+ idString = String.format(Locale.ROOT, "%07d", id);
} else {
while(true) {
final String s = Long.toString(random().nextLong());
@@ -1666,7 +1668,7 @@ public class TestFSTs extends LuceneTest
for(int idx=0;idx<NUM_IDS/10;idx++) {
String idString;
if (cycle == 0) {
- idString = String.format("%07d", (NUM_IDS + idx));
+ idString = String.format(Locale.ROOT, "%07d", (NUM_IDS + idx));
} else {
while(true) {
idString = Long.toString(random().nextLong());
@@ -1708,8 +1710,8 @@ public class TestFSTs extends LuceneTest
exists = false;
final int idv = random().nextInt(NUM_IDS-1);
if (cycle == 0) {
- id = String.format("%07da", idv);
- nextID = String.format("%07d", idv+1);
+ id = String.format(Locale.ROOT, "%07da", idv);
+ nextID = String.format(Locale.ROOT, "%07d", idv+1);
} else {
id = sortedAllIDsList.get(idv) + "a";
nextID = sortedAllIDsList.get(idv+1);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java Thu Jul 19 15:58:54 2012
@@ -293,7 +293,7 @@ public class TestReproduceMessage extend
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
}
- private String runAndReturnSyserr() throws Exception {
+ private String runAndReturnSyserr() {
JUnitCore.runClasses(Nested.class);
String err = getSysErr();
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSameRandomnessLocalePassedOrNot.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSameRandomnessLocalePassedOrNot.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSameRandomnessLocalePassedOrNot.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSameRandomnessLocalePassedOrNot.java Thu Jul 19 15:58:54 2012
@@ -39,7 +39,7 @@ public class TestSameRandomnessLocalePas
RuleChain.outerRule(new SystemPropertiesRestoreRule());
public TestSameRandomnessLocalePassedOrNot() {
- super(false);
+ super(true);
}
public static class Nested extends WithNestedTests.AbstractNestedTest {
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java Thu Jul 19 15:58:54 2012
@@ -20,22 +20,27 @@ package org.apache.lucene.util.packed;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.Random;
+import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.store.*;
+import org.apache.lucene.util.LongsRef;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.util.packed.PackedInts.Reader;
+@Slow
public class TestPackedInts extends LuceneTestCase {
- public void testBitsRequired() throws Exception {
+ public void testBitsRequired() {
assertEquals(61, PackedInts.bitsRequired((long)Math.pow(2, 61)-1));
assertEquals(61, PackedInts.bitsRequired(0x1FFFFFFFFFFFFFFFL));
assertEquals(62, PackedInts.bitsRequired(0x3FFFFFFFFFFFFFFFL));
assertEquals(63, PackedInts.bitsRequired(0x7FFFFFFFFFFFFFFFL));
}
- public void testMaxValues() throws Exception {
+ public void testMaxValues() {
assertEquals("1 bit -> max == 1",
1, PackedInts.maxValue(1));
assertEquals("2 bit -> max == 3",
@@ -49,25 +54,59 @@ public class TestPackedInts extends Luce
}
public void testPackedInts() throws IOException {
- int num = atLeast(5);
+ int num = atLeast(3);
for (int iter = 0; iter < num; iter++) {
- for(int nbits=1;nbits<63;nbits++) {
+ for(int nbits=1;nbits<=64;nbits++) {
final long maxValue = PackedInts.maxValue(nbits);
- final int valueCount = 100+random().nextInt(500);
+ final int valueCount = _TestUtil.nextInt(random(), 1, 600);
+ final int bufferSize = random().nextBoolean()
+ ? _TestUtil.nextInt(random(), 0, 48)
+ : _TestUtil.nextInt(random(), 0, 4096);
final Directory d = newDirectory();
IndexOutput out = d.createOutput("out.bin", newIOContext(random()));
PackedInts.Writer w = PackedInts.getWriter(
- out, valueCount, nbits, random().nextFloat()*PackedInts.FASTEST);
+ out, valueCount, nbits, random().nextFloat());
+ final long startFp = out.getFilePointer();
+ final int actualValueCount = random().nextBoolean() ? valueCount : _TestUtil.nextInt(random(), 0, valueCount);
final long[] values = new long[valueCount];
- for(int i=0;i<valueCount;i++) {
+ for(int i=0;i<actualValueCount;i++) {
values[i] = _TestUtil.nextLong(random(), 0, maxValue);
w.add(values[i]);
}
w.finish();
final long fp = out.getFilePointer();
out.close();
+
+ // packed writers should only write longs
+ assertEquals(0, (fp - startFp) % 8);
+ // ensure that finish() added the (valueCount-actualValueCount) missing values
+ final long bytes;
+ switch (w.getFormat()) {
+ case PACKED:
+ bytes = (long) Math.ceil((double) valueCount * w.bitsPerValue / 64) << 3;
+ break;
+ case PACKED_SINGLE_BLOCK:
+ final int valuesPerBlock = 64 / w.bitsPerValue;
+ bytes = (long) Math.ceil((double) valueCount / valuesPerBlock) << 3;
+ break;
+ default:
+ bytes = -1;
+ }
+ assertEquals(bytes, fp - startFp);
+
+ {// test header
+ IndexInput in = d.openInput("out.bin", newIOContext(random()));
+ // header = codec header | bitsPerValue | valueCount | format
+ CodecUtil.checkHeader(in, PackedInts.CODEC_NAME, PackedInts.VERSION_START, PackedInts.VERSION_CURRENT); // codec header
+ assertEquals(w.bitsPerValue, in.readVInt());
+ assertEquals(valueCount, in.readVInt());
+ assertEquals(w.getFormat().getId(), in.readVInt());
+ assertEquals(startFp, in.getFilePointer());
+ in.close();
+ }
+
{// test reader
IndexInput in = d.openInput("out.bin", newIOContext(random()));
PackedInts.Reader r = PackedInts.getReader(in);
@@ -79,37 +118,34 @@ public class TestPackedInts extends Luce
}
in.close();
}
+
{ // test reader iterator next
IndexInput in = d.openInput("out.bin", newIOContext(random()));
- PackedInts.ReaderIterator r = PackedInts.getReaderIterator(in);
+ PackedInts.ReaderIterator r = PackedInts.getReaderIterator(in, bufferSize);
for(int i=0;i<valueCount;i++) {
assertEquals("index=" + i + " valueCount="
+ valueCount + " nbits=" + nbits + " for "
+ r.getClass().getSimpleName(), values[i], r.next());
+ assertEquals(i, r.ord());
}
assertEquals(fp, in.getFilePointer());
in.close();
}
- { // test reader iterator next vs. advance
+
+ { // test reader iterator bulk next
IndexInput in = d.openInput("out.bin", newIOContext(random()));
- PackedInts.ReaderIterator intsEnum = PackedInts.getReaderIterator(in);
- for (int i = 0; i < valueCount; i +=
- 1 + ((valueCount - i) <= 20 ? random().nextInt(valueCount - i)
- : random().nextInt(20))) {
- final String msg = "index=" + i + " valueCount="
- + valueCount + " nbits=" + nbits + " for "
- + intsEnum.getClass().getSimpleName();
- if (i - intsEnum.ord() == 1 && random().nextBoolean()) {
- assertEquals(msg, values[i], intsEnum.next());
- } else {
- assertEquals(msg, values[i], intsEnum.advance(i));
+ PackedInts.ReaderIterator r = PackedInts.getReaderIterator(in, bufferSize);
+ int i = 0;
+ while (i < valueCount) {
+ final int count = _TestUtil.nextInt(random(), 1, 95);
+ final LongsRef next = r.next(count);
+ for (int k = 0; k < next.length; ++k) {
+ assertEquals("index=" + i + " valueCount="
+ + valueCount + " nbits=" + nbits + " for "
+ + r.getClass().getSimpleName(), values[i + k], next.longs[next.offset + k]);
}
- assertEquals(msg, i, intsEnum.ord());
+ i += next.length;
}
- if (intsEnum.ord() < valueCount - 1)
- assertEquals(values[valueCount - 1], intsEnum
- .advance(valueCount - 1));
- assertEquals(valueCount - 1, intsEnum.ord());
assertEquals(fp, in.getFilePointer());
in.close();
}
@@ -147,7 +183,7 @@ public class TestPackedInts extends Luce
}
public void testRandomBulkCopy() {
- final int numIters = atLeast(10);
+ final int numIters = atLeast(3);
for(int iter=0;iter<numIters;iter++) {
if (VERBOSE) {
System.out.println("\nTEST: iter=" + iter);
@@ -176,8 +212,8 @@ public class TestPackedInts extends Luce
final long[] buffer = new long[valueCount];
- // Copy random slice over, 100 times:
- for(int iter2=0;iter2<100;iter2++) {
+ // Copy random slice over, 20 times:
+ for(int iter2=0;iter2<20;iter2++) {
int start = random().nextInt(valueCount-1);
int len = _TestUtil.nextInt(random(), 1, valueCount-start);
int offset;
@@ -212,27 +248,26 @@ public class TestPackedInts extends Luce
}
public void testRandomEquality() {
- final int[] VALUE_COUNTS = new int[]{0, 1, 5, 8, 100, 500};
- final int MIN_BITS_PER_VALUE = 1;
- final int MAX_BITS_PER_VALUE = 64;
-
- for (int valueCount: VALUE_COUNTS) {
- for (int bitsPerValue = MIN_BITS_PER_VALUE ;
- bitsPerValue <= MAX_BITS_PER_VALUE ;
+ final int numIters = atLeast(2);
+ for (int i = 0; i < numIters; ++i) {
+ final int valueCount = _TestUtil.nextInt(random(), 1, 300);
+
+ for (int bitsPerValue = 1 ;
+ bitsPerValue <= 64 ;
bitsPerValue++) {
assertRandomEquality(valueCount, bitsPerValue, random().nextLong());
}
}
}
- private void assertRandomEquality(int valueCount, int bitsPerValue, long randomSeed) {
+ private static void assertRandomEquality(int valueCount, int bitsPerValue, long randomSeed) {
List<PackedInts.Mutable> packedInts = createPackedInts(valueCount, bitsPerValue);
for (PackedInts.Mutable packedInt: packedInts) {
try {
fill(packedInt, PackedInts.maxValue(bitsPerValue), randomSeed);
} catch (Exception e) {
e.printStackTrace(System.err);
- fail(String.format(
+ fail(String.format(Locale.ROOT,
"Exception while filling %s: valueCount=%d, bitsPerValue=%s",
packedInt.getClass().getSimpleName(),
valueCount, bitsPerValue));
@@ -241,7 +276,7 @@ public class TestPackedInts extends Luce
assertListEquality(packedInts);
}
- private List<PackedInts.Mutable> createPackedInts(
+ private static List<PackedInts.Mutable> createPackedInts(
int valueCount, int bitsPerValue) {
List<PackedInts.Mutable> packedInts = new ArrayList<PackedInts.Mutable>();
if (bitsPerValue <= 8) {
@@ -271,24 +306,24 @@ public class TestPackedInts extends Luce
return packedInts;
}
- private void fill(PackedInts.Mutable packedInt, long maxValue, long randomSeed) {
+ private static void fill(PackedInts.Mutable packedInt, long maxValue, long randomSeed) {
Random rnd2 = new Random(randomSeed);
for (int i = 0 ; i < packedInt.size() ; i++) {
long value = _TestUtil.nextLong(rnd2, 0, maxValue);
packedInt.set(i, value);
- assertEquals(String.format(
+ assertEquals(String.format(Locale.ROOT,
"The set/get of the value at index %d should match for %s",
i, packedInt.getClass().getSimpleName()),
value, packedInt.get(i));
}
}
- private void assertListEquality(
+ private static void assertListEquality(
List<? extends PackedInts.Reader> packedInts) {
assertListEquality("", packedInts);
}
- private void assertListEquality(
+ private static void assertListEquality(
String message, List<? extends PackedInts.Reader> packedInts) {
if (packedInts.size() == 0) {
return;
@@ -301,7 +336,7 @@ public class TestPackedInts extends Luce
}
for (int i = 0 ; i < valueCount ; i++) {
for (int j = 1 ; j < packedInts.size() ; j++) {
- assertEquals(String.format(
+ assertEquals(String.format(Locale.ROOT,
"%s. The value at index %d should be the same for %s and %s",
message, i, base.getClass().getSimpleName(),
packedInts.get(j).getClass().getSimpleName()),
@@ -333,7 +368,7 @@ public class TestPackedInts extends Luce
}
}
- public void testSecondaryBlockChange() throws IOException {
+ public void testSecondaryBlockChange() {
PackedInts.Mutable mutable = new Packed64(26, 5);
mutable.set(24, 31);
assertEquals("The value #24 should be correct", 31, mutable.get(24));
@@ -368,21 +403,17 @@ public class TestPackedInts extends Luce
p64 = null;
}
- for (int bits = 1; bits <=64; ++bits) {
- if (Packed64SingleBlock.isSupported(bits)) {
- int index = Integer.MAX_VALUE / bits + (bits == 1 ? 0 : 1);
- Packed64SingleBlock p64sb = null;
- try {
- p64sb = Packed64SingleBlock.create(index, bits);
- } catch (OutOfMemoryError oome) {
- // Ignore: see comment above
- continue;
- }
- p64sb.set(index - 1, 1);
- assertEquals("The value at position " + (index-1)
- + " should be correct for " + p64sb.getClass().getSimpleName(),
- 1, p64sb.get(index-1));
- }
+ Packed64SingleBlock p64sb = null;
+ try {
+ p64sb = Packed64SingleBlock.create(INDEX, BITS);
+ } catch (OutOfMemoryError oome) {
+ // Ignore: see comment above
+ }
+ if (p64sb != null) {
+ p64sb.set(INDEX - 1, 1);
+ assertEquals("The value at position " + (INDEX-1)
+ + " should be correct for " + p64sb.getClass().getSimpleName(),
+ 1, p64sb.get(INDEX-1));
}
int index = Integer.MAX_VALUE / 24 + 1;
@@ -505,7 +536,7 @@ public class TestPackedInts extends Luce
}
public void testCopy() {
- final int valueCount = 689;
+ final int valueCount = _TestUtil.nextInt(random(), 5, 600);
final int off1 = random().nextInt(valueCount);
final int off2 = random().nextInt(valueCount);
final int len = random().nextInt(Math.min(valueCount - off1, valueCount - off2));
Modified: lucene/dev/branches/pforcodec_3892/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java Thu Jul 19 15:58:54 2012
@@ -37,7 +37,6 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
@@ -49,6 +48,7 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.Version;
/**
@@ -126,13 +126,13 @@ public class FormBasedXmlQueryDemo exten
}
}
- private void openExampleIndex() throws CorruptIndexException, IOException {
+ private void openExampleIndex() throws IOException {
//Create a RAM-based index from our test data file
RAMDirectory rd = new RAMDirectory();
IndexWriterConfig iwConfig = new IndexWriterConfig(Version.LUCENE_40, analyzer);
IndexWriter writer = new IndexWriter(rd, iwConfig);
InputStream dataIn = getServletContext().getResourceAsStream("/WEB-INF/data.tsv");
- BufferedReader br = new BufferedReader(new InputStreamReader(dataIn));
+ BufferedReader br = new BufferedReader(new InputStreamReader(dataIn, IOUtils.CHARSET_UTF_8));
String line = br.readLine();
final FieldType textNoNorms = new FieldType(TextField.TYPE_STORED);
textNoNorms.setOmitNorms(true);
Modified: lucene/dev/branches/pforcodec_3892/lucene/demo/src/test/org/apache/lucene/demo/TestDemo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/demo/src/test/org/apache/lucene/demo/TestDemo.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/demo/src/test/org/apache/lucene/demo/TestDemo.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/demo/src/test/org/apache/lucene/demo/TestDemo.java Thu Jul 19 15:58:54 2012
@@ -20,6 +20,7 @@ package org.apache.lucene.demo;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.PrintStream;
+import java.nio.charset.Charset;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
@@ -30,11 +31,11 @@ public class TestDemo extends LuceneTest
PrintStream outSave = System.out;
try {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- PrintStream fakeSystemOut = new PrintStream(bytes);
+ PrintStream fakeSystemOut = new PrintStream(bytes, false, Charset.defaultCharset().name());
System.setOut(fakeSystemOut);
SearchFiles.main(new String[] {"-query", query, "-index", indexPath.getPath()});
fakeSystemOut.flush();
- String output = bytes.toString(); // intentionally use default encoding
+ String output = bytes.toString(Charset.defaultCharset().name()); // intentionally use default encoding
assertTrue("output=" + output, output.contains(expectedHitCount + " total matching documents"));
} finally {
System.setOut(outSave);
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsCategoryTokenizer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsCategoryTokenizer.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsCategoryTokenizer.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsCategoryTokenizer.java Thu Jul 19 15:58:54 2012
@@ -1,6 +1,5 @@
package org.apache.lucene.facet.enhancements;
-import java.io.IOException;
import java.util.List;
import org.apache.lucene.analysis.TokenStream;
@@ -59,10 +58,9 @@ public class EnhancementsCategoryTokeniz
* The stream of category tokens.
* @param indexingParams
* The indexing params to use.
- * @throws IOException
*/
public EnhancementsCategoryTokenizer(TokenStream input,
- EnhancementsIndexingParams indexingParams) throws IOException {
+ EnhancementsIndexingParams indexingParams) {
super(input, indexingParams);
payloadBytes = new byte[Vint8.MAXIMUM_BYTES_NEEDED
* (indexingParams.getCategoryEnhancements().size() + 1)];
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsDocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsDocumentBuilder.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsDocumentBuilder.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsDocumentBuilder.java Thu Jul 19 15:58:54 2012
@@ -46,10 +46,9 @@ public class EnhancementsDocumentBuilder
* @param taxonomyWriter
* @param params
* Indexing params which include {@link CategoryEnhancement}s.
- * @throws IOException
*/
public EnhancementsDocumentBuilder(TaxonomyWriter taxonomyWriter,
- EnhancementsIndexingParams params) throws IOException {
+ EnhancementsIndexingParams params) {
super(taxonomyWriter, params);
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java Thu Jul 19 15:58:54 2012
@@ -93,11 +93,9 @@ public class CategoryDocumentBuilder {
* @param taxonomyWriter
* to which new categories will be added, as well as translating
* known categories to ordinals
- * @throws IOException
- *
+ *
*/
- public CategoryDocumentBuilder(TaxonomyWriter taxonomyWriter)
- throws IOException {
+ public CategoryDocumentBuilder(TaxonomyWriter taxonomyWriter) {
this(taxonomyWriter, new DefaultFacetIndexingParams());
}
@@ -111,10 +109,9 @@ public class CategoryDocumentBuilder {
* @param params
* holds all parameters the indexing process should use such as
* category-list parameters
- * @throws IOException
*/
public CategoryDocumentBuilder(TaxonomyWriter taxonomyWriter,
- FacetIndexingParams params) throws IOException {
+ FacetIndexingParams params) {
this.taxonomyWriter = taxonomyWriter;
this.indexingParams = params;
this.categoriesMap = new HashMap<String, List<CategoryAttribute>>();
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/index/streaming/CategoryAttributesStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/index/streaming/CategoryAttributesStream.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/index/streaming/CategoryAttributesStream.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/index/streaming/CategoryAttributesStream.java Thu Jul 19 15:58:54 2012
@@ -1,6 +1,5 @@
package org.apache.lucene.facet.index.streaming;
-import java.io.IOException;
import java.util.Iterator;
import org.apache.lucene.analysis.TokenStream;
@@ -59,7 +58,7 @@ public class CategoryAttributesStream ex
}
@Override
- public final boolean incrementToken() throws IOException {
+ public final boolean incrementToken() {
if (iterator == null) {
if (iterable == null) {
return false;
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/search/ScoredDocIdCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/search/ScoredDocIdCollector.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/search/ScoredDocIdCollector.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/search/ScoredDocIdCollector.java Thu Jul 19 15:58:54 2012
@@ -51,7 +51,7 @@ public abstract class ScoredDocIdCollect
public boolean acceptsDocsOutOfOrder() { return true; }
@Override
- public void collect(int doc) throws IOException {
+ public void collect(int doc) {
docIds.fastSet(docBase + doc);
++numDocIds;
}
@@ -62,7 +62,7 @@ public abstract class ScoredDocIdCollect
}
@Override
- public ScoredDocIDsIterator scoredDocIdsIterator() throws IOException {
+ public ScoredDocIDsIterator scoredDocIdsIterator() {
return new ScoredDocIDsIterator() {
private DocIdSetIterator docIdsIter = docIds.iterator();
@@ -92,7 +92,7 @@ public abstract class ScoredDocIdCollect
}
@Override
- public void setScorer(Scorer scorer) throws IOException {}
+ public void setScorer(Scorer scorer) {}
}
private static final class ScoringDocIdCollector extends ScoredDocIdCollector {
@@ -124,7 +124,7 @@ public abstract class ScoredDocIdCollect
}
@Override
- public ScoredDocIDsIterator scoredDocIdsIterator() throws IOException {
+ public ScoredDocIDsIterator scoredDocIdsIterator() {
return new ScoredDocIDsIterator() {
private DocIdSetIterator docIdsIter = docIds.iterator();
@@ -160,7 +160,7 @@ public abstract class ScoredDocIdCollect
public void setDefaultScore(float defaultScore) {}
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/search/TotalFacetCounts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/search/TotalFacetCounts.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/search/TotalFacetCounts.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/search/TotalFacetCounts.java Thu Jul 19 15:58:54 2012
@@ -12,7 +12,6 @@ import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.facet.index.params.CategoryListParams;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
@@ -73,7 +72,7 @@ public class TotalFacetCounts {
* Construct by key - from index Directory or by recomputing.
*/
private TotalFacetCounts (TaxonomyReader taxonomy, FacetIndexingParams facetIndexingParams,
- int[][] counts, CreationType createType4Test) throws IOException, LockObtainFailedException {
+ int[][] counts, CreationType createType4Test) {
this.taxonomy = taxonomy;
this.facetIndexingParams = facetIndexingParams;
this.totalCounts = counts;
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java Thu Jul 19 15:58:54 2012
@@ -1013,7 +1013,7 @@ public class CategoryPath implements Ser
osw.flush();
}
- private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(java.io.ObjectInputStream in) throws IOException {
InputStreamReader isr = new InputStreamReader(in, "UTF-8");
this.deserializeFromStreamReader(isr);
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyWriter.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyWriter.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyWriter.java Thu Jul 19 15:58:54 2012
@@ -3,7 +3,7 @@ package org.apache.lucene.facet.taxonomy
import java.io.Closeable;
import java.io.IOException;
-import org.apache.lucene.util.TwoPhaseCommit;
+import org.apache.lucene.index.TwoPhaseCommit;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java Thu Jul 19 15:58:54 2012
@@ -1,7 +1,5 @@
package org.apache.lucene.facet.taxonomy.directory;
-import java.io.IOException;
-
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.StoredFieldVisitor;
@@ -41,12 +39,12 @@ abstract class Consts {
private String fullPath;
@Override
- public void stringField(FieldInfo fieldInfo, String value) throws IOException {
+ public void stringField(FieldInfo fieldInfo, String value) {
fullPath = value;
}
@Override
- public Status needsField(FieldInfo fieldInfo) throws IOException {
+ public Status needsField(FieldInfo fieldInfo) {
return fullPath == null ? Status.YES : Status.STOP;
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java Thu Jul 19 15:58:54 2012
@@ -127,7 +127,7 @@ public class DirectoryTaxonomyReader imp
parentArray.refresh(indexReader);
}
- protected DirectoryReader openIndexReader(Directory directory) throws CorruptIndexException, IOException {
+ protected DirectoryReader openIndexReader(Directory directory) throws IOException {
return DirectoryReader.open(directory);
}
@@ -218,7 +218,7 @@ public class DirectoryTaxonomyReader imp
return ret;
}
- public CategoryPath getPath(int ordinal) throws CorruptIndexException, IOException {
+ public CategoryPath getPath(int ordinal) throws IOException {
ensureOpen();
// TODO (Facet): Currently, the LRU cache we use (getCategoryCache) holds
// strings with delimiters, not CategoryPath objects, so even if
@@ -235,7 +235,7 @@ public class DirectoryTaxonomyReader imp
return new CategoryPath(label, delimiter);
}
- public boolean getPath(int ordinal, CategoryPath result) throws CorruptIndexException, IOException {
+ public boolean getPath(int ordinal, CategoryPath result) throws IOException {
ensureOpen();
String label = getLabel(ordinal);
if (label==null) {
@@ -246,7 +246,7 @@ public class DirectoryTaxonomyReader imp
return true;
}
- private String getLabel(int catID) throws CorruptIndexException, IOException {
+ private String getLabel(int catID) throws IOException {
ensureOpen();
// First try to find the answer in the LRU cache. It is very
// unfortunate that we need to allocate an Integer object here -
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java Thu Jul 19 15:58:54 2012
@@ -312,7 +312,7 @@ public class DirectoryTaxonomyWriter imp
* {@link #defaultTaxonomyWriterCache()}.
*/
public DirectoryTaxonomyWriter(Directory directory, OpenMode openMode)
- throws CorruptIndexException, LockObtainFailedException, IOException {
+ throws IOException {
this(directory, openMode, defaultTaxonomyWriterCache());
}
@@ -330,9 +330,7 @@ public class DirectoryTaxonomyWriter imp
// convenience constructors:
- public DirectoryTaxonomyWriter(Directory d)
- throws CorruptIndexException, LockObtainFailedException,
- IOException {
+ public DirectoryTaxonomyWriter(Directory d) throws IOException {
this(d, OpenMode.CREATE_OR_APPEND);
}
@@ -342,14 +340,14 @@ public class DirectoryTaxonomyWriter imp
* {@link Directory}.
*/
@Override
- public synchronized void close() throws CorruptIndexException, IOException {
+ public synchronized void close() throws IOException {
if (!isClosed) {
indexWriter.commit(combinedCommitData(null));
doClose();
}
}
- private void doClose() throws CorruptIndexException, IOException {
+ private void doClose() throws IOException {
indexWriter.close();
isClosed = true;
closeResources();
@@ -656,7 +654,7 @@ public class DirectoryTaxonomyWriter imp
* See {@link TaxonomyWriter#commit()}
*/
@Override
- public synchronized void commit() throws CorruptIndexException, IOException {
+ public synchronized void commit() throws IOException {
ensureOpen();
indexWriter.commit(combinedCommitData(null));
}
@@ -681,7 +679,7 @@ public class DirectoryTaxonomyWriter imp
* See {@link TaxonomyWriter#commit(Map)}.
*/
@Override
- public synchronized void commit(Map<String,String> commitUserData) throws CorruptIndexException, IOException {
+ public synchronized void commit(Map<String,String> commitUserData) throws IOException {
ensureOpen();
indexWriter.commit(combinedCommitData(commitUserData));
}
@@ -691,7 +689,7 @@ public class DirectoryTaxonomyWriter imp
* See {@link IndexWriter#prepareCommit}.
*/
@Override
- public synchronized void prepareCommit() throws CorruptIndexException, IOException {
+ public synchronized void prepareCommit() throws IOException {
ensureOpen();
indexWriter.prepareCommit(combinedCommitData(null));
}
@@ -701,7 +699,7 @@ public class DirectoryTaxonomyWriter imp
* See {@link IndexWriter#prepareCommit(Map)}
*/
@Override
- public synchronized void prepareCommit(Map<String,String> commitUserData) throws CorruptIndexException, IOException {
+ public synchronized void prepareCommit(Map<String,String> commitUserData) throws IOException {
ensureOpen();
indexWriter.prepareCommit(combinedCommitData(commitUserData));
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/ParentArray.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/ParentArray.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/ParentArray.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/ParentArray.java Thu Jul 19 15:58:54 2012
@@ -147,7 +147,7 @@ class ParentArray {
* NOTE: add() and refresh() CANNOT be used together. If you call add(),
* this changes the arrays and refresh() can no longer be used.
*/
- void add(int ordinal, int parentOrdinal) throws IOException {
+ void add(int ordinal, int parentOrdinal) {
if (ordinal >= prefetchParentOrdinal.length) {
// grow the array, if necessary.
// In Java 6, we could just do Arrays.copyOf()...
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/util/ScoredDocIdsUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/util/ScoredDocIdsUtils.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/util/ScoredDocIdsUtils.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/facet/util/ScoredDocIdsUtils.java Thu Jul 19 15:58:54 2012
@@ -125,13 +125,13 @@ public class ScoredDocIdsUtils {
public boolean isCacheable() { return true; }
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
return new DocIdSetIterator() {
private int next = -1;
@Override
- public int advance(int target) throws IOException {
+ public int advance(int target) {
while (next < size && docids[next++] < target) {
}
return next == size ? NO_MORE_DOCS : docids[next];
@@ -143,7 +143,7 @@ public class ScoredDocIdsUtils {
}
@Override
- public int nextDoc() throws IOException {
+ public int nextDoc() {
if (++next >= size) {
return NO_MORE_DOCS;
}
@@ -155,7 +155,7 @@ public class ScoredDocIdsUtils {
};
}
- public ScoredDocIDsIterator iterator() throws IOException {
+ public ScoredDocIDsIterator iterator() {
return new ScoredDocIDsIterator() {
int next = -1;
@@ -251,12 +251,12 @@ public class ScoredDocIdsUtils {
}
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
return new DocIdSetIterator() {
private int next = -1;
@Override
- public int advance(int target) throws IOException {
+ public int advance(int target) {
if (target <= next) {
target = next + 1;
}
@@ -270,7 +270,7 @@ public class ScoredDocIdsUtils {
}
@Override
- public int nextDoc() throws IOException {
+ public int nextDoc() {
return ++next < maxDoc ? next : NO_MORE_DOCS;
}
@@ -337,13 +337,13 @@ public class ScoredDocIdsUtils {
}
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
return new DocIdSetIterator() {
final Bits liveDocs = MultiFields.getLiveDocs(reader);
private int next = -1;
@Override
- public int advance(int target) throws IOException {
+ public int advance(int target) {
if (target > next) {
next = target - 1;
}
@@ -356,7 +356,7 @@ public class ScoredDocIdsUtils {
}
@Override
- public int nextDoc() throws IOException {
+ public int nextDoc() {
do {
++next;
} while (next < maxDoc && liveDocs != null && !liveDocs.get(next));
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ArrayHashMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ArrayHashMap.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ArrayHashMap.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ArrayHashMap.java Thu Jul 19 15:58:54 2012
@@ -389,10 +389,8 @@ public class ArrayHashMap<K,V> implement
/** Prints the baseHash array, used for debugging purposes. */
@SuppressWarnings("unused")
- private void printBaseHash() {
- for (int i : baseHash) {
- System.out.println(i + ".\t" + i);
- }
+ private String getBaseHashAsString() {
+ return Arrays.toString(this.baseHash);
}
/**
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/FloatToObjectMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/FloatToObjectMap.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/FloatToObjectMap.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/FloatToObjectMap.java Thu Jul 19 15:58:54 2012
@@ -462,10 +462,8 @@ public class FloatToObjectMap<T> impleme
* Prints the baseHash array, used for DEBUG purposes.
*/
@SuppressWarnings("unused")
- private void printBaseHash() {
- for (int i = 0; i < this.baseHash.length; i++) {
- System.out.println(i + ".\t" + baseHash[i]);
- }
+ private String getBaseHashAsString() {
+ return Arrays.toString(this.baseHash);
}
/**
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntHashSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntHashSet.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntHashSet.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntHashSet.java Thu Jul 19 15:58:54 2012
@@ -389,12 +389,9 @@ public class IntHashSet {
/**
* Prints the baseHash array, used for debug purposes.
*/
- public void printBaseHash() {
- for (int i = 0; i < this.baseHash.length; i++) {
- if (baseHash[i] != 0) {
- System.out.println(i + ".\t" + baseHash[i]);
- }
- }
+ @SuppressWarnings("unused")
+ private String getBaseHashAsString() {
+ return Arrays.toString(this.baseHash);
}
/**
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToDoubleMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToDoubleMap.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToDoubleMap.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToDoubleMap.java Thu Jul 19 15:58:54 2012
@@ -461,10 +461,8 @@ public class IntToDoubleMap {
* Prints the baseHash array, used for debug purposes.
*/
@SuppressWarnings("unused")
- private void printBaseHash() {
- for (int i = 0; i < this.baseHash.length; i++) {
- System.out.println(i + ".\t" + baseHash[i]);
- }
+ private String getBaseHashAsString() {
+ return Arrays.toString(this.baseHash);
}
/**
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToIntMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToIntMap.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToIntMap.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToIntMap.java Thu Jul 19 15:58:54 2012
@@ -458,10 +458,8 @@ public class IntToIntMap {
* Prints the baseHash array, used for debug purposes.
*/
@SuppressWarnings("unused")
- private void printBaseHash() {
- for (int i = 0; i < this.baseHash.length; i++) {
- System.out.println(i + ".\t" + baseHash[i]);
- }
+ private String getBaseHashAsString() {
+ return Arrays.toString(this.baseHash);
}
/**
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToObjectMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToObjectMap.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToObjectMap.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/IntToObjectMap.java Thu Jul 19 15:58:54 2012
@@ -462,10 +462,8 @@ public class IntToObjectMap<T> implement
* Prints the baseHash array, used for debug purposes.
*/
@SuppressWarnings("unused")
- private void printBaseHash() {
- for (int i = 0; i < this.baseHash.length; i++) {
- System.out.println(i + ".\t" + baseHash[i]);
- }
+ private String getBaseHashAsString() {
+ return Arrays.toString(baseHash);
}
/**
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToFloatMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToFloatMap.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToFloatMap.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToFloatMap.java Thu Jul 19 15:58:54 2012
@@ -463,10 +463,8 @@ public class ObjectToFloatMap<K> {
* Prints the baseHash array, used for debug purposes.
*/
@SuppressWarnings("unused")
- private void printBaseHash() {
- for (int i = 0; i < this.baseHash.length; i++) {
- System.out.println(i + ".\t" + baseHash[i]);
- }
+ private String getBaseHashAsString() {
+ return Arrays.toString(baseHash);
}
/**
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToIntMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToIntMap.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToIntMap.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToIntMap.java Thu Jul 19 15:58:54 2012
@@ -462,10 +462,8 @@ public class ObjectToIntMap<K> {
* Prints the baseHash array, used for debug purposes.
*/
@SuppressWarnings("unused")
- private void printBaseHash() {
- for (int i = 0; i < this.baseHash.length; i++) {
- System.out.println(i + ".\t" + baseHash[i]);
- }
+ private String getBaseHashAsString() {
+ return Arrays.toString(baseHash);
}
/**
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/FacetTestBase.java Thu Jul 19 15:58:54 2012
@@ -15,7 +15,6 @@ import org.apache.lucene.analysis.MockTo
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader;
@@ -92,7 +91,7 @@ public abstract class FacetTestBase exte
protected IndexSearcher searcher;
@BeforeClass
- public static void beforeClassFacetTestBase() throws Exception {
+ public static void beforeClassFacetTestBase() {
TEST_DIR = _TestUtil.getTempDir("facets");
dirsPerPartitionSize = new HashMap<Integer, FacetTestBase.SearchTaxoDirPair>();
}
@@ -215,7 +214,7 @@ public abstract class FacetTestBase exte
* <p>Subclasses can override this to test different scenarios
*/
protected void populateIndex(RandomIndexWriter iw, TaxonomyWriter taxo, FacetIndexingParams iParams)
- throws IOException, CorruptIndexException {
+ throws IOException {
// add test documents
int numDocsToIndex = numDocsToIndex();
for (int doc=0; doc<numDocsToIndex; doc++) {
@@ -257,8 +256,7 @@ public abstract class FacetTestBase exte
/** utility Create a dummy document with specified categories and content */
protected final void indexDoc(FacetIndexingParams iParams, RandomIndexWriter iw,
- TaxonomyWriter tw, String content, List<CategoryPath> categories) throws IOException,
- CorruptIndexException {
+ TaxonomyWriter tw, String content, List<CategoryPath> categories) throws IOException {
Document d = new Document();
CategoryDocumentBuilder builder = new CategoryDocumentBuilder(tw, iParams);
builder.setCategoryPaths(categories);
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java Thu Jul 19 15:58:54 2012
@@ -8,7 +8,6 @@ import org.apache.lucene.analysis.standa
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
@@ -53,7 +52,7 @@ import org.apache.lucene.facet.taxonomy.
public class FacetTestUtils {
- public static Directory[][] createIndexTaxonomyDirs(int number) throws IOException {
+ public static Directory[][] createIndexTaxonomyDirs(int number) {
Directory[][] dirs = new Directory[number][2];
for (int i = 0; i < number; i++) {
dirs[i][0] = LuceneTestCase.newDirectory();
@@ -93,8 +92,7 @@ public class FacetTestUtils {
public static Collector[] search(IndexSearcher searcher,
TaxonomyReader taxonomyReader, DefaultFacetIndexingParams iParams,
- int k, String... facetNames) throws IOException,
- IllegalAccessException, InstantiationException {
+ int k, String... facetNames) throws IOException {
Collector[] collectors = new Collector[2];
@@ -121,8 +119,7 @@ public class FacetTestUtils {
}
public static void add(FacetIndexingParams iParams, RandomIndexWriter iw,
- TaxonomyWriter tw, String... strings) throws IOException,
- CorruptIndexException {
+ TaxonomyWriter tw, String... strings) throws IOException {
ArrayList<CategoryPath> cps = new ArrayList<CategoryPath>();
CategoryPath cp = new CategoryPath(strings);
cps.add(cp);
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/example/TestMultiCLExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/example/TestMultiCLExample.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/example/TestMultiCLExample.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/example/TestMultiCLExample.java Thu Jul 19 15:58:54 2012
@@ -6,7 +6,6 @@ import java.util.List;
import org.junit.Test;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.facet.example.ExampleResult;
import org.apache.lucene.facet.example.multiCL.MultiCLMain;
import org.apache.lucene.facet.search.results.FacetResult;
import org.apache.lucene.facet.search.results.FacetResultNode;
@@ -40,8 +39,7 @@ public class TestMultiCLExample extends
assertCorrectMultiResults(res);
}
- public static void assertCorrectMultiResults(ExampleResult exampleResults)
- throws Exception {
+ public static void assertCorrectMultiResults(ExampleResult exampleResults) {
List<FacetResult> results = exampleResults.getFacetResults();
FacetResult result = results.get(0);
assertNotNull("Result should not be null", result);
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java Thu Jul 19 15:58:54 2012
@@ -15,9 +15,6 @@ import org.apache.lucene.facet.index.cat
import org.apache.lucene.facet.index.categorypolicy.PathPolicy;
import org.apache.lucene.facet.index.params.DefaultFacetIndexingParams;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
-import org.apache.lucene.facet.index.streaming.CategoryAttributesStream;
-import org.apache.lucene.facet.index.streaming.CategoryListTokenizer;
-import org.apache.lucene.facet.index.streaming.CategoryParentsStream;
import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
@@ -116,7 +113,7 @@ public class CategoryParentsStreamTest e
* @throws FacetException
*/
@Test
- public void testNoRetainableAttributes() throws IOException, FacetException {
+ public void testNoRetainableAttributes() throws IOException {
Directory directory = newDirectory();
TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter(directory);
@@ -150,7 +147,7 @@ public class CategoryParentsStreamTest e
* @throws FacetException
*/
@Test
- public void testRetainableAttributes() throws IOException, FacetException {
+ public void testRetainableAttributes() throws IOException {
Directory directory = newDirectory();
TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter(
directory);
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/AdaptiveAccumulatorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/AdaptiveAccumulatorTest.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/AdaptiveAccumulatorTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/AdaptiveAccumulatorTest.java Thu Jul 19 15:58:54 2012
@@ -1,6 +1,7 @@
package org.apache.lucene.facet.search;
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.facet.search.params.FacetSearchParams;
import org.apache.lucene.facet.search.sampling.BaseSampleTestTopK;
@@ -24,6 +25,7 @@ import org.apache.lucene.facet.taxonomy.
* limitations under the License.
*/
+@Slow
public class AdaptiveAccumulatorTest extends BaseSampleTestTopK {
@Override
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java Thu Jul 19 15:58:54 2012
@@ -4,7 +4,6 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.util._TestUtil;
@@ -51,7 +50,7 @@ public abstract class BaseTestTopK exten
@Override
protected void populateIndex(RandomIndexWriter iw, TaxonomyWriter taxo,
- FacetIndexingParams iParams) throws IOException, CorruptIndexException {
+ FacetIndexingParams iParams) throws IOException {
currDoc = -1;
super.populateIndex(iw, taxo, iParams);
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/CategoryListIteratorTest.java Thu Jul 19 15:58:54 2012
@@ -57,7 +57,7 @@ public class CategoryListIteratorTest ex
private boolean exhausted = false;
private CharTermAttribute term = addAttribute(CharTermAttribute.class);
- public DataTokenStream(String text, IntEncoder encoder) throws IOException {
+ public DataTokenStream(String text, IntEncoder encoder) {
this.encoder = encoder;
term.setEmpty().append(text);
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java Thu Jul 19 15:58:54 2012
@@ -8,7 +8,6 @@ import org.apache.lucene.analysis.MockTo
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -17,7 +16,6 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.LockObtainFailedException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -58,7 +56,7 @@ public class DrillDownTest extends Lucen
private static Directory dir;
private static Directory taxoDir;
- public DrillDownTest() throws IOException {
+ public DrillDownTest() {
PerDimensionIndexingParams iParams = new PerDimensionIndexingParams();
CategoryListParams aClParams = new CategoryListParams(new Term("testing_facets_a", "a"));
CategoryListParams bClParams = new CategoryListParams(new Term("testing_facets_b", "b"));
@@ -70,7 +68,7 @@ public class DrillDownTest extends Lucen
}
@BeforeClass
- public static void createIndexes() throws CorruptIndexException, LockObtainFailedException, IOException {
+ public static void createIndexes() throws IOException {
dir = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), dir,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.KEYWORD, false)));
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/SamplingWrapperTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/SamplingWrapperTest.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/SamplingWrapperTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/SamplingWrapperTest.java Thu Jul 19 15:58:54 2012
@@ -1,6 +1,7 @@
package org.apache.lucene.facet.search;
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.facet.search.params.FacetSearchParams;
import org.apache.lucene.facet.search.sampling.BaseSampleTestTopK;
@@ -24,6 +25,7 @@ import org.apache.lucene.facet.taxonomy.
* limitations under the License.
*/
+@Slow
public class SamplingWrapperTest extends BaseSampleTestTopK {
@Override
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestCategoryListCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestCategoryListCache.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestCategoryListCache.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestCategoryListCache.java Thu Jul 19 15:58:54 2012
@@ -72,7 +72,7 @@ public class TestCategoryListCache exten
doTest(true,true);
}
- private void doTest(boolean withCache, boolean plantWrongData) throws IOException, Exception {
+ private void doTest(boolean withCache, boolean plantWrongData) throws Exception {
Map<CategoryPath,Integer> truth = facetCountsTruth();
CategoryPath cp = (CategoryPath) truth.keySet().toArray()[0]; // any category path will do for this test
CountFacetRequest frq = new CountFacetRequest(cp, 10);
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java Thu Jul 19 15:58:54 2012
@@ -19,7 +19,6 @@ import org.apache.lucene.facet.taxonomy.
import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
@@ -271,12 +270,12 @@ public class TestMultipleCategoryLists e
IOUtils.close(dirs[0]);
}
- private Directory[][] getDirs() throws IOException {
+ private Directory[][] getDirs() {
return FacetTestUtils.createIndexTaxonomyDirs(1);
}
private void assertCorrectResults(FacetsCollector facetsCollector)
- throws IOException, IllegalAccessException, InstantiationException {
+ throws IOException {
List<FacetResult> res = facetsCollector.getFacetResults();
FacetResult results = res.get(0);
@@ -354,7 +353,7 @@ public class TestMultipleCategoryLists e
}
private void seedIndex(RandomIndexWriter iw, TaxonomyWriter tw,
- FacetIndexingParams iParams) throws IOException, CorruptIndexException {
+ FacetIndexingParams iParams) throws IOException {
FacetTestUtils.add(iParams, iw, tw, "Author", "Mark Twain");
FacetTestUtils.add(iParams, iw, tw, "Author", "Stephen King");
FacetTestUtils.add(iParams, iw, tw, "Author", "Kurt Vonnegut");
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java Thu Jul 19 15:58:54 2012
@@ -8,7 +8,6 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.RandomIndexWriter;
@@ -321,8 +320,7 @@ public class TestTopKInEachNodeResultHan
}
private void prvt_add(DefaultFacetIndexingParams iParams, RandomIndexWriter iw,
- TaxonomyWriter tw, String... strings) throws IOException,
- CorruptIndexException {
+ TaxonomyWriter tw, String... strings) throws IOException {
ArrayList<CategoryPath> cps = new ArrayList<CategoryPath>();
CategoryPath cp = new CategoryPath(strings);
cps.add(cp);
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKResultsHandlerRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKResultsHandlerRandom.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKResultsHandlerRandom.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTopKResultsHandlerRandom.java Thu Jul 19 15:58:54 2012
@@ -34,7 +34,7 @@ import org.apache.lucene.facet.taxonomy.
public class TestTopKResultsHandlerRandom extends BaseTestTopK {
private List<FacetResult> countFacets(int partitionSize, int numResults, final boolean doComplement)
- throws IOException, IllegalAccessException, InstantiationException {
+ throws IOException {
Query q = new MatchAllDocsQuery();
FacetSearchParams facetSearchParams = searchParamsWithRequests(numResults, partitionSize);
FacetsCollector fc = new FacetsCollector(facetSearchParams, indexReader, taxoReader) {
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java Thu Jul 19 15:58:54 2012
@@ -8,7 +8,6 @@ import java.util.List;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
@@ -140,8 +139,7 @@ public class TestTotalFacetCountsCache e
}
private void doTestGeneralSynchronization(int numThreads, int sleepMillis,
- int cacheSize) throws Exception, CorruptIndexException, IOException,
- InterruptedException {
+ int cacheSize) throws Exception {
TFC.setCacheSize(cacheSize);
SlowRAMDirectory slowIndexDir = new SlowRAMDirectory(-1, random());
MockDirectoryWrapper indexDir = new MockDirectoryWrapper(random(), slowIndexDir);
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/params/MultiIteratorsPerCLParamsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/params/MultiIteratorsPerCLParamsTest.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/params/MultiIteratorsPerCLParamsTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/params/MultiIteratorsPerCLParamsTest.java Thu Jul 19 15:58:54 2012
@@ -7,7 +7,6 @@ import java.util.List;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -84,8 +83,7 @@ public class MultiIteratorsPerCLParamsTe
doTestCLParamMultiIteratorsByRequest(true);
}
- private void doTestCLParamMultiIteratorsByRequest(boolean cacheCLI) throws Exception,
- CorruptIndexException, IOException {
+ private void doTestCLParamMultiIteratorsByRequest(boolean cacheCLI) throws Exception {
// Create a CLP which generates different CLIs according to the
// FacetRequest's dimension
CategoryListParams clp = new CategoryListParams();
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/BaseSampleTestTopK.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/BaseSampleTestTopK.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/BaseSampleTestTopK.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/BaseSampleTestTopK.java Thu Jul 19 15:58:54 2012
@@ -1,6 +1,5 @@
package org.apache.lucene.facet.search.sampling;
-import java.io.IOException;
import java.util.List;
import java.util.Random;
@@ -53,7 +52,7 @@ public abstract class BaseSampleTestTopK
* Lots of randomly generated data is being indexed, and later on a "90% docs" faceted search
* is performed. The results are compared to non-sampled ones.
*/
- public void testCountUsingSamping() throws Exception, IOException {
+ public void testCountUsingSamping() throws Exception {
boolean useRandomSampler = random().nextBoolean();
for (int partitionSize : partitionSizes) {
try {
Modified: lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/SamplingAccumulatorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/SamplingAccumulatorTest.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/SamplingAccumulatorTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/SamplingAccumulatorTest.java Thu Jul 19 15:58:54 2012
@@ -1,6 +1,7 @@
package org.apache.lucene.facet.search.sampling;
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.facet.search.FacetsAccumulator;
import org.apache.lucene.facet.search.params.FacetSearchParams;
@@ -23,6 +24,7 @@ import org.apache.lucene.facet.taxonomy.
* limitations under the License.
*/
+@Slow
public class SamplingAccumulatorTest extends BaseSampleTestTopK {
@Override