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 [15/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/index/TestSameTokenSamePosition.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java Thu Jul 19 15:58:54 2012
@@ -72,7 +72,7 @@ final class BugReproTokenStream extends
private final int incs[] = new int[]{1, 0, 1, 0};
@Override
- public boolean incrementToken() throws IOException {
+ public boolean incrementToken() {
if (nextTokenIndex < tokenCount) {
termAtt.setEmpty().append(terms[nextTokenIndex]);
offsetAtt.setOffset(starts[nextTokenIndex], ends[nextTokenIndex]);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestSizeBoundedForceMerge.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestSizeBoundedForceMerge.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestSizeBoundedForceMerge.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestSizeBoundedForceMerge.java Thu Jul 19 15:58:54 2012
@@ -43,7 +43,7 @@ public class TestSizeBoundedForceMerge e
writer.commit();
}
- private static IndexWriterConfig newWriterConfig() throws IOException {
+ private static IndexWriterConfig newWriterConfig() {
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
conf.setMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH);
conf.setRAMBufferSizeMB(IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java Thu Jul 19 15:58:54 2012
@@ -35,7 +35,6 @@ import org.apache.lucene.util._TestUtil;
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.CompiledAutomaton;
-import org.apache.lucene.util.automaton.DaciukMihovAutomatonBuilder;
import org.apache.lucene.util.automaton.RegExp;
@SuppressCodecs({ "SimpleText", "Memory" })
@@ -257,7 +256,7 @@ public class TestTermsEnum extends Lucen
acceptTerms.add(s2);
sortedAcceptTerms.add(new BytesRef(s2));
}
- a = DaciukMihovAutomatonBuilder.build(sortedAcceptTerms);
+ a = BasicAutomata.makeStringUnion(sortedAcceptTerms);
}
if (random().nextBoolean()) {
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java Thu Jul 19 15:58:54 2012
@@ -35,13 +35,7 @@ import org.apache.lucene.store.Directory
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
-import org.apache.lucene.util.automaton.Automaton;
-import org.apache.lucene.util.automaton.AutomatonTestUtil;
-import org.apache.lucene.util.automaton.BasicOperations;
-import org.apache.lucene.util.automaton.CompiledAutomaton;
-import org.apache.lucene.util.automaton.DaciukMihovAutomatonBuilder;
-import org.apache.lucene.util.automaton.RegExp;
-import org.apache.lucene.util.automaton.SpecialOperations;
+import org.apache.lucene.util.automaton.*;
public class TestTermsEnum2 extends LuceneTestCase {
private Directory dir;
@@ -72,7 +66,7 @@ public class TestTermsEnum2 extends Luce
writer.addDocument(doc);
}
- termsAutomaton = DaciukMihovAutomatonBuilder.build(terms);
+ termsAutomaton = BasicAutomata.makeStringUnion(terms);
reader = writer.getReader();
searcher = newSearcher(reader);
@@ -97,7 +91,7 @@ public class TestTermsEnum2 extends Luce
}
}
- Automaton alternate = DaciukMihovAutomatonBuilder.build(matchedTerms);
+ Automaton alternate = BasicAutomata.makeStringUnion(matchedTerms);
//System.out.println("match " + matchedTerms.size() + " " + alternate.getNumberOfStates() + " states, sigma=" + alternate.getStartPoints().length);
//AutomatonTestUtil.minimizeSimple(alternate);
//System.out.println("minmize done");
@@ -164,7 +158,7 @@ public class TestTermsEnum2 extends Luce
found.add(BytesRef.deepCopyOf(te.term()));
}
- Automaton actual = DaciukMihovAutomatonBuilder.build(found);
+ Automaton actual = BasicAutomata.makeStringUnion(found);
assertTrue(BasicOperations.sameLanguage(expected, actual));
}
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTypePromotion.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTypePromotion.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTypePromotion.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/index/TestTypePromotion.java Thu Jul 19 15:58:54 2012
@@ -68,8 +68,7 @@ public class TestTypePromotion extends L
Int, Float, Byte
}
- private void runTest(EnumSet<Type> types, TestType type)
- throws CorruptIndexException, IOException {
+ private void runTest(EnumSet<Type> types, TestType type) throws IOException {
Directory dir = newDirectory();
IndexWriter writer = new IndexWriter(dir,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())));
@@ -119,7 +118,7 @@ public class TestTypePromotion extends L
private void assertValues(TestType type, Directory dir, long[] values, Type[] sourceType)
- throws CorruptIndexException, IOException {
+ throws IOException {
DirectoryReader reader = DirectoryReader.open(dir);
assertEquals(1, reader.getSequentialSubReaders().size());
IndexReaderContext topReaderContext = reader.getTopReaderContext();
@@ -181,7 +180,7 @@ public class TestTypePromotion extends L
public void index(IndexWriter writer,
Type valueType, long[] values, Type[] sourceTypes, int offset, int num)
- throws CorruptIndexException, IOException {
+ throws IOException {
final Field valField;
if (VERBOSE) {
@@ -322,8 +321,7 @@ public class TestTypePromotion extends L
runTest(INTEGERS, TestType.Int);
}
- public void testPromotFloatingPoint() throws CorruptIndexException,
- IOException {
+ public void testPromotFloatingPoint() throws IOException {
runTest(FLOATS, TestType.Float);
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/BaseTestRangeFilter.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/BaseTestRangeFilter.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/BaseTestRangeFilter.java Thu Jul 19 15:58:54 2012
@@ -54,9 +54,7 @@ public class BaseTestRangeFilter extends
this.minR = minR;
this.maxR = maxR;
this.allowNegativeRandomInts = allowNegativeRandomInts;
- try {
- index = newDirectory(random);
- } catch (IOException e) { throw new RuntimeException(e); }
+ index = newDirectory(random);
}
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/FieldCacheRewriteMethod.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/FieldCacheRewriteMethod.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/FieldCacheRewriteMethod.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/FieldCacheRewriteMethod.java Thu Jul 19 15:58:54 2012
@@ -94,12 +94,12 @@ public final class FieldCacheRewriteMeth
TermsEnum termsEnum = query.getTermsEnum(new Terms() {
@Override
- public Comparator<BytesRef> getComparator() throws IOException {
+ public Comparator<BytesRef> getComparator() {
return BytesRef.getUTF8SortedAsUnicodeComparator();
}
@Override
- public TermsEnum iterator(TermsEnum reuse) throws IOException {
+ public TermsEnum iterator(TermsEnum reuse) {
return fcsi.getTermsEnum();
}
@@ -109,17 +109,17 @@ public final class FieldCacheRewriteMeth
}
@Override
- public long getSumDocFreq() throws IOException {
+ public long getSumDocFreq() {
return -1;
}
@Override
- public int getDocCount() throws IOException {
+ public int getDocCount() {
return -1;
}
@Override
- public long size() throws IOException {
+ public long size() {
return -1;
}
});
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java Thu Jul 19 15:58:54 2012
@@ -17,8 +17,6 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import java.io.IOException;
-
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.Norm;
import org.apache.lucene.search.similarities.Similarity;
@@ -41,18 +39,17 @@ final class JustCompileSearch {
static final class JustCompileCollector extends Collector {
@Override
- public void collect(int doc) throws IOException {
+ public void collect(int doc) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public void setNextReader(AtomicReaderContext context)
- throws IOException {
+ public void setNextReader(AtomicReaderContext context) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -66,7 +63,7 @@ final class JustCompileSearch {
static final class JustCompileDocIdSet extends DocIdSet {
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -80,12 +77,12 @@ final class JustCompileSearch {
}
@Override
- public int nextDoc() throws IOException {
+ public int nextDoc() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public int advance(int target) throws IOException {
+ public int advance(int target) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
}
@@ -114,12 +111,12 @@ final class JustCompileSearch {
}
@Override
- public int compareBottom(int doc) throws IOException {
+ public int compareBottom(int doc) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public void copy(int slot, int doc) throws IOException {
+ public void copy(int slot, int doc) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -129,8 +126,7 @@ final class JustCompileSearch {
}
@Override
- public FieldComparator<Object> setNextReader(AtomicReaderContext context)
- throws IOException {
+ public FieldComparator<Object> setNextReader(AtomicReaderContext context) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -149,7 +145,7 @@ final class JustCompileSearch {
@Override
public FieldComparator<?> newComparator(String fieldname, int numHits,
- int sortPos, boolean reversed) throws IOException {
+ int sortPos, boolean reversed) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -160,7 +156,7 @@ final class JustCompileSearch {
// still added here in case someone will add abstract methods in the future.
@Override
- public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
+ public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) {
return null;
}
}
@@ -194,12 +190,12 @@ final class JustCompileSearch {
static final class JustCompilePhraseScorer extends PhraseScorer {
JustCompilePhraseScorer(Weight weight, PhraseQuery.PostingsAndFreq[] postings,
- Similarity.SloppySimScorer docScorer) throws IOException {
+ Similarity.SloppySimScorer docScorer) {
super(weight, postings, docScorer);
}
@Override
- protected float phraseFreq() throws IOException {
+ protected float phraseFreq() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -221,13 +217,17 @@ final class JustCompileSearch {
}
@Override
- public boolean score(Collector collector, int max, int firstDocID)
- throws IOException {
+ public boolean score(Collector collector, int max, int firstDocID) {
+ throw new UnsupportedOperationException(UNSUPPORTED_MSG);
+ }
+
+ @Override
+ public float score() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public float score() throws IOException {
+ public float freq() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -237,12 +237,12 @@ final class JustCompileSearch {
}
@Override
- public int nextDoc() throws IOException {
+ public int nextDoc() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public int advance(int target) throws IOException {
+ public int advance(int target) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
}
@@ -255,12 +255,12 @@ final class JustCompileSearch {
}
@Override
- public ExactSimScorer exactSimScorer(SimWeight stats, AtomicReaderContext context) throws IOException {
+ public ExactSimScorer exactSimScorer(SimWeight stats, AtomicReaderContext context) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public SloppySimScorer sloppySimScorer(SimWeight stats, AtomicReaderContext context) throws IOException {
+ public SloppySimScorer sloppySimScorer(SimWeight stats, AtomicReaderContext context) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -277,18 +277,17 @@ final class JustCompileSearch {
}
@Override
- public void collect(int doc) throws IOException {
+ public void collect(int doc) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public void setNextReader(AtomicReaderContext context)
- throws IOException {
+ public void setNextReader(AtomicReaderContext context) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -317,7 +316,7 @@ final class JustCompileSearch {
static final class JustCompileWeight extends Weight {
@Override
- public Explanation explain(AtomicReaderContext context, int doc) throws IOException {
+ public Explanation explain(AtomicReaderContext context, int doc) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -332,14 +331,13 @@ final class JustCompileSearch {
}
@Override
- public float getValueForNormalization() throws IOException {
+ public float getValueForNormalization() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder,
- boolean topScorer, Bits acceptDocs)
- throws IOException {
+ boolean topScorer, Bits acceptDocs) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java Thu Jul 19 15:58:54 2012
@@ -28,6 +28,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
import java.util.Random;
/** Test that BooleanQuery.setMinimumNumberShouldMatch works.
@@ -377,7 +379,7 @@ public class TestBooleanMinShouldMatch e
System.err.println("------- " + test + " -------");
- DecimalFormat f = new DecimalFormat("0.000000");
+ DecimalFormat f = new DecimalFormat("0.000000", DecimalFormatSymbols.getInstance(Locale.ROOT));
for (int i = 0; i < h.length; i++) {
Document d = searcher.doc(h[i].doc);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestBooleanScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestBooleanScorer.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestBooleanScorer.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestBooleanScorer.java Thu Jul 19 15:58:54 2012
@@ -17,7 +17,6 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -81,14 +80,15 @@ public class TestBooleanScorer extends L
BooleanWeight weight = (BooleanWeight) new BooleanQuery().createWeight(searcher);
Scorer[] scorers = new Scorer[] {new Scorer(weight) {
private int doc = -1;
- @Override public float score() throws IOException { return 0; }
+ @Override public float score() { return 0; }
+ @Override public float freq() { return 0; }
@Override public int docID() { return doc; }
- @Override public int nextDoc() throws IOException {
+ @Override public int nextDoc() {
return doc = doc == -1 ? 3000 : NO_MORE_DOCS;
}
- @Override public int advance(int target) throws IOException {
+ @Override public int advance(int target) {
return doc = target <= 3000 ? 3000 : NO_MORE_DOCS;
}
@@ -104,7 +104,7 @@ public class TestBooleanScorer extends L
}
@Override
- public void collect(int doc) throws IOException {
+ public void collect(int doc) {
hits.add(docBase+doc);
}
@@ -158,7 +158,7 @@ public class TestBooleanScorer extends L
}
@Override
- public void collect(int doc) throws IOException {
+ public void collect(int doc) {
count[0]++;
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java Thu Jul 19 15:58:54 2012
@@ -34,6 +34,9 @@ public class TestCachingCollector extend
@Override
public float score() throws IOException { return 0; }
+
+ @Override
+ public float freq() throws IOException { return 0; }
@Override
public int docID() { return 0; }
@@ -85,13 +88,13 @@ public class TestCachingCollector extend
int prevDocID = -1;
@Override
- public void setScorer(Scorer scorer) throws IOException {}
+ public void setScorer(Scorer scorer) {}
@Override
- public void setNextReader(AtomicReaderContext context) throws IOException {}
+ public void setNextReader(AtomicReaderContext context) {}
@Override
- public void collect(int doc) throws IOException {
+ public void collect(int doc) {
assertEquals(prevDocID + 1, doc);
prevDocID = doc;
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestCustomSearcherSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestCustomSearcherSort.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestCustomSearcherSort.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestCustomSearcherSort.java Thu Jul 19 15:58:54 2012
@@ -19,8 +19,10 @@ package org.apache.lucene.search;
import java.io.IOException;
import java.util.Calendar;
import java.util.GregorianCalendar;
+import java.util.Locale;
import java.util.Map;
import java.util.Random;
+import java.util.TimeZone;
import java.util.TreeMap;
import org.apache.lucene.document.DateTools;
@@ -230,10 +232,12 @@ public class TestCustomSearcherSort exte
private class RandomGen {
RandomGen(Random random) {
this.random = random;
+ base.set(1980, 1, 1);
}
private Random random;
- private Calendar base = new GregorianCalendar(1980, 1, 1);
+ // we use the default Locale/TZ since LuceneTestCase randomizes it
+ private Calendar base = new GregorianCalendar(TimeZone.getDefault(), Locale.getDefault());
// Just to generate some different Lucene Date strings
private String getLuceneDate() {
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Thu Jul 19 15:58:54 2012
@@ -35,6 +35,8 @@ import org.apache.lucene.search.similari
import org.apache.lucene.store.Directory;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
import java.io.IOException;
/**
@@ -485,7 +487,7 @@ public class TestDisjunctionMaxQuery ext
System.err.println("------- " + test + " -------");
- DecimalFormat f = new DecimalFormat("0.000000000");
+ DecimalFormat f = new DecimalFormat("0.000000000", DecimalFormatSymbols.getInstance(Locale.ROOT));
for (int i = 0; i < h.length; i++) {
Document d = searcher.doc(h[i].doc);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDocBoost.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDocBoost.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDocBoost.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDocBoost.java Thu Jul 19 15:58:54 2012
@@ -63,7 +63,7 @@ public class TestDocBoost extends Lucene
private int base = 0;
private Scorer scorer;
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
@Override
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDocIdSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDocIdSet.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDocIdSet.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestDocIdSet.java Thu Jul 19 15:58:54 2012
@@ -17,7 +17,6 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
@@ -50,13 +49,13 @@ public class TestDocIdSet extends Lucene
}
@Override
- public int nextDoc() throws IOException {
+ public int nextDoc() {
docid++;
return docid < maxdoc ? docid : (docid = NO_MORE_DOCS);
}
@Override
- public int advance(int target) throws IOException {
+ public int advance(int target) {
while (nextDoc() < target) {}
return docid;
}
@@ -115,7 +114,7 @@ public class TestDocIdSet extends Lucene
// Now search w/ a Filter which returns a null DocIdSet
Filter f = new Filter() {
@Override
- public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
+ public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) {
return null;
}
};
@@ -141,7 +140,7 @@ public class TestDocIdSet extends Lucene
// Now search w/ a Filter which returns a null DocIdSet
Filter f = new Filter() {
@Override
- public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
+ public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) {
final DocIdSet innerNullIteratorSet = new DocIdSet() {
@Override
public DocIdSetIterator iterator() {
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestElevationComparator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestElevationComparator.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestElevationComparator.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestElevationComparator.java Thu Jul 19 15:58:54 2012
@@ -157,7 +157,7 @@ class ElevationComparatorSource extends
bottomVal = values[slot];
}
- private int docVal(int doc) throws IOException {
+ private int docVal(int doc) {
int ord = idIndex.getOrd(doc);
if (ord == 0) {
return 0;
@@ -169,12 +169,12 @@ class ElevationComparatorSource extends
}
@Override
- public int compareBottom(int doc) throws IOException {
+ public int compareBottom(int doc) {
return docVal(doc) - bottomVal;
}
@Override
- public void copy(int slot, int doc) throws IOException {
+ public void copy(int slot, int doc) {
values[slot] = docVal(doc);
}
@@ -190,7 +190,7 @@ class ElevationComparatorSource extends
}
@Override
- public int compareDocToValue(int doc, Integer valueObj) throws IOException {
+ public int compareDocToValue(int doc, Integer valueObj) {
final int value = valueObj.intValue();
final int docValue = docVal(doc);
// values will be small enough that there is no overflow concern
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java Thu Jul 19 15:58:54 2012
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -117,10 +118,10 @@ public class TestFieldCache extends Luce
try {
FieldCache cache = FieldCache.DEFAULT;
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
- cache.setInfoStream(new PrintStream(bos));
+ cache.setInfoStream(new PrintStream(bos, false, "UTF-8"));
cache.getDoubles(reader, "theDouble", false);
cache.getFloats(reader, "theDouble", false);
- assertTrue(bos.toString().indexOf("WARNING") != -1);
+ assertTrue(bos.toString("UTF-8").indexOf("WARNING") != -1);
} finally {
FieldCache.DEFAULT.purgeAllCaches();
}
@@ -261,7 +262,7 @@ public class TestFieldCache extends Luce
if (chunk == 0) {
for (int ord = 0; ord < values.size(); ord++) {
BytesRef term = values.get(ord);
- assertNull(String.format("Document[%d] misses field must be null. Has value %s for ord %d", i, term, ord), term);
+ assertNull(String.format(Locale.ROOT, "Document[%d] misses field must be null. Has value %s for ord %d", i, term, ord), term);
}
break;
}
@@ -275,7 +276,7 @@ public class TestFieldCache extends Luce
reuse = termOrds.lookup(i, reuse);
reuse.read(buffer);
}
- assertTrue(String.format("Expected value %s for doc %d and ord %d, but was %s", expected, i, idx, actual), expected.equals(actual));
+ assertTrue(String.format(Locale.ROOT, "Expected value %s for doc %d and ord %d, but was %s", expected, i, idx, actual), expected.equals(actual));
}
if (chunk <= buffer.length) {
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFieldValueFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFieldValueFilter.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFieldValueFilter.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFieldValueFilter.java Thu Jul 19 15:58:54 2012
@@ -21,7 +21,6 @@ import java.io.IOException;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -90,7 +89,7 @@ public class TestFieldValueFilter extend
}
private int[] buildIndex(RandomIndexWriter writer, int docs)
- throws IOException, CorruptIndexException {
+ throws IOException {
int[] docStates = new int[docs];
for (int i = 0; i < docs; i++) {
Document doc = new Document();
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFilteredSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFilteredSearch.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFilteredSearch.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestFilteredSearch.java Thu Jul 19 15:58:54 2012
@@ -24,14 +24,12 @@ import org.apache.lucene.util.LuceneTest
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.AtomicReaderContext;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.FixedBitSet;
@@ -44,7 +42,7 @@ public class TestFilteredSearch extends
private static final String FIELD = "category";
- public void testFilteredSearch() throws CorruptIndexException, LockObtainFailedException, IOException {
+ public void testFilteredSearch() throws IOException {
boolean enforceSingleSegment = true;
Directory directory = newDirectory();
int[] filterBits = {1, 36};
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java Thu Jul 19 15:58:54 2012
@@ -178,7 +178,7 @@ public class TestMultiTermConstantScore
private int base = 0;
private Scorer scorer;
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
@Override
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java Thu Jul 19 15:58:54 2012
@@ -44,7 +44,7 @@ public class TestMultiValuedNumericRange
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
.setMaxBufferedDocs(_TestUtil.nextInt(random(), 50, 1000)));
- DecimalFormat format = new DecimalFormat("00000000000", new DecimalFormatSymbols(Locale.US));
+ DecimalFormat format = new DecimalFormat("00000000000", new DecimalFormatSymbols(Locale.ROOT));
int num = atLeast(500);
for (int l = 0; l < num; l++) {
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java Thu Jul 19 15:58:54 2012
@@ -27,7 +27,6 @@ import org.apache.lucene.analysis.Analyz
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
@@ -37,7 +36,6 @@ import org.apache.lucene.index.RandomInd
import org.apache.lucene.index.Term;
import org.apache.lucene.index.ThreadedIndexingAndSearchingTestCase;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.store.NRTCachingDirectory;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
@@ -367,7 +365,7 @@ public class TestNRTManager extends Thre
public LatchedIndexWriter(Directory d, IndexWriterConfig conf,
CountDownLatch latch, CountDownLatch signal)
- throws CorruptIndexException, LockObtainFailedException, IOException {
+ throws IOException {
super(d, conf);
this.latch = latch;
this.signal = signal;
@@ -376,7 +374,7 @@ public class TestNRTManager extends Thre
public void updateDocument(Term term,
Iterable<? extends IndexableField> doc, Analyzer analyzer)
- throws CorruptIndexException, IOException {
+ throws IOException {
super.updateDocument(term, doc, analyzer);
try {
if (waitAfterUpdate) {
@@ -398,7 +396,7 @@ public class TestNRTManager extends Thre
final SearcherFactory theEvilOne = new SearcherFactory() {
@Override
- public IndexSearcher newSearcher(IndexReader ignored) throws IOException {
+ public IndexSearcher newSearcher(IndexReader ignored) {
return new IndexSearcher(other);
}
};
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java Thu Jul 19 15:58:54 2012
@@ -211,7 +211,6 @@ public class TestNumericRangeQuery32 ext
@Test
public void testOneMatchQuery() throws Exception {
NumericRangeQuery<Integer> q = NumericRangeQuery.newIntRange("ascfield8", 8, 1000, 1000, true, true);
- assertSame(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, q.getRewriteMethod());
TopDocs topDocs = searcher.search(q, noDocs);
ScoreDoc[] sd = topDocs.scoreDocs;
assertNotNull(sd);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java Thu Jul 19 15:58:54 2012
@@ -226,7 +226,6 @@ public class TestNumericRangeQuery64 ext
@Test
public void testOneMatchQuery() throws Exception {
NumericRangeQuery<Long> q = NumericRangeQuery.newLongRange("ascfield8", 8, 1000L, 1000L, true, true);
- assertSame(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, q.getRewriteMethod());
TopDocs topDocs = searcher.search(q, noDocs);
ScoreDoc[] sd = topDocs.scoreDocs;
assertNotNull(sd);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java Thu Jul 19 15:58:54 2012
@@ -254,7 +254,7 @@ public class TestPositionIncrement exten
for (byte[] bytes : payloads) {
count++;
if (VERBOSE) {
- System.out.println(" payload: " + new String(bytes));
+ System.out.println(" payload: " + new String(bytes, "UTF-8"));
}
}
}
@@ -281,7 +281,7 @@ public class TestPositionIncrement exten
Collection<byte[]> pls = psu.getPayloadsForQuery(snq);
count = pls.size();
for (byte[] bytes : pls) {
- String s = new String(bytes);
+ String s = new String(bytes, "UTF-8");
//System.out.println(s);
sawZero |= s.equals("pos: 0");
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java Thu Jul 19 15:58:54 2012
@@ -17,8 +17,6 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import java.io.IOException;
-
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -34,17 +32,21 @@ public class TestPositiveScoresOnlyColle
super(weight);
}
- @Override public float score() throws IOException {
+ @Override public float score() {
return idx == scores.length ? Float.NaN : scores[idx];
}
+
+ @Override public float freq() {
+ return 1;
+ }
@Override public int docID() { return idx; }
- @Override public int nextDoc() throws IOException {
+ @Override public int nextDoc() {
return ++idx != scores.length ? idx : NO_MORE_DOCS;
}
- @Override public int advance(int target) throws IOException {
+ @Override public int advance(int target) {
idx = target;
return idx < scores.length ? idx : NO_MORE_DOCS;
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPrefixRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPrefixRandom.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPrefixRandom.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestPrefixRandom.java Thu Jul 19 15:58:54 2012
@@ -91,7 +91,7 @@ public class TestPrefixRandom extends Lu
private class SimplePrefixTermsEnum extends FilteredTermsEnum {
private final BytesRef prefix;
- private SimplePrefixTermsEnum(TermsEnum tenum, BytesRef prefix) throws IOException {
+ private SimplePrefixTermsEnum(TermsEnum tenum, BytesRef prefix) {
super(tenum);
this.prefix = prefix;
setInitialSeekTerm(new BytesRef(""));
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java Thu Jul 19 15:58:54 2012
@@ -102,7 +102,7 @@ public class TestRegexpQuery extends Luc
BasicAutomata.makeString("brown"),
BasicAutomata.makeString("bob")));
- public Automaton getAutomaton(String name) throws IOException {
+ public Automaton getAutomaton(String name) {
if (name.equals("quickBrown")) return quickBrownAutomaton;
else return null;
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom.java Thu Jul 19 15:58:54 2012
@@ -58,7 +58,7 @@ public class TestRegexpRandom extends Lu
Field field = newField("field", "", customType);
doc.add(field);
- NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ENGLISH));
+ NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ROOT));
for (int i = 0; i < 1000; i++) {
field.setStringValue(df.format(i));
writer.addDocument(doc);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java Thu Jul 19 15:58:54 2012
@@ -116,7 +116,7 @@ public class TestRegexpRandom2 extends L
CharacterRunAutomaton runAutomaton = new CharacterRunAutomaton(automaton);
CharsRef utf16 = new CharsRef(10);
- private SimpleAutomatonTermsEnum(TermsEnum tenum) throws IOException {
+ private SimpleAutomatonTermsEnum(TermsEnum tenum) {
super(tenum);
setInitialSeekTerm(new BytesRef(""));
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java Thu Jul 19 15:58:54 2012
@@ -36,21 +36,25 @@ public class TestScoreCachingWrappingSco
super(weight);
}
- @Override public float score() throws IOException {
+ @Override public float score() {
// advance idx on purpose, so that consecutive calls to score will get
// different results. This is to emulate computation of a score. If
// ScoreCachingWrappingScorer is used, this should not be called more than
// once per document.
return idx == scores.length ? Float.NaN : scores[idx++];
}
+
+ @Override public float freq() throws IOException {
+ return 1;
+ }
@Override public int docID() { return doc; }
- @Override public int nextDoc() throws IOException {
+ @Override public int nextDoc() {
return ++doc < scores.length ? doc : NO_MORE_DOCS;
}
- @Override public int advance(int target) throws IOException {
+ @Override public int advance(int target) {
doc = target;
return doc < scores.length ? doc : NO_MORE_DOCS;
}
@@ -80,11 +84,10 @@ public class TestScoreCachingWrappingSco
++idx;
}
- @Override public void setNextReader(AtomicReaderContext context)
- throws IOException {
+ @Override public void setNextReader(AtomicReaderContext context) {
}
- @Override public void setScorer(Scorer scorer) throws IOException {
+ @Override public void setScorer(Scorer scorer) {
this.scorer = new ScoreCachingWrappingScorer(scorer);
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSearcherManager.java Thu Jul 19 15:58:54 2012
@@ -208,7 +208,7 @@ public class TestSearcherManager extends
final ExecutorService es = random().nextBoolean() ? null : Executors.newCachedThreadPool(new NamedThreadFactory("testIntermediateClose"));
final SearcherFactory factory = new SearcherFactory() {
@Override
- public IndexSearcher newSearcher(IndexReader r) throws IOException {
+ public IndexSearcher newSearcher(IndexReader r) {
try {
if (triedReopen.get()) {
awaitEnterWarm.countDown();
@@ -334,7 +334,7 @@ public class TestSearcherManager extends
final SearcherFactory theEvilOne = new SearcherFactory() {
@Override
- public IndexSearcher newSearcher(IndexReader ignored) throws IOException {
+ public IndexSearcher newSearcher(IndexReader ignored) {
return new IndexSearcher(other);
}
};
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java Thu Jul 19 15:58:54 2012
@@ -78,7 +78,7 @@ public class TestSimilarity extends Luce
searcher.search(new TermQuery(b), new Collector() {
private Scorer scorer;
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
@Override
@@ -101,7 +101,7 @@ public class TestSimilarity extends Luce
private int base = 0;
private Scorer scorer;
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
@Override
@@ -127,7 +127,7 @@ public class TestSimilarity extends Luce
new Collector() {
private Scorer scorer;
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
@Override
@@ -148,7 +148,7 @@ public class TestSimilarity extends Luce
searcher.search(pq, new Collector() {
private Scorer scorer;
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
@Override
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java Thu Jul 19 15:58:54 2012
@@ -207,7 +207,7 @@ public class TestSloppyPhraseQuery exten
Scorer scorer;
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
@@ -218,7 +218,7 @@ public class TestSloppyPhraseQuery exten
}
@Override
- public void setNextReader(AtomicReaderContext context) throws IOException {
+ public void setNextReader(AtomicReaderContext context) {
// do nothing
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery2.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery2.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery2.java Thu Jul 19 15:58:54 2012
@@ -184,7 +184,7 @@ public class TestSloppyPhraseQuery2 exte
}
}
- private MultiPhraseQuery randomPhraseQuery(long seed) throws Exception {
+ private MultiPhraseQuery randomPhraseQuery(long seed) {
Random random = new Random(seed);
int length = _TestUtil.nextInt(random, 2, 5);
MultiPhraseQuery pq = new MultiPhraseQuery();
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSort.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSort.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSort.java Thu Jul 19 15:58:54 2012
@@ -42,7 +42,6 @@ import org.apache.lucene.document.Straig
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicReaderContext;
-import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.IndexReader;
@@ -55,7 +54,6 @@ import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.FieldValueHitQueue.Entry;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.DocIdBitSet;
@@ -87,7 +85,7 @@ public class TestSort extends LuceneTest
private Sort sort;
@BeforeClass
- public static void beforeClass() throws Exception {
+ public static void beforeClass() {
NUM_STRINGS = atLeast(500);
}
@@ -217,7 +215,7 @@ public class TestSort extends LuceneTest
return getIndex (true, true);
}
- private IndexSearcher getFullStrings() throws CorruptIndexException, LockObtainFailedException, IOException {
+ private IndexSearcher getFullStrings() throws IOException {
Directory indexStore = newDirectory();
dirs.add(indexStore);
IndexWriter writer = new IndexWriter(
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java Thu Jul 19 15:58:54 2012
@@ -75,7 +75,7 @@ public class TestSubScorerFreqs extends
private final Set<String> relationships;
public CountingCollector(Collector other) {
- this(other, new HashSet<String>(Arrays.asList(Occur.MUST.toString(), Occur.SHOULD.toString(), Occur.MUST_NOT.toString())));
+ this(other, new HashSet<String>(Arrays.asList("MUST", "SHOULD", "MUST_NOT")));
}
public CountingCollector(Collector other, Set<String> relationships) {
@@ -161,9 +161,9 @@ public class TestSubScorerFreqs extends
query.add(inner, Occur.MUST);
query.add(aQuery, Occur.MUST);
query.add(dQuery, Occur.MUST);
- @SuppressWarnings({"rawtypes","unchecked"}) Set<String>[] occurList = new Set[] {
- Collections.singleton(Occur.MUST.toString()),
- new HashSet<String>(Arrays.asList(Occur.MUST.toString(), Occur.SHOULD.toString()))
+ Set<String>[] occurList = new Set[] {
+ Collections.singleton("MUST"),
+ new HashSet<String>(Arrays.asList("MUST", "SHOULD"))
};
for (Set<String> occur : occurList) {
CountingCollector c = new CountingCollector(TopScoreDocCollector.create(
@@ -171,7 +171,7 @@ public class TestSubScorerFreqs extends
s.search(query, null, c);
final int maxDocs = s.getIndexReader().maxDoc();
assertEquals(maxDocs, c.docCounts.size());
- boolean includeOptional = occur.contains(Occur.SHOULD.toString());
+ boolean includeOptional = occur.contains("SHOULD");
for (int i = 0; i < maxDocs; i++) {
Map<Query, Float> doc0 = c.docCounts.get(i);
assertEquals(includeOptional ? 5 : 4, doc0.size());
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java Thu Jul 19 15:58:54 2012
@@ -227,8 +227,8 @@ public class TestTermRangeQuery extends
}
@Override
- public final void reset(Reader reader) throws IOException {
- super.reset(reader);
+ public final void setReader(Reader reader) throws IOException {
+ super.setReader(reader);
done = false;
}
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java Thu Jul 19 15:58:54 2012
@@ -89,7 +89,7 @@ public class TestTermScorer extends Luce
private Scorer scorer;
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
this.scorer = scorer;
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTopDocsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTopDocsCollector.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTopDocsCollector.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTopDocsCollector.java Thu Jul 19 15:58:54 2012
@@ -55,19 +55,18 @@ public class TestTopDocsCollector extend
}
@Override
- public void collect(int doc) throws IOException {
+ public void collect(int doc) {
++totalHits;
pq.insertWithOverflow(new ScoreDoc(doc + base, scores[idx++]));
}
@Override
- public void setNextReader(AtomicReaderContext context)
- throws IOException {
+ public void setNextReader(AtomicReaderContext context) {
base = context.docBase;
}
@Override
- public void setScorer(Scorer scorer) throws IOException {
+ public void setScorer(Scorer scorer) {
// Don't do anything. Assign scores in random
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java Thu Jul 19 15:58:54 2012
@@ -31,10 +31,10 @@ import org.apache.lucene.index.Composite
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReaderContext;
import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.index.ReaderUtil;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.ReaderUtil;
import org.apache.lucene.util._TestUtil;
public class TestTopDocsMerge extends LuceneTestCase {
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java Thu Jul 19 15:58:54 2012
@@ -54,7 +54,7 @@ public class TestWildcardRandom extends
Field field = newStringField("field", "", Field.Store.NO);
doc.add(field);
- NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ENGLISH));
+ NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ROOT));
for (int i = 0; i < 1000; i++) {
field.setStringValue(df.format(i));
writer.addDocument(doc);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java Thu Jul 19 15:58:54 2012
@@ -48,7 +48,7 @@ import org.apache.lucene.util.LuceneTest
* items in the list. If a test case fails, the name of the Similarity that
* caused the failure is returned as part of the assertion error message.</p>
* <p>Unit testing is performed by constructing statistics manually and calling
- * the {@link SimilarityBase#score(BasicStats, float, int)} method of the
+ * the {@link SimilarityBase#score(BasicStats, float, float)} method of the
* Similarities. The statistics represent corner cases of corpus distributions.
* </p>
* <p>For the integration tests, a small (8-document) collection is indexed. The
@@ -181,12 +181,11 @@ public class TestSimilarityBase extends
}
/**
* The generic test core called by all unit test methods. It calls the
- * {@link SimilarityBase#score(BasicStats, float, int)} method of all
+ * {@link SimilarityBase#score(BasicStats, float, float)} method of all
* Similarities in {@link #sims} and checks if the score is valid; i.e. it
* is a finite positive real number.
*/
- private void unitTestCore(BasicStats stats, float freq, int docLen)
- throws IOException {
+ private void unitTestCore(BasicStats stats, float freq, int docLen) {
for (SimilarityBase sim : sims) {
BasicStats realStats = (BasicStats) sim.computeWeight(stats.getTotalBoost(),
toCollectionStats(stats),
@@ -514,12 +513,11 @@ public class TestSimilarityBase extends
/**
* The generic test core called by all correctness test methods. It calls the
- * {@link SimilarityBase#score(BasicStats, float, int)} method of all
+ * {@link SimilarityBase#score(BasicStats, float, float)} method of all
* Similarities in {@link #sims} and compares the score against the manually
* computed {@code gold}.
*/
- private void correctnessTestCore(SimilarityBase sim, float gold)
- throws IOException {
+ private void correctnessTestCore(SimilarityBase sim, float gold) {
BasicStats stats = createStats();
BasicStats realStats = (BasicStats) sim.computeWeight(stats.getTotalBoost(),
toCollectionStats(stats),
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java Thu Jul 19 15:58:54 2012
@@ -23,10 +23,10 @@ import java.util.Map;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.Term;
+import org.apache.lucene.index.TermContext;
import org.apache.lucene.search.Weight;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.TermContext;
/**
* Holds all implementations of classes in the o.a.l.s.spans package as a
@@ -52,12 +52,12 @@ final class JustCompileSearchSpans {
}
@Override
- public boolean next() throws IOException {
+ public boolean next() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public boolean skipTo(int target) throws IOException {
+ public boolean skipTo(int target) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -67,7 +67,7 @@ final class JustCompileSearchSpans {
}
@Override
- public Collection<byte[]> getPayload() throws IOException {
+ public Collection<byte[]> getPayload() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -86,7 +86,7 @@ final class JustCompileSearchSpans {
}
@Override
- public Spans getSpans(AtomicReaderContext context, Bits acceptDocs, Map<Term,TermContext> termContexts) throws IOException {
+ public Spans getSpans(AtomicReaderContext context, Bits acceptDocs, Map<Term,TermContext> termContexts) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -100,7 +100,7 @@ final class JustCompileSearchSpans {
static final class JustCompilePayloadSpans extends Spans {
@Override
- public Collection<byte[]> getPayload() throws IOException {
+ public Collection<byte[]> getPayload() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -120,12 +120,12 @@ final class JustCompileSearchSpans {
}
@Override
- public boolean next() throws IOException {
+ public boolean next() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@Override
- public boolean skipTo(int target) throws IOException {
+ public boolean skipTo(int target) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
@@ -144,7 +144,7 @@ final class JustCompileSearchSpans {
}
@Override
- protected boolean setFreqCurrentDoc() throws IOException {
+ protected boolean setFreqCurrentDoc() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
}
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/MultiSpansWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/MultiSpansWrapper.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/MultiSpansWrapper.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/MultiSpansWrapper.java Thu Jul 19 15:58:54 2012
@@ -27,10 +27,10 @@ import java.util.TreeSet;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReaderContext;
+import org.apache.lucene.index.ReaderUtil;
import org.apache.lucene.index.Term;
+import org.apache.lucene.index.TermContext;
import org.apache.lucene.search.DocIdSetIterator;
-import org.apache.lucene.util.ReaderUtil;
-import org.apache.lucene.util.TermContext;
/**
*
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java Thu Jul 19 15:58:54 2012
@@ -81,7 +81,7 @@ public class TestBasics extends LuceneTe
@Override
public boolean incrementToken() throws IOException {
if (input.incrementToken()) {
- payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes()));
+ payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes("UTF-8")));
pos++;
return true;
} else {
@@ -411,7 +411,7 @@ public class TestBasics extends LuceneTe
@Test
public void testSpanPayloadCheck() throws Exception {
SpanTermQuery term1 = new SpanTermQuery(new Term("field", "five"));
- BytesRef pay = new BytesRef(("pos: " + 5).getBytes());
+ BytesRef pay = new BytesRef(("pos: " + 5).getBytes("UTF-8"));
SpanQuery query = new SpanPayloadCheckQuery(term1, Collections.singletonList(pay.bytes));
checkHits(query, new int[]
{1125, 1135, 1145, 1155, 1165, 1175, 1185, 1195, 1225, 1235, 1245, 1255, 1265, 1275, 1285, 1295, 1325, 1335, 1345, 1355, 1365, 1375, 1385, 1395, 1425, 1435, 1445, 1455, 1465, 1475, 1485, 1495, 1525, 1535, 1545, 1555, 1565, 1575, 1585, 1595, 1625, 1635, 1645, 1655, 1665, 1675, 1685, 1695, 1725, 1735, 1745, 1755, 1765, 1775, 1785, 1795, 1825, 1835, 1845, 1855, 1865, 1875, 1885, 1895, 1925, 1935, 1945, 1955, 1965, 1975, 1985, 1995});
@@ -426,8 +426,8 @@ public class TestBasics extends LuceneTe
clauses[0] = term1;
clauses[1] = term2;
snq = new SpanNearQuery(clauses, 0, true);
- pay = new BytesRef(("pos: " + 0).getBytes());
- pay2 = new BytesRef(("pos: " + 1).getBytes());
+ pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
+ pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
list = new ArrayList<byte[]>();
list.add(pay.bytes);
list.add(pay2.bytes);
@@ -439,9 +439,9 @@ public class TestBasics extends LuceneTe
clauses[1] = term2;
clauses[2] = new SpanTermQuery(new Term("field", "five"));
snq = new SpanNearQuery(clauses, 0, true);
- pay = new BytesRef(("pos: " + 0).getBytes());
- pay2 = new BytesRef(("pos: " + 1).getBytes());
- BytesRef pay3 = new BytesRef(("pos: " + 2).getBytes());
+ pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
+ pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
+ BytesRef pay3 = new BytesRef(("pos: " + 2).getBytes("UTF-8"));
list = new ArrayList<byte[]>();
list.add(pay.bytes);
list.add(pay2.bytes);
@@ -470,10 +470,10 @@ public class TestBasics extends LuceneTe
checkHits(query, new int[]{1103, 1203,1303,1403,1503,1603,1703,1803,1903});
Collection<byte[]> payloads = new ArrayList<byte[]>();
- BytesRef pay = new BytesRef(("pos: " + 0).getBytes());
- BytesRef pay2 = new BytesRef(("pos: " + 1).getBytes());
- BytesRef pay3 = new BytesRef(("pos: " + 3).getBytes());
- BytesRef pay4 = new BytesRef(("pos: " + 4).getBytes());
+ BytesRef pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
+ BytesRef pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
+ BytesRef pay3 = new BytesRef(("pos: " + 3).getBytes("UTF-8"));
+ BytesRef pay4 = new BytesRef(("pos: " + 4).getBytes("UTF-8"));
payloads.add(pay.bytes);
payloads.add(pay2.bytes);
payloads.add(pay3.bytes);
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java Thu Jul 19 15:58:54 2012
@@ -23,14 +23,17 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import org.apache.lucene.analysis.*;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.MockTokenizer;
+import org.apache.lucene.analysis.TokenFilter;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
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.RandomIndexWriter;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
@@ -42,7 +45,6 @@ import org.apache.lucene.search.payloads
import org.apache.lucene.search.similarities.DefaultSimilarity;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
@@ -248,8 +250,7 @@ public class TestPayloadSpans extends Lu
directory.close();
}
- public void testShrinkToAfterShortestMatch() throws CorruptIndexException,
- LockObtainFailedException, IOException {
+ public void testShrinkToAfterShortestMatch() throws IOException {
Directory directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig(TEST_VERSION_CURRENT, new TestPayloadAnalyzer()));
@@ -275,7 +276,7 @@ public class TestPayloadSpans extends Lu
Collection<byte[]> payloads = spans.getPayload();
for (final byte [] payload : payloads) {
- payloadSet.add(new String(payload));
+ payloadSet.add(new String(payload, "UTF-8"));
}
}
}
@@ -286,8 +287,7 @@ public class TestPayloadSpans extends Lu
directory.close();
}
- public void testShrinkToAfterShortestMatch2() throws CorruptIndexException,
- LockObtainFailedException, IOException {
+ public void testShrinkToAfterShortestMatch2() throws IOException {
Directory directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig(TEST_VERSION_CURRENT, new TestPayloadAnalyzer()));
@@ -311,7 +311,7 @@ public class TestPayloadSpans extends Lu
while (spans.next()) {
Collection<byte[]> payloads = spans.getPayload();
for (final byte[] payload : payloads) {
- payloadSet.add(new String(payload));
+ payloadSet.add(new String(payload, "UTF-8"));
}
}
}
@@ -322,8 +322,7 @@ public class TestPayloadSpans extends Lu
directory.close();
}
- public void testShrinkToAfterShortestMatch3() throws CorruptIndexException,
- LockObtainFailedException, IOException {
+ public void testShrinkToAfterShortestMatch3() throws IOException {
Directory directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig(TEST_VERSION_CURRENT, new TestPayloadAnalyzer()));
@@ -348,7 +347,7 @@ public class TestPayloadSpans extends Lu
Collection<byte[]> payloads = spans.getPayload();
for (final byte [] payload : payloads) {
- payloadSet.add(new String(payload));
+ payloadSet.add(new String(payload, "UTF-8"));
}
}
}
@@ -384,7 +383,7 @@ public class TestPayloadSpans extends Lu
System.out.println("Num payloads:" + payloads.size());
for (final byte [] bytes : payloads) {
if(VERBOSE)
- System.out.println(new String(bytes));
+ System.out.println(new String(bytes, "UTF-8"));
}
reader.close();
directory.close();
@@ -457,7 +456,7 @@ public class TestPayloadSpans extends Lu
for (final byte [] bytes : payload) {
if(VERBOSE)
System.out.println("doc:" + spans.doc() + " s:" + spans.start() + " e:" + spans.end() + " "
- + new String(bytes));
+ + new String(bytes, "UTF-8"));
}
assertEquals(numPayloads[cnt],payload.size());
@@ -506,9 +505,9 @@ public class TestPayloadSpans extends Lu
if (!nopayload.contains(token)) {
if (entities.contains(token)) {
- payloadAtt.setPayload(new BytesRef((token + ":Entity:"+ pos ).getBytes()));
+ payloadAtt.setPayload(new BytesRef(token + ":Entity:"+ pos ));
} else {
- payloadAtt.setPayload(new BytesRef((token + ":Noise:" + pos ).getBytes()));
+ payloadAtt.setPayload(new BytesRef(token + ":Noise:" + pos ));
}
}
pos += posIncrAtt.getPositionIncrement();
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java Thu Jul 19 15:58:54 2012
@@ -30,6 +30,7 @@ import org.apache.lucene.index.IndexRead
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.index.ReaderUtil;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.CheckHits;
import org.apache.lucene.search.DocIdSetIterator;
@@ -41,7 +42,6 @@ import org.apache.lucene.search.similari
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.ReaderUtil;
public class TestSpans extends LuceneTestCase {
private IndexSearcher searcher;
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java Thu Jul 19 15:58:54 2012
@@ -59,7 +59,7 @@ public class StressRamUsageEstimator ext
// Check the current memory consumption and provide the estimate.
long jvmUsed = memoryMXBean.getHeapMemoryUsage().getUsed();
long estimated = RamUsageEstimator.sizeOf(first);
- System.out.println(String.format(Locale.ENGLISH, "%10d, %10d",
+ System.out.println(String.format(Locale.ROOT, "%10d, %10d",
jvmUsed, estimated));
// Make a batch of objects.
@@ -125,7 +125,7 @@ public class StressRamUsageEstimator ext
break;
}
- System.out.println(String.format(Locale.ENGLISH, "%10s\t%10s\t%10s",
+ System.out.println(String.format(Locale.ROOT, "%10s\t%10s\t%10s",
RamUsageEstimator.humanReadableUnits(mu.getUsed()),
RamUsageEstimator.humanReadableUnits(mu.getMax()),
RamUsageEstimator.humanReadableUnits(estimated)));
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java?rev=1363400&r1=1363399&r2=1363400&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java Thu Jul 19 15:58:54 2012
@@ -91,7 +91,7 @@ public class TestBytesRefHash extends Lu
/**
* Test method for
- * {@link org.apache.lucene.util.BytesRefHash#get(org.apache.lucene.util.BytesRefHash.Entry)}
+ * {@link org.apache.lucene.util.BytesRefHash#get(int, BytesRef)}
* .
*/
@Test