diff --git a/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocsAndPositionsEnum.java b/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocsAndPositionsEnum.java index 816e454673e..e4eea034bd1 100644 --- a/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocsAndPositionsEnum.java +++ b/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocsAndPositionsEnum.java @@ -82,14 +82,17 @@ public class InstantiatedDocsAndPositionsEnum extends DocsAndPositionsEnum { return currentDoc.getTermPositions().length; } + @Override public int nextPosition() { return currentDoc.getTermPositions()[++posUpto]; } + @Override public boolean hasPayload() { return currentDoc.getPayloads()[posUpto] != null; } + @Override public BytesRef getPayload() { payload.bytes = currentDoc.getPayloads()[posUpto]; payload.length = payload.bytes.length; diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java b/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java index 870ebfade1e..f1c3f74a117 100644 --- a/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java +++ b/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java @@ -64,6 +64,7 @@ public class WindowsDirectory extends FSDirectory { super(path, null); } + @Override public IndexInput openInput(String name, int bufferSize) throws IOException { ensureOpen(); return new WindowsIndexInput(new File(getDirectory(), name), Math.max(bufferSize, DEFAULT_BUFFERSIZE)); @@ -82,14 +83,17 @@ public class WindowsDirectory extends FSDirectory { isOpen = true; } + @Override protected void readInternal(byte[] b, int offset, int length) throws IOException { if (WindowsDirectory.read(fd, b, offset, length, getFilePointer()) != length) throw new IOException("Read past EOF"); } + @Override protected void seekInternal(long pos) throws IOException { } + @Override public synchronized void close() throws IOException { // NOTE: we synchronize and track "isOpen" because Lucene sometimes closes IIs twice! if (!isClone && isOpen) { @@ -98,6 +102,7 @@ public class WindowsDirectory extends FSDirectory { } } + @Override public long length() { return length; } diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java index 5d044b9ad4c..5cba05b3111 100644 --- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java +++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java @@ -84,6 +84,7 @@ public class TestPrecedenceQueryParser extends LuceneTestCase { OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class); + @Override public boolean incrementToken() throws IOException { if (inPhrase) { inPhrase = false; @@ -108,6 +109,7 @@ public class TestPrecedenceQueryParser extends LuceneTestCase { public static final class QPTestAnalyzer extends Analyzer { /** Filters MockTokenizer with StopFilter. */ + @Override public final TokenStream tokenStream(String fieldName, Reader reader) { return new QPTestFilter(new MockTokenizer(reader, MockTokenizer.SIMPLE, true)); } @@ -115,6 +117,7 @@ public class TestPrecedenceQueryParser extends LuceneTestCase { private int originalMaxClauses; + @Override public void setUp() throws Exception { super.setUp(); originalMaxClauses = BooleanQuery.getMaxClauseCount(); @@ -627,6 +630,7 @@ public class TestPrecedenceQueryParser extends LuceneTestCase { } + @Override public void tearDown() { BooleanQuery.setMaxClauseCount(originalMaxClauses); } diff --git a/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java b/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java index f47d2a71bc0..b504f1557b9 100644 --- a/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java +++ b/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java @@ -194,6 +194,7 @@ final class FreqProxTermsWriterPerField extends TermsHashConsumerPerField implem return new FreqProxPostingsArray(size); } + @Override void copyTo(ParallelPostingsArray toArray, int numToCopy) { assert toArray instanceof FreqProxPostingsArray; FreqProxPostingsArray to = (FreqProxPostingsArray) toArray; diff --git a/lucene/src/java/org/apache/lucene/index/MultiReader.java b/lucene/src/java/org/apache/lucene/index/MultiReader.java index 0d3a082567b..c2682e40231 100644 --- a/lucene/src/java/org/apache/lucene/index/MultiReader.java +++ b/lucene/src/java/org/apache/lucene/index/MultiReader.java @@ -383,6 +383,7 @@ public class MultiReader extends IndexReader implements Cloneable { return subReaders; } + @Override public ReaderContext getTopReaderContext() { return topLevelContext; } diff --git a/lucene/src/java/org/apache/lucene/index/PerFieldCodecWrapper.java b/lucene/src/java/org/apache/lucene/index/PerFieldCodecWrapper.java index f7d4a1885d4..51c92321f54 100644 --- a/lucene/src/java/org/apache/lucene/index/PerFieldCodecWrapper.java +++ b/lucene/src/java/org/apache/lucene/index/PerFieldCodecWrapper.java @@ -204,6 +204,7 @@ final class PerFieldCodecWrapper extends Codec { } } + @Override public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException { return new FieldsReader(state.dir, state.fieldInfos, state.segmentInfo, diff --git a/lucene/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java b/lucene/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java index 4938538d054..2b4e35e09cd 100644 --- a/lucene/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java +++ b/lucene/src/java/org/apache/lucene/index/TermVectorsTermsWriterPerField.java @@ -281,6 +281,7 @@ final class TermVectorsTermsWriterPerField extends TermsHashConsumerPerField { int[] lastOffsets; // Last offset we saw int[] lastPositions; // Last position where this term occurred + @Override ParallelPostingsArray newInstance(int size) { return new TermVectorsPostingsArray(size); } diff --git a/lucene/src/java/org/apache/lucene/index/codecs/BlockTermsReader.java b/lucene/src/java/org/apache/lucene/index/codecs/BlockTermsReader.java index d4a6ac1bce7..e25364c33a3 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/BlockTermsReader.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/BlockTermsReader.java @@ -646,6 +646,7 @@ public class BlockTermsReader extends FieldsProducer { return SeekStatus.FOUND; } + @Override public long ord() { if (!doOrd) { throw new UnsupportedOperationException(); diff --git a/lucene/src/java/org/apache/lucene/index/codecs/preflex/SegmentTermPositions.java b/lucene/src/java/org/apache/lucene/index/codecs/preflex/SegmentTermPositions.java index f50d226741c..c642f6b1aaa 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/preflex/SegmentTermPositions.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/preflex/SegmentTermPositions.java @@ -58,6 +58,7 @@ extends SegmentTermDocs { this.proxStreamOrig = proxStream; // the proxStream will be cloned lazily when nextPosition() is called for the first time } + @Override final void seek(TermInfo ti, Term term) throws IOException { super.seek(ti, term); if (ti != null) @@ -69,6 +70,7 @@ extends SegmentTermDocs { needToLoadPayload = false; } + @Override public final void close() throws IOException { super.close(); if (proxStream != null) proxStream.close(); @@ -100,11 +102,13 @@ extends SegmentTermDocs { return delta; } + @Override protected final void skippingDoc() throws IOException { // we remember to skip a document lazily lazySkipProxCount += freq; } + @Override public final boolean next() throws IOException { // we remember to skip the remaining positions of the current // document lazily @@ -118,12 +122,14 @@ extends SegmentTermDocs { return false; } + @Override public final int read(final int[] docs, final int[] freqs) { throw new UnsupportedOperationException("TermPositions does not support processing multiple documents in one call. Use TermDocs instead."); } /** Called by super.skipTo(). */ + @Override protected void skipProx(long proxPointer, int payloadLength) throws IOException { // we save the pointer, we might have to skip there lazily lazySkipPointer = proxPointer; diff --git a/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java b/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java index adf0535390d..8205e73b972 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java @@ -67,15 +67,18 @@ public final class TermInfosReader { this.term = t; } + @Override public boolean equals(Object other) { CloneableTerm t = (CloneableTerm) other; return this.term.equals(t.term); } + @Override public int hashCode() { return term.hashCode(); } + @Override public Object clone() { return new CloneableTerm(term); } diff --git a/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java b/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java index 741272a329a..631476df0ba 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/sep/IntIndexInput.java @@ -48,6 +48,7 @@ public abstract class IntIndexInput implements Closeable { public abstract void set(Index other); + @Override public abstract Object clone(); } diff --git a/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java b/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java index 08e2781732c..b693db361c9 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java @@ -160,6 +160,7 @@ public class SepPostingsReaderImpl extends PostingsReaderBase { return other; } + @Override public void copyFrom(TermState _other) { super.copyFrom(_other); SepTermState other = (SepTermState) _other; diff --git a/lucene/src/java/org/apache/lucene/index/codecs/simpletext/SimpleTextFieldsReader.java b/lucene/src/java/org/apache/lucene/index/codecs/simpletext/SimpleTextFieldsReader.java index e40fba2f44e..ea74a6b6627 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/simpletext/SimpleTextFieldsReader.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/simpletext/SimpleTextFieldsReader.java @@ -129,6 +129,7 @@ class SimpleTextFieldsReader extends FieldsProducer { fstEnum = new BytesRefFSTEnum>>(fst); } + @Override public SeekStatus seek(BytesRef text, boolean useCache /* ignored */) throws IOException { //System.out.println("seek to text=" + text.utf8ToString()); diff --git a/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java b/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java index 0e53a99d536..0c9dd4f5c86 100644 --- a/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java +++ b/lucene/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReader.java @@ -99,12 +99,14 @@ public class StandardPostingsReader extends PostingsReaderBase { ByteArrayDataInput bytesReader; byte[] bytes; + @Override public Object clone() { StandardTermState other = new StandardTermState(); other.copyFrom(this); return other; } + @Override public void copyFrom(TermState _other) { super.copyFrom(_other); StandardTermState other = (StandardTermState) _other; @@ -118,6 +120,7 @@ public class StandardPostingsReader extends PostingsReaderBase { // (rare!), they will be re-read from disk. } + @Override public String toString() { return super.toString() + " freqFP=" + freqOffset + " proxFP=" + proxOffset + " skipOffset=" + skipOffset; } @@ -569,6 +572,7 @@ public class StandardPostingsReader extends PostingsReaderBase { return doc; } + @Override public int nextPosition() throws IOException { if (lazyProxPointer != -1) { @@ -597,10 +601,12 @@ public class StandardPostingsReader extends PostingsReaderBase { /** Returns the payload at this position, or null if no * payload was indexed. */ + @Override public BytesRef getPayload() throws IOException { throw new IOException("No payloads exist for this field!"); } + @Override public boolean hasPayload() { return false; } @@ -765,6 +771,7 @@ public class StandardPostingsReader extends PostingsReaderBase { return doc; } + @Override public int nextPosition() throws IOException { if (lazyProxPointer != -1) { @@ -825,6 +832,7 @@ public class StandardPostingsReader extends PostingsReaderBase { /** Returns the payload at this position, or null if no * payload was indexed. */ + @Override public BytesRef getPayload() throws IOException { assert lazyProxPointer == -1; assert posPendingCount < freq; @@ -842,6 +850,7 @@ public class StandardPostingsReader extends PostingsReaderBase { return payload; } + @Override public boolean hasPayload() { return payloadPending && payloadLength > 0; } diff --git a/lucene/src/java/org/apache/lucene/search/FuzzyTermsEnum.java b/lucene/src/java/org/apache/lucene/search/FuzzyTermsEnum.java index 40795000c82..ee5e274ffaf 100644 --- a/lucene/src/java/org/apache/lucene/search/FuzzyTermsEnum.java +++ b/lucene/src/java/org/apache/lucene/search/FuzzyTermsEnum.java @@ -261,6 +261,7 @@ public final class FuzzyTermsEnum extends TermsEnum { return actualEnum.docsAndPositions(skipDocs, reuse); } + @Override public void seek(BytesRef term, TermState state) throws IOException { actualEnum.seek(term, state); } diff --git a/lucene/src/java/org/apache/lucene/search/TotalHitCountCollector.java b/lucene/src/java/org/apache/lucene/search/TotalHitCountCollector.java index 533d69c65d3..b154091e27d 100644 --- a/lucene/src/java/org/apache/lucene/search/TotalHitCountCollector.java +++ b/lucene/src/java/org/apache/lucene/search/TotalHitCountCollector.java @@ -31,16 +31,20 @@ public class TotalHitCountCollector extends Collector { return totalHits; } + @Override public void setScorer(Scorer scorer) { } + @Override public void collect(int doc) { totalHits++; } + @Override public void setNextReader(AtomicReaderContext context) { } + @Override public boolean acceptsDocsOutOfOrder() { return true; } diff --git a/lucene/src/java/org/apache/lucene/search/cache/EntryCreator.java b/lucene/src/java/org/apache/lucene/search/cache/EntryCreator.java index 0e0daff40cd..362cc83a71e 100644 --- a/lucene/src/java/org/apache/lucene/search/cache/EntryCreator.java +++ b/lucene/src/java/org/apache/lucene/search/cache/EntryCreator.java @@ -58,6 +58,7 @@ public abstract class EntryCreator implements Serializable // This can be removed //------------------------------------------------------------------------ + @Override public boolean equals(Object obj) { if( obj instanceof EntryCreator ) { return getCacheKey().equals( ((EntryCreator)obj).getCacheKey() ); diff --git a/lucene/src/java/org/apache/lucene/search/function/MultiValueSource.java b/lucene/src/java/org/apache/lucene/search/function/MultiValueSource.java index 7dbccb25a69..b3ec7681ad1 100644 --- a/lucene/src/java/org/apache/lucene/search/function/MultiValueSource.java +++ b/lucene/src/java/org/apache/lucene/search/function/MultiValueSource.java @@ -52,6 +52,7 @@ public final class MultiValueSource extends ValueSource { return other.getValues(context); } + @Override public DocValues getValues(ReaderContext context) throws IOException { if (context.isAtomic) { return getValues((AtomicReaderContext) context); diff --git a/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java b/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java index 19a771213ba..35356f30f7d 100644 --- a/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java +++ b/lucene/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java @@ -219,6 +219,7 @@ public class PayloadNearQuery extends SpanNearQuery { return true; } + @Override public float score() throws IOException { return super.score() diff --git a/lucene/src/java/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.java b/lucene/src/java/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.java index 5fce135941b..2b17f627327 100644 --- a/lucene/src/java/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.java +++ b/lucene/src/java/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.java @@ -72,6 +72,7 @@ public class SpanNearPayloadCheckQuery extends SpanPositionCheckQuery { return AcceptStatus.NO; } + @Override public String toString(String field) { StringBuilder buffer = new StringBuilder(); buffer.append("spanPayCheck("); diff --git a/lucene/src/java/org/apache/lucene/search/spans/SpanPayloadCheckQuery.java b/lucene/src/java/org/apache/lucene/search/spans/SpanPayloadCheckQuery.java index 69dbc306f19..086dad2f929 100644 --- a/lucene/src/java/org/apache/lucene/search/spans/SpanPayloadCheckQuery.java +++ b/lucene/src/java/org/apache/lucene/search/spans/SpanPayloadCheckQuery.java @@ -74,6 +74,7 @@ public class SpanPayloadCheckQuery extends SpanPositionCheckQuery{ return AcceptStatus.YES; } + @Override public String toString(String field) { StringBuilder buffer = new StringBuilder(); buffer.append("spanPayCheck("); diff --git a/lucene/src/java/org/apache/lucene/util/BytesRef.java b/lucene/src/java/org/apache/lucene/util/BytesRef.java index 1ec291a5c65..a90b6fb682d 100644 --- a/lucene/src/java/org/apache/lucene/util/BytesRef.java +++ b/lucene/src/java/org/apache/lucene/util/BytesRef.java @@ -209,6 +209,7 @@ public final class BytesRef implements Comparable, Externalizable { } /** Returns hex encoded bytes, eg [0x6c 0x75 0x63 0x65 0x6e 0x65] */ + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append('['); diff --git a/lucene/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java b/lucene/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java index a0dd7c19f08..cdb958ef252 100644 --- a/lucene/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java +++ b/lucene/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java @@ -45,6 +45,7 @@ import java.util.Map; final public class DoubleBarrelLRUCache { public static abstract class CloneableKey { + @Override abstract public Object clone(); } diff --git a/lucene/src/java/org/apache/lucene/util/IntsRef.java b/lucene/src/java/org/apache/lucene/util/IntsRef.java index 1f284b5ea51..ee1bd2ed69c 100644 --- a/lucene/src/java/org/apache/lucene/util/IntsRef.java +++ b/lucene/src/java/org/apache/lucene/util/IntsRef.java @@ -123,6 +123,7 @@ public final class IntsRef implements Comparable { } } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append('['); diff --git a/lucene/src/java/org/apache/lucene/util/ReaderUtil.java b/lucene/src/java/org/apache/lucene/util/ReaderUtil.java index 772b5ebf751..8d772880d0b 100644 --- a/lucene/src/java/org/apache/lucene/util/ReaderUtil.java +++ b/lucene/src/java/org/apache/lucene/util/ReaderUtil.java @@ -47,6 +47,7 @@ public final class ReaderUtil { this.readerIndex = readerIndex; } + @Override public String toString() { return "slice start=" + start + " length=" + length + " readerIndex=" + readerIndex; } diff --git a/lucene/src/java/org/apache/lucene/util/automaton/BasicOperations.java b/lucene/src/java/org/apache/lucene/util/automaton/BasicOperations.java index ce1c19001b2..e7e9b301482 100644 --- a/lucene/src/java/org/apache/lucene/util/automaton/BasicOperations.java +++ b/lucene/src/java/org/apache/lucene/util/automaton/BasicOperations.java @@ -483,10 +483,12 @@ final public class BasicOperations { starts.count = 0; } + @Override public boolean equals(Object other) { return ((PointTransitions) other).point == point; } + @Override public int hashCode() { return point; } @@ -563,6 +565,7 @@ final public class BasicOperations { find(1+t.max).ends.add(t); } + @Override public String toString() { StringBuilder s = new StringBuilder(); for(int i=0;i extends Outputs> { } } + @Override public int hashCode() { return output1.hashCode() + output2.hashCode(); } diff --git a/lucene/src/java/org/apache/lucene/util/packed/Packed32.java b/lucene/src/java/org/apache/lucene/util/packed/Packed32.java index c8bb011c209..ff22ad7ef48 100644 --- a/lucene/src/java/org/apache/lucene/util/packed/Packed32.java +++ b/lucene/src/java/org/apache/lucene/util/packed/Packed32.java @@ -214,6 +214,7 @@ class Packed32 extends PackedInts.ReaderImpl implements PackedInts.Mutable { Arrays.fill(blocks, 0); } + @Override public String toString() { return "Packed32(bitsPerValue=" + bitsPerValue + ", maxPos=" + maxPos + ", elements.length=" + blocks.length + ")"; diff --git a/lucene/src/java/org/apache/lucene/util/packed/Packed64.java b/lucene/src/java/org/apache/lucene/util/packed/Packed64.java index b3826676503..62e77934ef3 100644 --- a/lucene/src/java/org/apache/lucene/util/packed/Packed64.java +++ b/lucene/src/java/org/apache/lucene/util/packed/Packed64.java @@ -199,6 +199,7 @@ class Packed64 extends PackedInts.ReaderImpl implements PackedInts.Mutable { | ((value << shifts[base + 2]) & writeMasks[base+2]); } + @Override public String toString() { return "Packed64(bitsPerValue=" + bitsPerValue + ", size=" + size() + ", maxPos=" + maxPos diff --git a/lucene/src/java/org/apache/lucene/util/packed/PackedWriter.java b/lucene/src/java/org/apache/lucene/util/packed/PackedWriter.java index 0cf054991ba..b2c86dd799f 100644 --- a/lucene/src/java/org/apache/lucene/util/packed/PackedWriter.java +++ b/lucene/src/java/org/apache/lucene/util/packed/PackedWriter.java @@ -106,6 +106,7 @@ class PackedWriter extends PackedInts.Writer { } } + @Override public String toString() { return "PackedWriter(written " + written + "/" + valueCount + " with " + bitsPerValue + " bits/value)"; diff --git a/lucene/src/test/org/apache/lucene/TestAssertions.java b/lucene/src/test/org/apache/lucene/TestAssertions.java index 373fd3db271..ce51fd34484 100644 --- a/lucene/src/test/org/apache/lucene/TestAssertions.java +++ b/lucene/src/test/org/apache/lucene/TestAssertions.java @@ -35,34 +35,45 @@ public class TestAssertions extends LuceneTestCase { } static class TestAnalyzer1 extends Analyzer { + @Override public final TokenStream tokenStream(String s, Reader r) { return null; } + @Override public final TokenStream reusableTokenStream(String s, Reader r) { return null; } } static final class TestAnalyzer2 extends Analyzer { + @Override public TokenStream tokenStream(String s, Reader r) { return null; } + @Override public TokenStream reusableTokenStream(String s, Reader r) { return null; } } static class TestAnalyzer3 extends Analyzer { + @Override public TokenStream tokenStream(String s, Reader r) { return null; } + @Override public TokenStream reusableTokenStream(String s, Reader r) { return null; } } static class TestAnalyzer4 extends Analyzer { + @Override public final TokenStream tokenStream(String s, Reader r) { return null; } + @Override public TokenStream reusableTokenStream(String s, Reader r) { return null; } } static class TestTokenStream1 extends TokenStream { + @Override public final boolean incrementToken() { return false; } } static final class TestTokenStream2 extends TokenStream { + @Override public boolean incrementToken() { return false; } } static class TestTokenStream3 extends TokenStream { + @Override public boolean incrementToken() { return false; } } diff --git a/lucene/src/test/org/apache/lucene/TestExternalCodecs.java b/lucene/src/test/org/apache/lucene/TestExternalCodecs.java index 4252f752488..e7ff3954542 100644 --- a/lucene/src/test/org/apache/lucene/TestExternalCodecs.java +++ b/lucene/src/test/org/apache/lucene/TestExternalCodecs.java @@ -63,6 +63,7 @@ public class TestExternalCodecs extends LuceneTestCase { return t2.length-t1.length; } + @Override public boolean equals(Object other) { return this == other; } @@ -344,6 +345,7 @@ public class TestExternalCodecs extends LuceneTestCase { return ramField.termToDocs.get(current).totalTermFreq; } + @Override public DocsEnum docs(Bits skipDocs, DocsEnum reuse) { return new RAMDocsEnum(ramField.termToDocs.get(current), skipDocs); } diff --git a/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java b/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java index bac72b5951d..1d2ab4371b7 100644 --- a/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java +++ b/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java @@ -227,6 +227,7 @@ public class TestCharTermAttributeImpl extends LuceneTestCase { public char charAt(int i) { return longTestString.charAt(i); } public int length() { return longTestString.length(); } public CharSequence subSequence(int start, int end) { return longTestString.subSequence(start, end); } + @Override public String toString() { return longTestString; } }); assertEquals("4567890123456"+longTestString, t.toString()); diff --git a/lucene/src/test/org/apache/lucene/index/TestDocsAndPositions.java b/lucene/src/test/org/apache/lucene/index/TestDocsAndPositions.java index 7929a4519b5..a3f02482b93 100644 --- a/lucene/src/test/org/apache/lucene/index/TestDocsAndPositions.java +++ b/lucene/src/test/org/apache/lucene/index/TestDocsAndPositions.java @@ -36,6 +36,7 @@ public class TestDocsAndPositions extends LuceneTestCase { private String fieldName; private boolean usePayload; + @Override public void setUp() throws Exception { super.setUp(); fieldName = "field" + random.nextInt(); diff --git a/lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java b/lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java index 5f4dfd36e80..c17dc38b9aa 100644 --- a/lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java +++ b/lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java @@ -38,9 +38,11 @@ public class TestFilterIndexReader extends LuceneTestCase { TestFields(Fields in) { super(in); } + @Override public FieldsEnum iterator() throws IOException { return new TestFieldsEnum(super.iterator()); } + @Override public Terms terms(String field) throws IOException { return new TestTerms(super.terms(field)); } @@ -51,6 +53,7 @@ public class TestFilterIndexReader extends LuceneTestCase { super(in); } + @Override public TermsEnum iterator() throws IOException { return new TestTermsEnum(super.iterator()); } @@ -61,6 +64,7 @@ public class TestFilterIndexReader extends LuceneTestCase { super(in); } + @Override public TermsEnum terms() throws IOException { return new TestTermsEnum(super.terms()); } diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java index 60f5e49fbb0..8607d8fed1b 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java @@ -971,6 +971,7 @@ public class TestIndexWriterReader extends LuceneTestCase { setMaxBufferedDocs(2). setReaderPooling(true). setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() { + @Override public void warm(IndexReader r) throws IOException { IndexSearcher s = new IndexSearcher(r); TopDocs hits = s.search(new TermQuery(new Term("foo", "bar")), 10); diff --git a/lucene/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java b/lucene/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java index 425e790784d..92c3689612a 100644 --- a/lucene/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java +++ b/lucene/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java @@ -53,6 +53,7 @@ public class TestMultiLevelSkipList extends LuceneTestCase { super(random, delegate); } + @Override public IndexInput openInput(String fileName) throws IOException { IndexInput in = super.openInput(fileName); if (fileName.endsWith(".frq")) @@ -61,6 +62,7 @@ public class TestMultiLevelSkipList extends LuceneTestCase { } } + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/lucene/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java b/lucene/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java index a18e2eaee48..c7312b45ab8 100644 --- a/lucene/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java +++ b/lucene/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java @@ -257,6 +257,7 @@ public class TestPerSegmentDeletes extends LuceneTestCase { @Override public void close() {} + @Override public MergeSpecification findMerges(SegmentInfos segmentInfos) throws CorruptIndexException, IOException { MergeSpecification ms = new MergeSpecification(); diff --git a/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java b/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java index 58e4e4d5b03..f5809dd1931 100644 --- a/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java +++ b/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java @@ -40,6 +40,7 @@ public class TestAutomatonQuery extends LuceneTestCase { private final String FN = "field"; + @Override public void setUp() throws Exception { super.setUp(); directory = newDirectory(); @@ -65,6 +66,7 @@ public class TestAutomatonQuery extends LuceneTestCase { writer.close(); } + @Override public void tearDown() throws Exception { searcher.close(); reader.close(); diff --git a/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java b/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java index 29bec6c066a..b764dc0fc4f 100644 --- a/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java +++ b/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java @@ -41,6 +41,7 @@ public class TestAutomatonQueryUnicode extends LuceneTestCase { private final String FN = "field"; + @Override public void setUp() throws Exception { super.setUp(); directory = newDirectory(); @@ -85,6 +86,7 @@ public class TestAutomatonQueryUnicode extends LuceneTestCase { writer.close(); } + @Override public void tearDown() throws Exception { searcher.close(); reader.close(); diff --git a/lucene/src/test/org/apache/lucene/search/TestRegexpQuery.java b/lucene/src/test/org/apache/lucene/search/TestRegexpQuery.java index 254246bf210..65552c46f1f 100644 --- a/lucene/src/test/org/apache/lucene/search/TestRegexpQuery.java +++ b/lucene/src/test/org/apache/lucene/search/TestRegexpQuery.java @@ -42,6 +42,7 @@ public class TestRegexpQuery extends LuceneTestCase { private Directory directory; private final String FN = "field"; + @Override public void setUp() throws Exception { super.setUp(); directory = newDirectory(); @@ -56,6 +57,7 @@ public class TestRegexpQuery extends LuceneTestCase { searcher = new IndexSearcher(reader); } + @Override public void tearDown() throws Exception { searcher.close(); reader.close(); diff --git a/lucene/src/test/org/apache/lucene/search/cache/TestEntryCreators.java b/lucene/src/test/org/apache/lucene/search/cache/TestEntryCreators.java index 4485adb82dc..fad6f63c3f2 100644 --- a/lucene/src/test/org/apache/lucene/search/cache/TestEntryCreators.java +++ b/lucene/src/test/org/apache/lucene/search/cache/TestEntryCreators.java @@ -54,6 +54,7 @@ public class TestEntryCreators extends LuceneTestCase { this.parser = parser; values = new Number[NUM_DOCS]; } + @Override public String toString() { return field; diff --git a/lucene/src/test/org/apache/lucene/util/LuceneJUnitDividingSelector.java b/lucene/src/test/org/apache/lucene/util/LuceneJUnitDividingSelector.java index cf27a7267fc..5a9509c5a82 100644 --- a/lucene/src/test/org/apache/lucene/util/LuceneJUnitDividingSelector.java +++ b/lucene/src/test/org/apache/lucene/util/LuceneJUnitDividingSelector.java @@ -30,6 +30,7 @@ public class LuceneJUnitDividingSelector extends BaseExtendSelector { /** Current part to accept. */ private int part; + @Override public void setParameters(Parameter[] pParameters) { super.setParameters(pParameters); for (int j = 0; j < pParameters.length; j++) { @@ -46,6 +47,7 @@ public class LuceneJUnitDividingSelector extends BaseExtendSelector { } } + @Override public void verifySettings() { super.verifySettings(); if (divisor <= 0 || part <= 0) { @@ -56,6 +58,7 @@ public class LuceneJUnitDividingSelector extends BaseExtendSelector { } } + @Override public boolean isSelected(File dir, String name, File path) { counter = counter % divisor + 1; return counter == part; diff --git a/lucene/src/test/org/apache/lucene/util/TestBytesRefHash.java b/lucene/src/test/org/apache/lucene/util/TestBytesRefHash.java index 553898a8a8c..2c82aea6ff3 100644 --- a/lucene/src/test/org/apache/lucene/util/TestBytesRefHash.java +++ b/lucene/src/test/org/apache/lucene/util/TestBytesRefHash.java @@ -40,6 +40,7 @@ public class TestBytesRefHash extends LuceneTestCase { /** */ + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/lucene/src/test/org/apache/lucene/util/TestDoubleBarrelLRUCache.java b/lucene/src/test/org/apache/lucene/util/TestDoubleBarrelLRUCache.java index 03a935a6fef..952c218de3f 100644 --- a/lucene/src/test/org/apache/lucene/util/TestDoubleBarrelLRUCache.java +++ b/lucene/src/test/org/apache/lucene/util/TestDoubleBarrelLRUCache.java @@ -145,14 +145,17 @@ public class TestDoubleBarrelLRUCache extends LuceneTestCase { this.value = value; } + @Override public boolean equals(Object other) { return this.value.equals(((CloneableObject) other).value); } + @Override public int hashCode() { return value.hashCode(); } + @Override public Object clone() { return new CloneableObject(value); } @@ -165,14 +168,17 @@ public class TestDoubleBarrelLRUCache extends LuceneTestCase { this.value = value; } + @Override public boolean equals(Object other) { return this.value.equals(((CloneableInteger) other).value); } + @Override public int hashCode() { return value.hashCode(); } + @Override public Object clone() { return new CloneableInteger(value); } diff --git a/lucene/src/test/org/apache/lucene/util/TestRecyclingByteBlockAllocator.java b/lucene/src/test/org/apache/lucene/util/TestRecyclingByteBlockAllocator.java index beac79df7c9..b6c1c4d4f9c 100644 --- a/lucene/src/test/org/apache/lucene/util/TestRecyclingByteBlockAllocator.java +++ b/lucene/src/test/org/apache/lucene/util/TestRecyclingByteBlockAllocator.java @@ -31,6 +31,7 @@ public class TestRecyclingByteBlockAllocator extends LuceneTestCase { /** */ + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/lucene/src/test/org/apache/lucene/util/automaton/fst/TestFSTs.java b/lucene/src/test/org/apache/lucene/util/automaton/fst/TestFSTs.java index 4922a1e0d64..f7d54753271 100644 --- a/lucene/src/test/org/apache/lucene/util/automaton/fst/TestFSTs.java +++ b/lucene/src/test/org/apache/lucene/util/automaton/fst/TestFSTs.java @@ -59,11 +59,13 @@ public class TestFSTs extends LuceneTestCase { private MockDirectoryWrapper dir; + @Override public void setUp() throws IOException { dir = newDirectory(); dir.setPreventDoubleWrite(false); } + @Override public void tearDown() throws IOException { dir.close(); } diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java index 87591992e1f..ff3f20fb8a1 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java @@ -673,6 +673,7 @@ public class HTMLStripCharFilter extends BaseCharFilter { + @Override public int read() throws IOException { // TODO: Do we ever want to preserve CDATA sections? // where do we have to worry about them? @@ -741,6 +742,7 @@ public class HTMLStripCharFilter extends BaseCharFilter { } + @Override public int read(char cbuf[], int off, int len) throws IOException { int i=0; for (i=0; ioutput:"the-rain", "rain-in" ,"in-spain", "falls", "mainly" * */ + @Override public boolean incrementToken() throws IOException { while (input.incrementToken()) { State current = captureState(); diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianCharFilter.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianCharFilter.java index c1ed38acfa5..962f839d45c 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianCharFilter.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianCharFilter.java @@ -32,6 +32,7 @@ public class PersianCharFilter extends CharFilter { super(in); } + @Override public int read(char[] cbuf, int off, int len) throws IOException { final int charsRead = super.read(cbuf, off, len); if (charsRead > 0) { diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceCharFilter.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceCharFilter.java index 0ccbb85b074..77f5c95475f 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceCharFilter.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceCharFilter.java @@ -113,6 +113,7 @@ public class PatternReplaceCharFilter extends BaseCharFilter { } } + @Override public int read() throws IOException { while( prepareReplaceBlock() ){ return replaceBlockBuffer.charAt( replaceBlockBufferOffset++ ); @@ -120,6 +121,7 @@ public class PatternReplaceCharFilter extends BaseCharFilter { return -1; } + @Override public int read(char[] cbuf, int off, int len) throws IOException { char[] tmp = new char[len]; int l = input.read(tmp, 0, len); diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java index ea8ba38c996..a74b3f8e9e7 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java @@ -78,6 +78,7 @@ public class SynonymMap { } + @Override public String toString() { StringBuilder sb = new StringBuilder("<"); if (synonyms!=null) { diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestRemoveDuplicatesTokenFilter.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestRemoveDuplicatesTokenFilter.java index 946f9787c4c..9f3a28ad638 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestRemoveDuplicatesTokenFilter.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestRemoveDuplicatesTokenFilter.java @@ -47,6 +47,7 @@ public class TestRemoveDuplicatesTokenFilter extends BaseTokenStreamTestCase { CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class); PositionIncrementAttribute posIncAtt = addAttribute(PositionIncrementAttribute.class); + @Override public boolean incrementToken() { if (toks.hasNext()) { clearAttributes(); diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestTrimFilter.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestTrimFilter.java index 4e65f9b11a4..256cbacd1ca 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestTrimFilter.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestTrimFilter.java @@ -87,6 +87,7 @@ public class TestTrimFilter extends BaseTokenStreamTestCase { this(tokens.toArray(new Token[tokens.size()])); } + @Override public boolean incrementToken() throws IOException { if (index >= tokens.length) return false; diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestWordDelimiterFilter.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestWordDelimiterFilter.java index c784130d439..3d081184e58 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestWordDelimiterFilter.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestWordDelimiterFilter.java @@ -213,6 +213,7 @@ public class TestWordDelimiterFilter extends BaseTokenStreamTestCase { /* analyzer that uses whitespace + wdf */ Analyzer a = new Analyzer() { + @Override public TokenStream tokenStream(String field, Reader reader) { return new WordDelimiterFilter( new WhitespaceTokenizer(TEST_VERSION_CURRENT, reader), @@ -239,6 +240,7 @@ public class TestWordDelimiterFilter extends BaseTokenStreamTestCase { /* analyzer that will consume tokens with large position increments */ Analyzer a2 = new Analyzer() { + @Override public TokenStream tokenStream(String field, Reader reader) { return new WordDelimiterFilter( new LargePosIncTokenFilter( @@ -271,6 +273,7 @@ public class TestWordDelimiterFilter extends BaseTokenStreamTestCase { new int[] { 1, 11, 1 }); Analyzer a3 = new Analyzer() { + @Override public TokenStream tokenStream(String field, Reader reader) { StopFilter filter = new StopFilter(TEST_VERSION_CURRENT, new WhitespaceTokenizer(TEST_VERSION_CURRENT, reader), StandardAnalyzer.STOP_WORDS_SET); diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymFilter.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymFilter.java index 2c68e047abf..29c26d6ff2b 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymFilter.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/synonym/TestSynonymFilter.java @@ -395,6 +395,7 @@ public class TestSynonymFilter extends BaseTokenStreamTestCase { this(tokens.toArray(new Token[tokens.size()])); } + @Override public boolean incrementToken() throws IOException { if (index >= tokens.length) return false; diff --git a/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java b/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java index 126ea09c744..b0cb1981d89 100644 --- a/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java +++ b/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java @@ -77,6 +77,7 @@ public class CarrotClusteringEngine extends SearchClusteringEngine { private String idFieldName; + @Override @Deprecated public Object cluster(Query query, DocList docList, SolrQueryRequest sreq) { SolrIndexSearcher searcher = sreq.getSearcher(); @@ -90,6 +91,7 @@ public class CarrotClusteringEngine extends SearchClusteringEngine { } } + @Override public Object cluster(Query query, SolrDocumentList solrDocList, Map docIds, SolrQueryRequest sreq) { try { diff --git a/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java b/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java index 8efd3ab1be6..857fccf48f3 100644 --- a/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java +++ b/solr/contrib/clustering/src/main/java/org/apache/solr/handler/clustering/carrot2/LuceneLanguageModelFactory.java @@ -69,7 +69,8 @@ public class LuceneLanguageModelFactory extends DefaultLanguageModelFactory { /** * Provide an {@link IStemmer} implementation for a given language. */ - protected IStemmer createStemmer(LanguageCode language) { + @Override + protected IStemmer createStemmer(LanguageCode language) { switch (language) { case ARABIC: return ArabicStemmerFactory.createStemmer(); diff --git a/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/MockDocumentClusteringEngine.java b/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/MockDocumentClusteringEngine.java index 90f0ab73e5a..77b3fcfba06 100644 --- a/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/MockDocumentClusteringEngine.java +++ b/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/MockDocumentClusteringEngine.java @@ -25,11 +25,13 @@ import org.apache.solr.search.DocSet; * **/ public class MockDocumentClusteringEngine extends DocumentClusteringEngine { + @Override public NamedList cluster(DocSet docs, SolrParams solrParams) { NamedList result = new NamedList(); return result; } + @Override public NamedList cluster(SolrParams solrParams) { NamedList result = new NamedList(); return result; diff --git a/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java b/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java index 5b9374c744a..0231d1ec7e3 100644 --- a/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java @@ -51,6 +51,7 @@ public class MailEntityProcessor extends EntityProcessorBase { public SearchTerm getCustomSearch(Folder folder); } + @Override public void init(Context context) { super.init(context); // set attributes using XXX getXXXFromContext(attribute, defualtValue); @@ -95,6 +96,7 @@ public class MailEntityProcessor extends EntityProcessorBase { logConfig(); } + @Override public Map nextRow() { Message mail; Map row = null; diff --git a/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java b/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java index 4e4ad41afbe..b7b31ab5abb 100644 --- a/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java @@ -92,6 +92,7 @@ public class TikaEntityProcessor extends EntityProcessorBase { done = false; } + @Override public Map nextRow() { if(done) return null; Map row = new HashMap(); diff --git a/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestMailEntityProcessor.java b/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestMailEntityProcessor.java index 8a1f1083d4e..2ac19b32192 100644 --- a/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestMailEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestMailEntityProcessor.java @@ -191,18 +191,22 @@ public class TestMailEntityProcessor extends AbstractDataImportHandlerTestCase { super(null, ".", null); } + @Override public boolean upload(SolrInputDocument doc) { return docs.add(doc); } + @Override public void log(int event, String name, Object row) { // Do nothing } + @Override public void doDeleteAll() { deleteAllCalled = Boolean.TRUE; } + @Override public void commit(boolean b) { commitCalled = Boolean.TRUE; } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinContentStreamDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinContentStreamDataSource.java index 221d8eacbc7..1187f65e92d 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinContentStreamDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinContentStreamDataSource.java @@ -39,10 +39,12 @@ public class BinContentStreamDataSource extends DataSource { private InputStream in; + @Override public void init(Context context, Properties initProps) { this.context = (ContextImpl) context; } + @Override public InputStream getData(String query) { contentStream = context.getDocBuilder().requestParameters.contentStream; if (contentStream == null) @@ -55,6 +57,7 @@ public class BinContentStreamDataSource extends DataSource { } } + @Override public void close() { if (contentStream != null) { try { diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinFileDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinFileDataSource.java index 4d4cdebc62b..e473ab8da32 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinFileDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinFileDataSource.java @@ -43,10 +43,12 @@ import java.util.Properties; public class BinFileDataSource extends DataSource{ protected String basePath; + @Override public void init(Context context, Properties initProps) { basePath = initProps.getProperty(FileDataSource.BASE_PATH); } + @Override public InputStream getData(String query) { File f = FileDataSource.getFile(basePath,query); try { @@ -57,6 +59,7 @@ public class BinFileDataSource extends DataSource{ } } + @Override public void close() { } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinURLDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinURLDataSource.java index 9d4d879c2ce..045d6fa3bd0 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinURLDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/BinURLDataSource.java @@ -49,6 +49,7 @@ public class BinURLDataSource extends DataSource{ public BinURLDataSource() { } + @Override public void init(Context context, Properties initProps) { this.context = context; this.initProps = initProps; @@ -72,6 +73,7 @@ public class BinURLDataSource extends DataSource{ } } + @Override public InputStream getData(String query) { URL url = null; try { @@ -89,6 +91,7 @@ public class BinURLDataSource extends DataSource{ } } + @Override public void close() { } private String getInitPropWithReplacements(String propertyName) { diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/CachedSqlEntityProcessor.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/CachedSqlEntityProcessor.java index 69b7b2b6f18..864e772288e 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/CachedSqlEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/CachedSqlEntityProcessor.java @@ -38,6 +38,7 @@ import java.util.Map; public class CachedSqlEntityProcessor extends SqlEntityProcessor { private boolean isFirst; + @Override @SuppressWarnings("unchecked") public void init(Context context) { super.init(context); @@ -45,6 +46,7 @@ public class CachedSqlEntityProcessor extends SqlEntityProcessor { isFirst = true; } + @Override public Map nextRow() { if (dataSourceRowCache != null) return getFromRowCacheTransformed(); @@ -60,6 +62,7 @@ public class CachedSqlEntityProcessor extends SqlEntityProcessor { } + @Override protected List> getAllNonCachedRows() { List> rows = new ArrayList>(); String q = getQuery(); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ClobTransformer.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ClobTransformer.java index 5ebd3baa5dd..ae970d25fdb 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ClobTransformer.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ClobTransformer.java @@ -37,6 +37,7 @@ import java.util.Map; * @since solr 1.4 */ public class ClobTransformer extends Transformer { + @Override public Object transformRow(Map aRow, Context context) { for (Map map : context.getAllEntityFields()) { if (!TRUE.equals(map.get(CLOB))) continue; diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ContentStreamDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ContentStreamDataSource.java index 3b55fd6cf5e..58ed19ed595 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ContentStreamDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ContentStreamDataSource.java @@ -39,10 +39,12 @@ public class ContentStreamDataSource extends DataSource { private ContentStream contentStream; private Reader reader; + @Override public void init(Context context, Properties initProps) { this.context = (ContextImpl) context; } + @Override public Reader getData(String query) { contentStream = context.getDocBuilder().requestParameters.contentStream; if (contentStream == null) @@ -55,6 +57,7 @@ public class ContentStreamDataSource extends DataSource { } } + @Override public void close() { if (contentStream != null) { try { diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ContextImpl.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ContextImpl.java index 6dfa48276c9..bd726835e2d 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ContextImpl.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ContextImpl.java @@ -71,22 +71,27 @@ public class ContextImpl extends Context { parent = parentContext; } + @Override public String getEntityAttribute(String name) { return entity == null ? null : entity.allAttributes.get(name); } + @Override public String getResolvedEntityAttribute(String name) { return entity == null ? null : resolver.replaceTokens(entity.allAttributes.get(name)); } + @Override public List> getAllEntityFields() { return entity == null ? Collections.EMPTY_LIST : entity.allFieldsList; } + @Override public VariableResolver getVariableResolver() { return resolver; } + @Override public DataSource getDataSource() { if (ds != null) return ds; if(entity == null) return null; @@ -101,26 +106,32 @@ public class ContextImpl extends Context { return entity.dataSrc; } + @Override public DataSource getDataSource(String name) { return dataImporter.getDataSourceInstance(entity, name, this); } + @Override public boolean isRootEntity() { return entity.isDocRoot; } + @Override public String currentProcess() { return currProcess; } + @Override public Map getRequestParameters() { return requestParams; } + @Override public EntityProcessor getEntityProcessor() { return entity == null ? null : entity.processor; } + @Override public void setSessionAttribute(String name, Object val, String scope) { if(name == null) return; if (Context.SCOPE_ENTITY.equals(scope)) { @@ -148,6 +159,7 @@ public class ContextImpl extends Context { else entitySession.put(name, val); } + @Override public Object getSessionAttribute(String name, String scope) { if (Context.SCOPE_ENTITY.equals(scope)) { if (entitySession == null) @@ -166,6 +178,7 @@ public class ContextImpl extends Context { return null; } + @Override public Context getParentContext() { return parent; } @@ -187,15 +200,18 @@ public class ContextImpl extends Context { } + @Override public SolrCore getSolrCore() { return dataImporter == null ? null : dataImporter.getCore(); } + @Override public Map getStats() { return docBuilder != null ? docBuilder.importStatistics.getStatsSnapshot() : Collections.emptyMap(); } + @Override public String getScript() { if(dataImporter != null) { DataConfig.Script script = dataImporter.getConfig().script; @@ -204,6 +220,7 @@ public class ContextImpl extends Context { return null; } + @Override public String getScriptLanguage() { if (dataImporter != null) { DataConfig.Script script = dataImporter.getConfig().script; @@ -212,12 +229,14 @@ public class ContextImpl extends Context { return null; } + @Override public void deleteDoc(String id) { if(docBuilder != null){ docBuilder.writer.deleteDoc(id); } } + @Override public void deleteDocByQuery(String query) { if(docBuilder != null){ docBuilder.writer.deleteByQuery(query); @@ -227,10 +246,12 @@ public class ContextImpl extends Context { DocBuilder getDocBuilder(){ return docBuilder; } + @Override public Object resolve(String var) { return resolver.resolve(var); } + @Override public String replaceTokens(String template) { return resolver.replaceTokens(template); } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java index f548ff648a9..f0a9e412427 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java @@ -214,6 +214,7 @@ public class DataConfig { public Map allAttributes = new HashMap() { + @Override public String put(String key, String value) { if (super.containsKey(key)) return super.get(key); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java index 6d9206d43ed..45f8fcf1598 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java @@ -423,6 +423,7 @@ public class DataImporter { } static final ThreadLocal QUERY_COUNT = new ThreadLocal() { + @Override protected AtomicLong initialValue() { return new AtomicLong(); } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DateFormatTransformer.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DateFormatTransformer.java index e2c6e221095..95c601e8911 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DateFormatTransformer.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DateFormatTransformer.java @@ -45,6 +45,7 @@ public class DateFormatTransformer extends Transformer { private static final Logger LOG = LoggerFactory .getLogger(DateFormatTransformer.class); + @Override @SuppressWarnings("unchecked") public Object transformRow(Map aRow, Context context) { diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DebugLogger.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DebugLogger.java index 77c1ea7669e..8ee0126dc25 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DebugLogger.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DebugLogger.java @@ -60,6 +60,7 @@ class DebugLogger { output = new NamedList(); debugStack = new Stack() { + @Override public DebugInfo pop() { if (size() == 1) throw new DataImportHandlerException( @@ -169,14 +170,17 @@ class DebugLogger { DataSource wrapDs(final DataSource ds) { return new DataSource() { + @Override public void init(Context context, Properties initProps) { ds.init(context, initProps); } + @Override public void close() { ds.close(); } + @Override public Object getData(String query) { writer.log(SolrWriter.ENTITY_META, "query", query); long start = System.currentTimeMillis(); @@ -203,6 +207,7 @@ class DebugLogger { Transformer wrapTransformer(final Transformer t) { return new Transformer() { + @Override public Object transformRow(Map row, Context context) { writer.log(SolrWriter.PRE_TRANSFORMER_ROW, null, row); String tName = getTransformerName(t); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java index e94ba8947f8..42bf6da9499 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java @@ -139,6 +139,7 @@ public class DocBuilder { document = dataImporter.getConfig().document; final AtomicLong startTime = new AtomicLong(System.currentTimeMillis()); statusMessages.put(TIME_ELAPSED, new Object() { + @Override public String toString() { return getTimeElapsedSince(startTime.get()); } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorBase.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorBase.java index c2294bd6549..5d761194440 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorBase.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorBase.java @@ -49,6 +49,7 @@ public class EntityProcessorBase extends EntityProcessor { protected String onError = ABORT; + @Override public void init(Context context) { rowIterator = null; this.context = context; @@ -86,14 +87,17 @@ public class EntityProcessorBase extends EntityProcessor { } } + @Override public Map nextModifiedRowKey() { return null; } + @Override public Map nextDeletedRowKey() { return null; } + @Override public Map nextModifiedParentRowKey() { return null; } @@ -105,11 +109,13 @@ public class EntityProcessorBase extends EntityProcessor { * @return a row where the key is the name of the field and value can be any Object or a Collection of objects. Return * null to signal end of rows */ + @Override public Map nextRow() { return null;// do not do anything } + @Override public void destroy() { /*no op*/ } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java index c46ddcf9e6d..432e64ac767 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java @@ -54,6 +54,7 @@ public class EntityProcessorWrapper extends EntityProcessor { this.docBuilder = docBuilder; } + @Override public void init(Context context) { rowcache = null; this.context = context; @@ -79,6 +80,7 @@ public class EntityProcessorWrapper extends EntityProcessor { String[] transArr = transClasses.split(","); transformers = new ArrayList() { + @Override public boolean add(Transformer transformer) { if (docBuilder != null && docBuilder.verboseDebug) { transformer = docBuilder.writer.getDebugLogger().wrapTransformer(transformer); @@ -135,6 +137,7 @@ public class EntityProcessorWrapper extends EntityProcessor { o = clazz.newInstance(); } + @Override public Object transformRow(Map aRow, Context context) { try { return meth.invoke(o, aRow); @@ -223,6 +226,7 @@ public class EntityProcessorWrapper extends EntityProcessor { && Boolean.parseBoolean(oMap.get("$stopTransform").toString()); } + @Override public Map nextRow() { if (rowcache != null) { return getFromRowCache(); @@ -252,6 +256,7 @@ public class EntityProcessorWrapper extends EntityProcessor { } } + @Override public Map nextModifiedRowKey() { Map row = delegate.nextModifiedRowKey(); row = applyTransformer(row); @@ -259,6 +264,7 @@ public class EntityProcessorWrapper extends EntityProcessor { return row; } + @Override public Map nextDeletedRowKey() { Map row = delegate.nextDeletedRowKey(); row = applyTransformer(row); @@ -266,10 +272,12 @@ public class EntityProcessorWrapper extends EntityProcessor { return row; } + @Override public Map nextModifiedParentRowKey() { return delegate.nextModifiedParentRowKey(); } + @Override public void destroy() { delegate.destroy(); } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EvaluatorBag.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EvaluatorBag.java index 9c4321a97d7..24e728d82c0 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EvaluatorBag.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EvaluatorBag.java @@ -66,6 +66,7 @@ public class EvaluatorBag { */ public static Evaluator getSqlEscapingEvaluator() { return new Evaluator() { + @Override public String evaluate(String expression, Context context) { List l = parseParams(expression, context.getVariableResolver()); if (l.size() != 1) { @@ -90,6 +91,7 @@ public class EvaluatorBag { */ public static Evaluator getSolrQueryEscapingEvaluator() { return new Evaluator() { + @Override public String evaluate(String expression, Context context) { List l = parseParams(expression, context.getVariableResolver()); if (l.size() != 1) { @@ -109,6 +111,7 @@ public class EvaluatorBag { */ public static Evaluator getUrlEvaluator() { return new Evaluator() { + @Override public String evaluate(String expression, Context context) { List l = parseParams(expression, context.getVariableResolver()); if (l.size() != 1) { @@ -138,6 +141,7 @@ public class EvaluatorBag { */ public static Evaluator getDateFormatEvaluator() { return new Evaluator() { + @Override public String evaluate(String expression, Context context) { List l = parseParams(expression, context.getVariableResolver()); if (l.size() != 2) { @@ -288,6 +292,7 @@ public class EvaluatorBag { } + @Override public String toString() { Object o = vr.resolve(varName); return o == null ? null : o.toString(); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java index 8b2ae93c12c..b9d9ec74ab9 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java @@ -52,6 +52,7 @@ public class FieldReaderDataSource extends DataSource { private String encoding; private EntityProcessorWrapper entityProcessor; + @Override public void init(Context context, Properties initProps) { dataField = context.getEntityAttribute("dataField"); encoding = context.getEntityAttribute("encoding"); @@ -59,6 +60,7 @@ public class FieldReaderDataSource extends DataSource { /*no op*/ } + @Override public Reader getData(String query) { Object o = entityProcessor.getVariableResolver().resolve(dataField); if (o == null) { @@ -111,6 +113,7 @@ public class FieldReaderDataSource extends DataSource { } } + @Override public void close() { } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldStreamDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldStreamDataSource.java index f92f7cb4b15..132367cc0fa 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldStreamDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FieldStreamDataSource.java @@ -52,12 +52,14 @@ public class FieldStreamDataSource extends DataSource { protected String dataField; private EntityProcessorWrapper wrapper; + @Override public void init(Context context, Properties initProps) { dataField = context.getEntityAttribute("dataField"); wrapper = (EntityProcessorWrapper) context.getEntityProcessor(); /*no op*/ } + @Override public InputStream getData(String query) { Object o = wrapper.getVariableResolver().resolve(dataField); if (o == null) { @@ -90,6 +92,7 @@ public class FieldStreamDataSource extends DataSource { } + @Override public void close() { } } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FileDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FileDataSource.java index 64353ef3fa4..2f5a5aa1e2e 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FileDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FileDataSource.java @@ -59,6 +59,7 @@ public class FileDataSource extends DataSource { private static final Logger LOG = LoggerFactory.getLogger(FileDataSource.class); + @Override public void init(Context context, Properties initProps) { basePath = initProps.getProperty(BASE_PATH); if (initProps.get(URLDataSource.ENCODING) != null) @@ -79,6 +80,7 @@ public class FileDataSource extends DataSource { * returned Reader *

*/ + @Override public Reader getData(String query) { File f = getFile(basePath,query); try { @@ -130,6 +132,7 @@ public class FileDataSource extends DataSource { } } + @Override public void close() { } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FileListEntityProcessor.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FileListEntityProcessor.java index 72924176731..7549af7dfbd 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FileListEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/FileListEntityProcessor.java @@ -106,6 +106,7 @@ public class FileListEntityProcessor extends EntityProcessorBase { private Pattern fileNamePattern, excludesPattern; + @Override public void init(Context context) { super.init(context); fileName = context.getEntityAttribute(FILE_NAME); @@ -195,6 +196,7 @@ public class FileListEntityProcessor extends EntityProcessorBase { return Long.parseLong(sizeStr); } + @Override public Map nextRow() { if (rowIterator != null) return getNext(); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java index cb38e480bf0..f48ca2cda86 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java @@ -54,6 +54,7 @@ public class JdbcDataSource extends private int maxRows = 0; + @Override public void init(Context context, Properties initProps) { Object o = initProps.get(CONVERT_TYPE); if (o != null) @@ -204,6 +205,7 @@ public class JdbcDataSource extends } } + @Override public Iterator> getData(String query) { ResultSetIterator r = new ResultSetIterator(query); return r.getIterator(); @@ -370,6 +372,7 @@ public class JdbcDataSource extends } } + @Override protected void finalize() throws Throwable { try { if(!isClosed){ @@ -383,6 +386,7 @@ public class JdbcDataSource extends private boolean isClosed = false; + @Override public void close() { try { closeConnection(); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/LineEntityProcessor.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/LineEntityProcessor.java index 0a8b201ab42..30e366316f7 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/LineEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/LineEntityProcessor.java @@ -64,6 +64,7 @@ public class LineEntityProcessor extends EntityProcessorBase { /** * Parses each of the entity attributes. */ + @Override public void init(Context context) { super.init(context); String s; @@ -97,6 +98,7 @@ public class LineEntityProcessor extends EntityProcessorBase { * from the url. However transformers can be used to create as * many other fields as required. */ + @Override public Map nextRow() { if (reader == null) { reader = new BufferedReader((Reader) context.getDataSource().getData(url)); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/LogTransformer.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/LogTransformer.java index d9d2f115d24..5a603a74049 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/LogTransformer.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/LogTransformer.java @@ -35,6 +35,7 @@ import java.util.Map; public class LogTransformer extends Transformer { Logger LOG = LoggerFactory.getLogger(LogTransformer.class); + @Override public Object transformRow(Map row, Context ctx) { String expr = ctx.getEntityAttribute(LOG_TEMPLATE); String level = ctx.replaceTokens(ctx.getEntityAttribute(LOG_LEVEL)); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/MockDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/MockDataSource.java index 7b747d72a56..6fd7213b5a7 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/MockDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/MockDataSource.java @@ -45,13 +45,16 @@ public class MockDataSource extends cache.clear(); } + @Override public void init(Context context, Properties initProps) { } + @Override public Iterator> getData(String query) { return cache.get(query); } + @Override public void close() { cache.clear(); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/NumberFormatTransformer.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/NumberFormatTransformer.java index d38ab75fcb0..36efecf5320 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/NumberFormatTransformer.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/NumberFormatTransformer.java @@ -49,6 +49,7 @@ public class NumberFormatTransformer extends Transformer { private static final Pattern localeRegex = Pattern.compile("^([a-z]{2})-([A-Z]{2})$"); + @Override @SuppressWarnings("unchecked") public Object transformRow(Map row, Context context) { for (Map fld : context.getAllEntityFields()) { diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java index 79a981875bc..2d32eee0122 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java @@ -40,11 +40,13 @@ public class PlainTextEntityProcessor extends EntityProcessorBase { private static final Logger LOG = LoggerFactory.getLogger(PlainTextEntityProcessor.class); private boolean ended = false; + @Override public void init(Context context) { super.init(context); ended = false; } + @Override public Map nextRow() { if (ended) return null; DataSource ds = context.getDataSource(); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/RegexTransformer.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/RegexTransformer.java index e5910093e73..429bb0cf2f3 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/RegexTransformer.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/RegexTransformer.java @@ -43,6 +43,7 @@ import java.util.regex.Pattern; public class RegexTransformer extends Transformer { private static final Logger LOG = LoggerFactory.getLogger(RegexTransformer.class); + @Override @SuppressWarnings("unchecked") public Map transformRow(Map row, Context ctx) { diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ScriptTransformer.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ScriptTransformer.java index ba06f49b91d..547fc66cf2a 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ScriptTransformer.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ScriptTransformer.java @@ -47,6 +47,7 @@ public class ScriptTransformer extends Transformer { private String functionName; + @Override public Object transformRow(Map row, Context context) { try { if (engine == null) diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SqlEntityProcessor.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SqlEntityProcessor.java index 925a9569bf2..1748998720b 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SqlEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SqlEntityProcessor.java @@ -46,6 +46,7 @@ public class SqlEntityProcessor extends EntityProcessorBase { protected DataSource>> dataSource; + @Override @SuppressWarnings("unchecked") public void init(Context context) { super.init(context); @@ -65,6 +66,7 @@ public class SqlEntityProcessor extends EntityProcessorBase { } } + @Override public Map nextRow() { if (rowIterator == null) { String q = getQuery(); @@ -73,6 +75,7 @@ public class SqlEntityProcessor extends EntityProcessorBase { return getNext(); } + @Override public Map nextModifiedRowKey() { if (rowIterator == null) { String deltaQuery = context.getEntityAttribute(DELTA_QUERY); @@ -83,6 +86,7 @@ public class SqlEntityProcessor extends EntityProcessorBase { return getNext(); } + @Override public Map nextDeletedRowKey() { if (rowIterator == null) { String deletedPkQuery = context.getEntityAttribute(DEL_PK_QUERY); @@ -93,6 +97,7 @@ public class SqlEntityProcessor extends EntityProcessorBase { return getNext(); } + @Override public Map nextModifiedParentRowKey() { if (rowIterator == null) { String parentDeltaQuery = context.getEntityAttribute(PARENT_DELTA_QUERY); diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/TemplateTransformer.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/TemplateTransformer.java index 8c5527983ff..6fd0665c700 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/TemplateTransformer.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/TemplateTransformer.java @@ -51,6 +51,7 @@ public class TemplateTransformer extends Transformer { private static final Logger LOG = LoggerFactory.getLogger(TemplateTransformer.class); private Map> templateVsVars = new HashMap>(); + @Override @SuppressWarnings("unchecked") public Object transformRow(Map row, Context context) { diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/URLDataSource.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/URLDataSource.java index 274c120b270..234fb56f264 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/URLDataSource.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/URLDataSource.java @@ -56,6 +56,7 @@ public class URLDataSource extends DataSource { public URLDataSource() { } + @Override public void init(Context context, Properties initProps) { this.context = context; this.initProps = initProps; @@ -81,6 +82,7 @@ public class URLDataSource extends DataSource { } } + @Override public Reader getData(String query) { URL url = null; try { @@ -114,6 +116,7 @@ public class URLDataSource extends DataSource { } } + @Override public void close() { } diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/VariableResolverImpl.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/VariableResolverImpl.java index b0675cc4627..8d39dd13bde 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/VariableResolverImpl.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/VariableResolverImpl.java @@ -91,10 +91,12 @@ public class VariableResolverImpl extends VariableResolver { container.remove(name); } + @Override public String replaceTokens(String template) { return templateString.replaceTokens(template, this); } + @Override @SuppressWarnings("unchecked") public Object resolve(String name) { if (name == null) diff --git a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java index 26196788dfe..e995fab3442 100644 --- a/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java @@ -80,6 +80,7 @@ public class XPathEntityProcessor extends EntityProcessorBase { protected Thread publisherThread; + @Override @SuppressWarnings("unchecked") public void init(Context context) { super.init(context); @@ -171,6 +172,7 @@ public class XPathEntityProcessor extends EntityProcessorBase { } + @Override public Map nextRow() { Map result; @@ -398,6 +400,7 @@ public class XPathEntityProcessor extends EntityProcessorBase { final AtomicBoolean isEnd = new AtomicBoolean(false); final AtomicBoolean throwExp = new AtomicBoolean(true); publisherThread = new Thread() { + @Override public void run() { try { xpathReader.streamRecords(data, new XPathRecordReader.Handler() { diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java index 07f78d0b412..8c3791f224a 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java @@ -197,89 +197,110 @@ public abstract class AbstractDataImportHandlerTestCase extends this.root = root; } + @Override public String getEntityAttribute(String name) { return entityAttrs == null ? delegate.getEntityAttribute(name) : entityAttrs.get(name); } + @Override public String getResolvedEntityAttribute(String name) { return entityAttrs == null ? delegate.getResolvedEntityAttribute(name) : delegate.getVariableResolver().replaceTokens(entityAttrs.get(name)); } + @Override public List> getAllEntityFields() { return entityFields == null ? delegate.getAllEntityFields() : entityFields; } + @Override public VariableResolver getVariableResolver() { return delegate.getVariableResolver(); } + @Override public DataSource getDataSource() { return delegate.getDataSource(); } + @Override public boolean isRootEntity() { return root; } + @Override public String currentProcess() { return delegate.currentProcess(); } + @Override public Map getRequestParameters() { return delegate.getRequestParameters(); } + @Override public EntityProcessor getEntityProcessor() { return null; } + @Override public void setSessionAttribute(String name, Object val, String scope) { delegate.setSessionAttribute(name, val, scope); } + @Override public Object getSessionAttribute(String name, String scope) { return delegate.getSessionAttribute(name, scope); } + @Override public Context getParentContext() { return delegate.getParentContext(); } + @Override public DataSource getDataSource(String name) { return delegate.getDataSource(name); } + @Override public SolrCore getSolrCore() { return delegate.getSolrCore(); } + @Override public Map getStats() { return delegate.getStats(); } + @Override public String getScript() { return script == null ? delegate.getScript() : script; } + @Override public String getScriptLanguage() { return scriptlang == null ? delegate.getScriptLanguage() : scriptlang; } + @Override public void deleteDoc(String id) { } + @Override public void deleteDocByQuery(String query) { } + @Override public Object resolve(String var) { return delegate.resolve(var); } + @Override public String replaceTokens(String template) { return delegate.replaceTokens(template); } @@ -318,31 +339,37 @@ public abstract class AbstractDataImportHandlerTestCase extends reset(); } + @Override public void finish() throws IOException { finishCalled = true; super.finish(); } + @Override public void processAdd(AddUpdateCommand cmd) throws IOException { processAddCalled = true; super.processAdd(cmd); } + @Override public void processCommit(CommitUpdateCommand cmd) throws IOException { processCommitCalled = true; super.processCommit(cmd); } + @Override public void processDelete(DeleteUpdateCommand cmd) throws IOException { processDeleteCalled = true; super.processDelete(cmd); } + @Override public void processMergeIndexes(MergeIndexesCommand cmd) throws IOException { mergeIndexesCalled = true; super.processMergeIndexes(cmd); } + @Override public void processRollback(RollbackUpdateCommand cmd) throws IOException { rollbackCalled = true; super.processRollback(cmd); diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestCachedSqlEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestCachedSqlEntityProcessor.java index ceda6edd3ec..0037d6796ca 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestCachedSqlEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestCachedSqlEntityProcessor.java @@ -158,6 +158,7 @@ public class TestCachedSqlEntityProcessor extends AbstractDataImportHandlerTestC public static class DoubleTransformer extends Transformer { + @Override public Object transformRow(Map row, Context context) { List> rows = new ArrayList>(); rows.add(row); @@ -169,6 +170,7 @@ public class TestCachedSqlEntityProcessor extends AbstractDataImportHandlerTestC public static class UppercaseTransformer extends Transformer { + @Override public Object transformRow(Map row, Context context) { for (Map.Entry entry : row.entrySet()) { Object val = entry.getValue(); diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java index c49be006377..692272d4e04 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java @@ -43,6 +43,7 @@ public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCa SolrInstance instance = null; JettySolrRunner jetty; + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -51,6 +52,7 @@ public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCa jetty = createJetty(instance); } + @Override @After public void tearDown() throws Exception { jetty.stop(); diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder.java index e9947e52e76..a16b7017ab4 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder.java @@ -33,6 +33,7 @@ import java.util.*; */ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { + @Override @After public void tearDown() throws Exception { MockDataSource.clearCache(); @@ -200,22 +201,27 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { super(null, ".",null); } + @Override public boolean upload(SolrInputDocument doc) { return docs.add(doc); } + @Override public void log(int event, String name, Object row) { // Do nothing } + @Override public void doDeleteAll() { deleteAllCalled = Boolean.TRUE; } + @Override public void commit(boolean b) { commitCalled = Boolean.TRUE; } + @Override public void finish() { finishCalled = Boolean.TRUE; } diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java index f361eb20a43..4632318fa17 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java @@ -252,6 +252,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { } public static class MockTransformer extends Transformer { + @Override public Object transformRow(Map row, Context context) { assertTrue("Context gave incorrect data source", context.getDataSource("mockDs") instanceof MockDataSource2); return row; @@ -259,6 +260,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { } public static class AddDynamicFieldTransformer extends Transformer { + @Override public Object transformRow(Map row, Context context) { // Add a dynamic field row.put("dynamic_s", "test"); diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEntityProcessorBase.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEntityProcessorBase.java index 2b7d3578e96..42b29610666 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEntityProcessorBase.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEntityProcessorBase.java @@ -57,6 +57,7 @@ public class TestEntityProcessorBase extends AbstractDataImportHandlerTestCase { static class T1 extends Transformer { + @Override public Object transformRow(Map aRow, Context context) { aRow.put("T1", "T1 called"); return aRow; @@ -66,6 +67,7 @@ public class TestEntityProcessorBase extends AbstractDataImportHandlerTestCase { static class T2 extends Transformer { + @Override public Object transformRow(Map aRow, Context context) { aRow.put("T2", "T2 called"); return aRow; diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java index 0f703815bae..b8e285dffe1 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java @@ -78,19 +78,23 @@ public class TestErrorHandling extends AbstractDataImportHandlerTestCase { public static class StringDataSource extends DataSource { public static String xml = ""; + @Override public void init(Context context, Properties initProps) { } + @Override public Reader getData(String query) { return new StringReader(xml); } + @Override public void close() { } } public static class ExceptionTransformer extends Transformer { + @Override public Object transformRow(Map row, Context context) { throw new RuntimeException("Test exception"); } diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java index 18b30a36d7b..41ac1dc5d15 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestEvaluatorBag.java @@ -39,6 +39,7 @@ public class TestEvaluatorBag extends AbstractDataImportHandlerTestCase { Map urlTests; + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestJdbcDataSource.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestJdbcDataSource.java index 68cc9ccc9ff..ac6626462ee 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestJdbcDataSource.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestJdbcDataSource.java @@ -57,6 +57,7 @@ public class TestJdbcDataSource extends AbstractDataImportHandlerTestCase { String sysProp = System.getProperty("java.naming.factory.initial"); + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -69,6 +70,7 @@ public class TestJdbcDataSource extends AbstractDataImportHandlerTestCase { connection = mockControl.createMock(Connection.class); } + @Override @After public void tearDown() throws Exception { if (sysProp == null) { diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestLineEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestLineEntityProcessor.java index c24fced0bbf..91f8d034cda 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestLineEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestLineEntityProcessor.java @@ -207,12 +207,15 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase { private DataSource getDataSource(final String xml) { return new DataSource() { + @Override public void init(Context context, Properties initProps) { } + @Override public void close() { } + @Override public Reader getData(String query) { return new StringReader(xml); } diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java index 48a0b1b4214..e0a5b8bf39c 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java @@ -42,15 +42,18 @@ public class TestPlainTextEntityProcessor extends AbstractDataImportHandlerTestC public static class DS extends DataSource { static String s = "hello world"; + @Override public void init(Context context, Properties initProps) { } + @Override public Object getData(String query) { return new StringReader(s); } + @Override public void close() { } diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor.java index 7fc50fa11cd..0fbfb846eae 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor.java @@ -135,19 +135,23 @@ public class TestSqlEntityProcessor extends AbstractDataImportHandlerTestCase { private static DataSource>> getDs( final List> rows) { return new DataSource>>() { + @Override public Iterator> getData(String query) { return rows.iterator(); } + @Override public void init(Context context, Properties initProps) { } + @Override public void close() { } }; } public static class T extends Transformer { + @Override public Object transformRow(Map aRow, Context context) { aRow.put("T", "Class T"); return aRow; @@ -162,6 +166,7 @@ public class TestSqlEntityProcessor extends AbstractDataImportHandlerTestCase { } public static class T2 extends Transformer { + @Override public Object transformRow(Map aRow, Context context) { Integer count = local.get(); local.set(count + 1); diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java index 966818b4ef5..6c0627e3e07 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java @@ -214,6 +214,7 @@ public class TestSqlEntityProcessor2 extends AbstractDataImportHandlerTestCase { } static class DateFormatValidatingEvaluator extends Evaluator { + @Override public String evaluate(String expression, Context context) { List l = EvaluatorBag.parseParams(expression, context.getVariableResolver()); Object o = l.get(0); diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestVariableResolver.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestVariableResolver.java index 2befb0bdaa0..55c4b91ee34 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestVariableResolver.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestVariableResolver.java @@ -169,6 +169,7 @@ public class TestVariableResolver extends AbstractDataImportHandlerTestCase { } public static class E extends Evaluator{ + @Override public String evaluate(String expression, Context context) { return "Hello World"; } diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java index 29672e5b258..6f6fd817fa6 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java @@ -236,12 +236,15 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase private DataSource getDataSource(final String xml) { return new DataSource() { + @Override public void init(Context context, Properties initProps) { } + @Override public void close() { } + @Override public Reader getData(String query) { return new StringReader(xml); } diff --git a/solr/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java b/solr/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java index a08967dfcc6..e7d03b9bb7c 100644 --- a/solr/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java +++ b/solr/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java @@ -120,6 +120,7 @@ public class ExtractingDocumentLoader extends ContentStreamLoader { * @param stream * @throws java.io.IOException */ + @Override public void load(SolrQueryRequest req, SolrQueryResponse rsp, ContentStream stream) throws IOException { errHeader = "ExtractingDocumentLoader: " + stream.getSourceInfo(); Parser parser = null; diff --git a/solr/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java b/solr/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java index 943f0d849dc..d77a81491fd 100644 --- a/solr/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java +++ b/solr/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java @@ -111,6 +111,7 @@ public class ExtractingRequestHandler extends ContentStreamHandlerBase implement } + @Override protected ContentStreamLoader newLoader(SolrQueryRequest req, UpdateRequestProcessor processor) { return new ExtractingDocumentLoader(req, processor, config, factory); } diff --git a/solr/contrib/extraction/src/test/java/org/apache/solr/handler/ExtractingRequestHandlerTest.java b/solr/contrib/extraction/src/test/java/org/apache/solr/handler/ExtractingRequestHandlerTest.java index 1eac099acf0..441f6d3ce1a 100644 --- a/solr/contrib/extraction/src/test/java/org/apache/solr/handler/ExtractingRequestHandlerTest.java +++ b/solr/contrib/extraction/src/test/java/org/apache/solr/handler/ExtractingRequestHandlerTest.java @@ -46,6 +46,7 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 { initCore("solrconfig.xml", "schema.xml", "solr-extraction"); } + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java b/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java index f042f2a3531..4f7e004666c 100644 --- a/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java +++ b/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java @@ -56,6 +56,7 @@ public class UIMAUpdateRequestProcessor extends UpdateRequestProcessor { solrUIMAConfiguration.getAePath(), solrUIMAConfiguration.getRuntimeParameters()); } + @Override public void processAdd(AddUpdateCommand cmd) throws IOException { try { /* get Solr document */ diff --git a/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorFactory.java b/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorFactory.java index 5078f9d3a19..b8167572195 100644 --- a/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorFactory.java +++ b/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorFactory.java @@ -29,6 +29,7 @@ import org.apache.solr.update.processor.UpdateRequestProcessorFactory; */ public class UIMAUpdateRequestProcessorFactory extends UpdateRequestProcessorFactory { + @Override public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) { return new UIMAUpdateRequestProcessor(next, req.getCore()); diff --git a/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java b/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java index 3d2058bae6b..b0499538d6e 100644 --- a/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java +++ b/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java @@ -50,6 +50,7 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 { initCore("solrconfig.xml", "schema.xml", "solr-uima"); } + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/solr/src/common/org/apache/solr/common/SolrDocument.java b/solr/src/common/org/apache/solr/common/SolrDocument.java index 48d66878ca5..813326e40f9 100644 --- a/solr/src/common/org/apache/solr/common/SolrDocument.java +++ b/solr/src/common/org/apache/solr/common/SolrDocument.java @@ -220,6 +220,7 @@ public class SolrDocument implements Map, Iterable> values() {throw new UnsupportedOperationException();} public Collection put(String key, Collection value) {throw new UnsupportedOperationException();} public Collection remove(Object key) {throw new UnsupportedOperationException();} + @Override public String toString() {return _fields.toString();} }; } @@ -248,6 +249,7 @@ public class SolrDocument implements Map, Iterable values() {throw new UnsupportedOperationException();} public Collection put(String key, Object value) {throw new UnsupportedOperationException();} public Collection remove(Object key) {throw new UnsupportedOperationException();} + @Override public String toString() {return _fields.toString();} }; } diff --git a/solr/src/common/org/apache/solr/common/SolrDocumentList.java b/solr/src/common/org/apache/solr/common/SolrDocumentList.java index 273cd80751a..9aca8d7780c 100644 --- a/solr/src/common/org/apache/solr/common/SolrDocumentList.java +++ b/solr/src/common/org/apache/solr/common/SolrDocumentList.java @@ -57,6 +57,7 @@ public class SolrDocumentList extends ArrayList this.start = start; } + @Override public String toString() { return "{numFound="+numFound +",start="+start diff --git a/solr/src/common/org/apache/solr/common/cloud/CloudState.java b/solr/src/common/org/apache/solr/common/cloud/CloudState.java index 23ec5fbad04..7b140e767f5 100644 --- a/solr/src/common/org/apache/solr/common/cloud/CloudState.java +++ b/solr/src/common/org/apache/solr/common/cloud/CloudState.java @@ -140,6 +140,7 @@ public class CloudState { return liveNodesSet; } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("live nodes:" + liveNodes); diff --git a/solr/src/common/org/apache/solr/common/cloud/ZkNodeProps.java b/solr/src/common/org/apache/solr/common/cloud/ZkNodeProps.java index 1819ee49440..973571d814c 100644 --- a/solr/src/common/org/apache/solr/common/cloud/ZkNodeProps.java +++ b/solr/src/common/org/apache/solr/common/cloud/ZkNodeProps.java @@ -46,6 +46,7 @@ public class ZkNodeProps extends HashMap { return sb.toString().getBytes("UTF-8"); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); Set> entries = entrySet(); diff --git a/solr/src/common/org/apache/solr/common/params/FacetParams.java b/solr/src/common/org/apache/solr/common/params/FacetParams.java index d7a20cd11ea..e742638fdcb 100644 --- a/solr/src/common/org/apache/solr/common/params/FacetParams.java +++ b/solr/src/common/org/apache/solr/common/params/FacetParams.java @@ -270,6 +270,7 @@ public interface FacetParams { */ public enum FacetRangeOther { BEFORE, AFTER, BETWEEN, ALL, NONE; + @Override public String toString() { return super.toString().toLowerCase(); } public static FacetRangeOther get(String label) { try { @@ -288,6 +289,7 @@ public interface FacetParams { @Deprecated public enum FacetDateOther { BEFORE, AFTER, BETWEEN, ALL, NONE; + @Override public String toString() { return super.toString().toLowerCase(); } public static FacetDateOther get(String label) { try { @@ -321,6 +323,7 @@ public interface FacetParams { */ public enum FacetRangeInclude { ALL, LOWER, UPPER, EDGE, OUTER; + @Override public String toString() { return super.toString().toLowerCase(Locale.ENGLISH); } public static FacetRangeInclude get(String label) { try { diff --git a/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java b/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java index a3ca8be6264..33d76241d82 100644 --- a/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java +++ b/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java @@ -133,6 +133,7 @@ public class ConcurrentLRUCache { if (currentSize > upperWaterMark && !isCleaning) { if (newThreadForCleanup) { new Thread() { + @Override public void run() { markAndSweep(); } @@ -362,6 +363,7 @@ public class ConcurrentLRUCache { return Collections.unmodifiableCollection(Arrays.asList(heap)); } + @Override protected boolean lessThan(CacheEntry a, CacheEntry b) { // reverse the parameter order so that the queue keeps the oldest items return b.lastAccessedCopy < a.lastAccessedCopy; @@ -491,14 +493,17 @@ public class ConcurrentLRUCache { return this.lastAccessedCopy < that.lastAccessedCopy ? 1 : -1; } + @Override public int hashCode() { return value.hashCode(); } + @Override public boolean equals(Object obj) { return value.equals(obj); } + @Override public String toString() { return "key: " + key + " value: " + value + " lastAccessed:" + lastAccessed; } @@ -579,6 +584,7 @@ public class ConcurrentLRUCache { cache = new WeakReference(c); } + @Override public void run() { while (true) { synchronized (this) { @@ -608,6 +614,7 @@ public class ConcurrentLRUCache { } } + @Override protected void finalize() throws Throwable { try { if(!isDestroyed){ diff --git a/solr/src/common/org/apache/solr/common/util/FastOutputStream.java b/solr/src/common/org/apache/solr/common/util/FastOutputStream.java index e4b498e3b1d..f7efef9ef84 100755 --- a/solr/src/common/org/apache/solr/common/util/FastOutputStream.java +++ b/solr/src/common/org/apache/solr/common/util/FastOutputStream.java @@ -50,6 +50,7 @@ public class FastOutputStream extends OutputStream implements DataOutput { write((byte)b); } + @Override public void write(byte b[]) throws IOException { write(b,0,b.length); } diff --git a/solr/src/common/org/apache/solr/common/util/NamedList.java b/solr/src/common/org/apache/solr/common/util/NamedList.java index 517b53d3b80..579a7f29008 100644 --- a/solr/src/common/org/apache/solr/common/util/NamedList.java +++ b/solr/src/common/org/apache/solr/common/util/NamedList.java @@ -246,6 +246,7 @@ public class NamedList implements Cloneable, Serializable, Iterable implements Cloneable, Serializable, Iterableshallow copy of the named list. */ + @Override public NamedList clone() { ArrayList newList = new ArrayList(nvPairs.size()); newList.addAll(nvPairs); @@ -355,6 +357,7 @@ public class NamedList implements Cloneable, Serializable, Iterable args) { super.init(args); assureMatchVersion(); diff --git a/solr/src/java/org/apache/solr/analysis/ChineseFilterFactory.java b/solr/src/java/org/apache/solr/analysis/ChineseFilterFactory.java index 6ffb67971b9..9d75f025f6d 100644 --- a/solr/src/java/org/apache/solr/analysis/ChineseFilterFactory.java +++ b/solr/src/java/org/apache/solr/analysis/ChineseFilterFactory.java @@ -29,6 +29,7 @@ import org.apache.lucene.analysis.cn.ChineseFilter; */ @Deprecated public class ChineseFilterFactory extends BaseTokenFilterFactory { + @Override public void init(Map args) { super.init(args); warnDeprecated("Use StopFilterFactory instead."); diff --git a/solr/src/java/org/apache/solr/analysis/ChineseTokenizerFactory.java b/solr/src/java/org/apache/solr/analysis/ChineseTokenizerFactory.java index 978882e2a65..ef4d53688ed 100644 --- a/solr/src/java/org/apache/solr/analysis/ChineseTokenizerFactory.java +++ b/solr/src/java/org/apache/solr/analysis/ChineseTokenizerFactory.java @@ -30,6 +30,7 @@ import org.apache.lucene.analysis.cn.ChineseTokenizer; */ @Deprecated public class ChineseTokenizerFactory extends BaseTokenizerFactory { + @Override public void init(Map args) { super.init(args); warnDeprecated("Use StandardTokenizerFactory instead."); diff --git a/solr/src/java/org/apache/solr/analysis/DictionaryCompoundWordTokenFilterFactory.java b/solr/src/java/org/apache/solr/analysis/DictionaryCompoundWordTokenFilterFactory.java index 1cbe411dcba..63e650e9d7d 100644 --- a/solr/src/java/org/apache/solr/analysis/DictionaryCompoundWordTokenFilterFactory.java +++ b/solr/src/java/org/apache/solr/analysis/DictionaryCompoundWordTokenFilterFactory.java @@ -36,6 +36,7 @@ public class DictionaryCompoundWordTokenFilterFactory extends BaseTokenFilterFac private int minSubwordSize; private int maxSubwordSize; private boolean onlyLongestMatch; + @Override public void init(Map args) { super.init(args); assureMatchVersion(); diff --git a/solr/src/java/org/apache/solr/analysis/HyphenationCompoundWordTokenFilterFactory.java b/solr/src/java/org/apache/solr/analysis/HyphenationCompoundWordTokenFilterFactory.java index 339f1666849..a90cef5d5da 100644 --- a/solr/src/java/org/apache/solr/analysis/HyphenationCompoundWordTokenFilterFactory.java +++ b/solr/src/java/org/apache/solr/analysis/HyphenationCompoundWordTokenFilterFactory.java @@ -61,6 +61,7 @@ public class HyphenationCompoundWordTokenFilterFactory extends BaseTokenFilterFa private int maxSubwordSize; private boolean onlyLongestMatch; + @Override public void init(Map args) { super.init(args); assureMatchVersion(); diff --git a/solr/src/java/org/apache/solr/analysis/IndonesianStemFilterFactory.java b/solr/src/java/org/apache/solr/analysis/IndonesianStemFilterFactory.java index 06144903872..d99af63a32e 100644 --- a/solr/src/java/org/apache/solr/analysis/IndonesianStemFilterFactory.java +++ b/solr/src/java/org/apache/solr/analysis/IndonesianStemFilterFactory.java @@ -26,6 +26,7 @@ import org.apache.lucene.analysis.id.IndonesianStemFilter; public class IndonesianStemFilterFactory extends BaseTokenFilterFactory { private boolean stemDerivational = true; + @Override public void init(Map args) { super.init(args); stemDerivational = getBoolean("stemDerivational", true); diff --git a/solr/src/java/org/apache/solr/analysis/NumericPayloadTokenFilterFactory.java b/solr/src/java/org/apache/solr/analysis/NumericPayloadTokenFilterFactory.java index 69469eab54e..0181b96e636 100644 --- a/solr/src/java/org/apache/solr/analysis/NumericPayloadTokenFilterFactory.java +++ b/solr/src/java/org/apache/solr/analysis/NumericPayloadTokenFilterFactory.java @@ -27,6 +27,7 @@ import java.util.Map; public class NumericPayloadTokenFilterFactory extends BaseTokenFilterFactory { private float payload; private String typeMatch; + @Override public void init(Map args) { super.init(args); payload = Float.parseFloat(args.get("payload")); diff --git a/solr/src/java/org/apache/solr/analysis/PatternReplaceCharFilterFactory.java b/solr/src/java/org/apache/solr/analysis/PatternReplaceCharFilterFactory.java index bb45fa126a8..48014cb1a04 100644 --- a/solr/src/java/org/apache/solr/analysis/PatternReplaceCharFilterFactory.java +++ b/solr/src/java/org/apache/solr/analysis/PatternReplaceCharFilterFactory.java @@ -36,6 +36,7 @@ public class PatternReplaceCharFilterFactory extends BaseCharFilterFactory { private int maxBlockChars; private String blockDelimiters; + @Override public void init(Map args) { super.init( args ); try { diff --git a/solr/src/java/org/apache/solr/analysis/PositionFilterFactory.java b/solr/src/java/org/apache/solr/analysis/PositionFilterFactory.java index df6b8090539..ab1fb48c740 100644 --- a/solr/src/java/org/apache/solr/analysis/PositionFilterFactory.java +++ b/solr/src/java/org/apache/solr/analysis/PositionFilterFactory.java @@ -33,6 +33,7 @@ import java.util.Map; public class PositionFilterFactory extends BaseTokenFilterFactory { private int positionIncrement; + @Override public void init(Map args) { super.init(args); positionIncrement = getInt("positionIncrement", 0); diff --git a/solr/src/java/org/apache/solr/analysis/ShingleFilterFactory.java b/solr/src/java/org/apache/solr/analysis/ShingleFilterFactory.java index c158d33ae03..58f18ad99de 100644 --- a/solr/src/java/org/apache/solr/analysis/ShingleFilterFactory.java +++ b/solr/src/java/org/apache/solr/analysis/ShingleFilterFactory.java @@ -34,6 +34,7 @@ public class ShingleFilterFactory extends BaseTokenFilterFactory { private boolean outputUnigramsIfNoShingles; private String tokenSeparator; + @Override public void init(Map args) { super.init(args); maxShingleSize = getInt("maxShingleSize", diff --git a/solr/src/java/org/apache/solr/analysis/SolrAnalyzer.java b/solr/src/java/org/apache/solr/analysis/SolrAnalyzer.java index 6244e0c82f6..b0b03cc2b3d 100644 --- a/solr/src/java/org/apache/solr/analysis/SolrAnalyzer.java +++ b/solr/src/java/org/apache/solr/analysis/SolrAnalyzer.java @@ -32,6 +32,7 @@ public abstract class SolrAnalyzer extends Analyzer { posIncGap=gap; } + @Override public int getPositionIncrementGap(String fieldName) { return posIncGap; } diff --git a/solr/src/java/org/apache/solr/analysis/TokenizerChain.java b/solr/src/java/org/apache/solr/analysis/TokenizerChain.java index 4c0d04af3a7..3fd48842077 100644 --- a/solr/src/java/org/apache/solr/analysis/TokenizerChain.java +++ b/solr/src/java/org/apache/solr/analysis/TokenizerChain.java @@ -73,6 +73,7 @@ public final class TokenizerChain extends SolrAnalyzer { return new TokenStreamInfo(tk,ts); } + @Override public String toString() { StringBuilder sb = new StringBuilder("TokenizerChain("); for (CharFilterFactory filter: charFilters) { diff --git a/solr/src/java/org/apache/solr/cloud/SolrZkServer.java b/solr/src/java/org/apache/solr/cloud/SolrZkServer.java index d96718324aa..625c005f11e 100644 --- a/solr/src/java/org/apache/solr/cloud/SolrZkServer.java +++ b/solr/src/java/org/apache/solr/cloud/SolrZkServer.java @@ -319,6 +319,7 @@ class SolrZkServerProps extends QuorumPeerConfig { * @throws java.io.IOException * @throws ConfigException */ + @Override public void parseProperties(Properties zkProp) throws IOException, ConfigException { for (Entry entry : zkProp.entrySet()) { diff --git a/solr/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java b/solr/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java index 32a2ce0df51..8a6f5957d52 100644 --- a/solr/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java +++ b/solr/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java @@ -68,6 +68,7 @@ public class ZkSolrResourceLoader extends SolrResourceLoader { * * @return the stream for the named resource */ + @Override public InputStream openResource(String resource) { InputStream is = null; String file = collectionZkPath + "/" + resource; @@ -93,12 +94,14 @@ public class ZkSolrResourceLoader extends SolrResourceLoader { return is; } + @Override public String getConfigDir() { throw new ZooKeeperException( ErrorCode.SERVER_ERROR, "ZkSolrResourceLoader does not support getConfigDir() - likely, what you are trying to do is not supported in ZooKeeper mode"); } + @Override public String[] listConfigDir() { List list; try { diff --git a/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java b/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java index 8f0680e8c94..bf593b35ddc 100644 --- a/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java +++ b/solr/src/java/org/apache/solr/core/AbstractSolrEventListener.java @@ -42,6 +42,7 @@ class AbstractSolrEventListener implements SolrEventListener { throw new UnsupportedOperationException(); } + @Override public String toString() { return getClass().getName() + args; } diff --git a/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java b/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java index 3a27ce80801..268eb40c0ab 100644 --- a/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java +++ b/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java @@ -45,6 +45,7 @@ public class RAMDirectoryFactory extends StandardDirectoryFactory { } } + @Override public boolean exists(String path) { synchronized (RAMDirectoryFactory.class) { RefCntRamDirectory directory = directories.get(path); diff --git a/solr/src/java/org/apache/solr/core/RefCntRamDirectory.java b/solr/src/java/org/apache/solr/core/RefCntRamDirectory.java index e9659814374..29e5f658c88 100644 --- a/solr/src/java/org/apache/solr/core/RefCntRamDirectory.java +++ b/solr/src/java/org/apache/solr/core/RefCntRamDirectory.java @@ -51,6 +51,7 @@ public class RefCntRamDirectory extends RAMDirectory { } } + @Override public final synchronized void close() { decRef(); } diff --git a/solr/src/java/org/apache/solr/core/RunExecutableListener.java b/solr/src/java/org/apache/solr/core/RunExecutableListener.java index 01ac6340d5e..62f554e4641 100644 --- a/solr/src/java/org/apache/solr/core/RunExecutableListener.java +++ b/solr/src/java/org/apache/solr/core/RunExecutableListener.java @@ -37,6 +37,7 @@ class RunExecutableListener extends AbstractSolrEventListener { protected String[] envp; protected boolean wait=true; + @Override public void init(NamedList args) { super.init(args); @@ -102,6 +103,7 @@ class RunExecutableListener extends AbstractSolrEventListener { } + @Override public void postCommit() { // anything generic need to be passed to the external program? // the directory of the index? the command that caused it to be @@ -109,6 +111,7 @@ class RunExecutableListener extends AbstractSolrEventListener { exec("postCommit"); } + @Override public void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher) { exec("newSearcher"); } diff --git a/solr/src/java/org/apache/solr/core/SolrCore.java b/solr/src/java/org/apache/solr/core/SolrCore.java index b1774338967..298a89d7aaa 100644 --- a/solr/src/java/org/apache/solr/core/SolrCore.java +++ b/solr/src/java/org/apache/solr/core/SolrCore.java @@ -696,6 +696,7 @@ public final class SolrCore implements SolrInfoMBean { return refCount.get() <= 0; } + @Override protected void finalize() throws Throwable { try { if (getOpenCount() != 0) { @@ -1192,6 +1193,7 @@ public final class SolrCore implements SolrInfoMBean { private RefCounted newHolder(SolrIndexSearcher newSearcher) { RefCounted holder = new RefCounted(newSearcher) { + @Override public void close() { try { synchronized(searcherLock) { diff --git a/solr/src/java/org/apache/solr/core/StandardDirectoryFactory.java b/solr/src/java/org/apache/solr/core/StandardDirectoryFactory.java index 69996b72147..0dfd144b1e7 100644 --- a/solr/src/java/org/apache/solr/core/StandardDirectoryFactory.java +++ b/solr/src/java/org/apache/solr/core/StandardDirectoryFactory.java @@ -28,6 +28,7 @@ import org.apache.lucene.store.FSDirectory; */ public class StandardDirectoryFactory extends DirectoryFactory { + @Override public Directory open(String path) throws IOException { return FSDirectory.open(new File(path)); } diff --git a/solr/src/java/org/apache/solr/core/StandardIndexReaderFactory.java b/solr/src/java/org/apache/solr/core/StandardIndexReaderFactory.java index 4c31d57b1e8..2695cb26b76 100644 --- a/solr/src/java/org/apache/solr/core/StandardIndexReaderFactory.java +++ b/solr/src/java/org/apache/solr/core/StandardIndexReaderFactory.java @@ -32,6 +32,7 @@ public class StandardIndexReaderFactory extends IndexReaderFactory { /* (non-Javadoc) * @see org.apache.solr.core.IndexReaderFactory#newReader(org.apache.lucene.store.Directory, boolean) */ + @Override public IndexReader newReader(Directory indexDir, boolean readOnly) throws IOException { return IndexReader.open(indexDir, null, readOnly, termInfosIndexDivisor); diff --git a/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java b/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java index 48425034b1c..0066b8ca298 100644 --- a/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java +++ b/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java @@ -56,6 +56,7 @@ public abstract class AnalysisRequestHandlerBase extends RequestHandlerBase { public static final Set EMPTY_BYTES_SET = Collections.emptySet(); + @Override public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { rsp.add("analysis", doAnalysis(req)); } diff --git a/solr/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java b/solr/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java index e098a5ffb2b..c9f92857b1c 100644 --- a/solr/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java +++ b/solr/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java @@ -46,8 +46,10 @@ import java.util.List; public class BinaryUpdateRequestHandler extends ContentStreamHandlerBase { + @Override protected ContentStreamLoader newLoader(SolrQueryRequest req, final UpdateRequestProcessor processor) { return new ContentStreamLoader() { + @Override public void load(SolrQueryRequest req, SolrQueryResponse rsp, ContentStream stream) throws Exception { InputStream is = null; try { @@ -111,18 +113,22 @@ public class BinaryUpdateRequestHandler extends ContentStreamHandlerBase { } } + @Override public String getDescription() { return "Add/Update multiple documents with javabin format"; } + @Override public String getSourceId() { return "$Id$"; } + @Override public String getSource() { return "$URL$"; } + @Override public String getVersion() { return "$Revision$"; } diff --git a/solr/src/java/org/apache/solr/handler/CSVRequestHandler.java b/solr/src/java/org/apache/solr/handler/CSVRequestHandler.java index 4a67d9ab909..6ba5ead5f89 100755 --- a/solr/src/java/org/apache/solr/handler/CSVRequestHandler.java +++ b/solr/src/java/org/apache/solr/handler/CSVRequestHandler.java @@ -42,6 +42,7 @@ import java.io.*; public class CSVRequestHandler extends ContentStreamHandlerBase { + @Override protected ContentStreamLoader newLoader(SolrQueryRequest req, UpdateRequestProcessor processor) { return new SingleThreadedCSVLoader(req, processor); } @@ -118,6 +119,7 @@ abstract class CSVLoader extends ContentStreamLoader { /** add zero length fields */ private class FieldAdderEmpty extends CSVLoader.FieldAdder { + @Override void add(SolrInputDocument doc, int line, int column, String val) { doc.addField(fields[column].getName(),val,1.0f); } @@ -127,6 +129,7 @@ abstract class CSVLoader extends ContentStreamLoader { private class FieldTrimmer extends CSVLoader.FieldAdder { private final CSVLoader.FieldAdder base; FieldTrimmer(CSVLoader.FieldAdder base) { this.base=base; } + @Override void add(SolrInputDocument doc, int line, int column, String val) { base.add(doc, line, column, val.trim()); } @@ -145,6 +148,7 @@ abstract class CSVLoader extends ContentStreamLoader { this.to=to; this.base=base; } + @Override void add(SolrInputDocument doc, int line, int column, String val) { if (from.equals(val)) val=to; base.add(doc,line,column,val); @@ -162,6 +166,7 @@ abstract class CSVLoader extends ContentStreamLoader { this.base = base; } + @Override void add(SolrInputDocument doc, int line, int column, String val) { CSVParser parser = new CSVParser(new StringReader(val), strategy); try { @@ -327,6 +332,7 @@ abstract class CSVLoader extends ContentStreamLoader { } /** load the CSV input */ + @Override public void load(SolrQueryRequest req, SolrQueryResponse rsp, ContentStream stream) throws IOException { errHeader = "CSVLoader: input=" + stream.getSourceInfo(); Reader reader = null; @@ -403,6 +409,7 @@ class SingleThreadedCSVLoader extends CSVLoader { super(req, processor); } + @Override void addDoc(int line, String[] vals) throws IOException { templateAdd.indexedId = null; SolrInputDocument doc = new SolrInputDocument(); diff --git a/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java b/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java index f47dfa6fb21..842d00d53af 100644 --- a/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java +++ b/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java @@ -32,6 +32,7 @@ import org.apache.solr.update.processor.UpdateRequestProcessorChain; **/ public abstract class ContentStreamHandlerBase extends RequestHandlerBase { + @Override public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { SolrParams params = req.getParams(); UpdateRequestProcessorChain processorChain = diff --git a/solr/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java b/solr/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java index 195c9a3a7d1..92e1b098265 100644 --- a/solr/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java +++ b/solr/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java @@ -105,6 +105,7 @@ public class DocumentAnalysisRequestHandler extends AnalysisRequestHandlerBase { /** * {@inheritDoc} */ + @Override protected NamedList doAnalysis(SolrQueryRequest req) throws Exception { DocumentAnalysisRequest analysisRequest = resolveAnalysisRequest(req); return handleAnalysisRequest(analysisRequest, req.getSchema()); diff --git a/solr/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java b/solr/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java index 580735b81c3..b30ae6135ab 100644 --- a/solr/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java +++ b/solr/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java @@ -94,6 +94,7 @@ public class FieldAnalysisRequestHandler extends AnalysisRequestHandlerBase { /** * {@inheritDoc} */ + @Override protected NamedList doAnalysis(SolrQueryRequest req) throws Exception { FieldAnalysisRequest analysisRequest = resolveAnalysisRequest(req); IndexSchema indexSchema = req.getCore().getSchema(); diff --git a/solr/src/java/org/apache/solr/handler/JsonUpdateRequestHandler.java b/solr/src/java/org/apache/solr/handler/JsonUpdateRequestHandler.java index 12d00420abb..9f36c37d785 100644 --- a/solr/src/java/org/apache/solr/handler/JsonUpdateRequestHandler.java +++ b/solr/src/java/org/apache/solr/handler/JsonUpdateRequestHandler.java @@ -35,6 +35,7 @@ public class JsonUpdateRequestHandler extends ContentStreamHandlerBase { super.init(args); } + @Override protected ContentStreamLoader newLoader(SolrQueryRequest req, UpdateRequestProcessor processor) { return new JsonLoader(processor); } diff --git a/solr/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/src/java/org/apache/solr/handler/ReplicationHandler.java index 188175a28a2..30822960a83 100644 --- a/solr/src/java/org/apache/solr/handler/ReplicationHandler.java +++ b/solr/src/java/org/apache/solr/handler/ReplicationHandler.java @@ -98,6 +98,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw private AtomicBoolean replicationEnabled = new AtomicBoolean(true); + @Override public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { rsp.setHttpCaching(false); final SolrParams solrParams = req.getParams(); @@ -143,6 +144,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw } final SolrParams paramsCopy = new ModifiableSolrParams(solrParams); new Thread() { + @Override public void run() { doFetch(paramsCopy); } @@ -447,18 +449,22 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw return fileMeta; } + @Override public String getDescription() { return "ReplicationHandler provides replication of index and configuration files from Master to Slaves"; } + @Override public String getSourceId() { return "$Id$"; } + @Override public String getSource() { return "$URL$"; } + @Override public String getVersion() { return "$Revision$"; } diff --git a/solr/src/java/org/apache/solr/handler/SnapPuller.java b/solr/src/java/org/apache/solr/handler/SnapPuller.java index b93d34f389b..20ce25e485d 100644 --- a/solr/src/java/org/apache/solr/handler/SnapPuller.java +++ b/solr/src/java/org/apache/solr/handler/SnapPuller.java @@ -508,6 +508,7 @@ public class SnapPuller { private void reloadCore() { new Thread() { + @Override public void run() { try { solrCore.getCoreDescriptor().getCoreContainer().reload(solrCore.getName()); diff --git a/solr/src/java/org/apache/solr/handler/SnapShooter.java b/solr/src/java/org/apache/solr/handler/SnapShooter.java index c1992636c2e..b534d04a97e 100644 --- a/solr/src/java/org/apache/solr/handler/SnapShooter.java +++ b/solr/src/java/org/apache/solr/handler/SnapShooter.java @@ -64,6 +64,7 @@ public class SnapShooter { replicationHandler.core.getDeletionPolicy().saveCommitPoint(indexCommit.getVersion()); new Thread() { + @Override public void run() { createSnapshot(indexCommit, replicationHandler); } diff --git a/solr/src/java/org/apache/solr/handler/XMLLoader.java b/solr/src/java/org/apache/solr/handler/XMLLoader.java index 47c370aaa0f..b87c54a9ecd 100644 --- a/solr/src/java/org/apache/solr/handler/XMLLoader.java +++ b/solr/src/java/org/apache/solr/handler/XMLLoader.java @@ -54,6 +54,7 @@ class XMLLoader extends ContentStreamLoader { this.inputFactory = inputFactory; } + @Override public void load(SolrQueryRequest req, SolrQueryResponse rsp, ContentStream stream) throws Exception { errHeader = "XMLLoader: " + stream.getSourceInfo(); Reader reader = null; diff --git a/solr/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java b/solr/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java index 7dbfc45cf04..aa26f6cef71 100644 --- a/solr/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java +++ b/solr/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java @@ -80,6 +80,7 @@ public class XmlUpdateRequestHandler extends ContentStreamHandlerBase { } } + @Override protected ContentStreamLoader newLoader(SolrQueryRequest req, UpdateRequestProcessor processor) { return new XMLLoader(processor, inputFactory); } diff --git a/solr/src/java/org/apache/solr/handler/admin/SolrInfoMBeanHandler.java b/solr/src/java/org/apache/solr/handler/admin/SolrInfoMBeanHandler.java index c5fef3c14e7..51d100f308d 100644 --- a/solr/src/java/org/apache/solr/handler/admin/SolrInfoMBeanHandler.java +++ b/solr/src/java/org/apache/solr/handler/admin/SolrInfoMBeanHandler.java @@ -49,6 +49,7 @@ public class SolrInfoMBeanHandler extends RequestHandlerBase { } + @Override public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { SolrCore core = req.getCore(); @@ -94,18 +95,22 @@ public class SolrInfoMBeanHandler extends RequestHandlerBase { rsp.setHttpCaching(false); // never cache, no matter what init config looks like } + @Override public String getDescription() { return "Get Info (and statistics) about all registered SolrInfoMBeans"; } + @Override public String getSourceId() { return "$Id$"; } + @Override public String getSource() { return "$URL$"; } + @Override public String getVersion() { return "$Revision$"; } diff --git a/solr/src/java/org/apache/solr/handler/component/DebugComponent.java b/solr/src/java/org/apache/solr/handler/component/DebugComponent.java index d105c054150..a6717981786 100644 --- a/solr/src/java/org/apache/solr/handler/component/DebugComponent.java +++ b/solr/src/java/org/apache/solr/handler/component/DebugComponent.java @@ -86,6 +86,7 @@ public class DebugComponent extends SearchComponent } + @Override public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) { if (!rb.isDebug()) return; diff --git a/solr/src/java/org/apache/solr/handler/component/FacetComponent.java b/solr/src/java/org/apache/solr/handler/component/FacetComponent.java index 5b0098680e9..0bbeaff45f2 100644 --- a/solr/src/java/org/apache/solr/handler/component/FacetComponent.java +++ b/solr/src/java/org/apache/solr/handler/component/FacetComponent.java @@ -726,6 +726,7 @@ public class FacetComponent extends SearchComponent public long count; public int termNum; // term number starting at 0 (used in bit arrays) + @Override public String toString() { return "{term="+name+",termNum="+termNum+",count="+count+"}"; } diff --git a/solr/src/java/org/apache/solr/handler/component/HighlightComponent.java b/solr/src/java/org/apache/solr/handler/component/HighlightComponent.java index 10070d795f7..137f30b52c3 100644 --- a/solr/src/java/org/apache/solr/handler/component/HighlightComponent.java +++ b/solr/src/java/org/apache/solr/handler/component/HighlightComponent.java @@ -131,6 +131,7 @@ public class HighlightComponent extends SearchComponent implements PluginInfoIni } } + @Override public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) { if (!rb.doHighlights) return; diff --git a/solr/src/java/org/apache/solr/handler/component/QueryElevationComponent.java b/solr/src/java/org/apache/solr/handler/component/QueryElevationComponent.java index 8b4af7d715d..2539bea60ce 100644 --- a/solr/src/java/org/apache/solr/handler/component/QueryElevationComponent.java +++ b/solr/src/java/org/apache/solr/handler/component/QueryElevationComponent.java @@ -474,6 +474,7 @@ class ElevationComparatorSource extends FieldComparatorSource { this.priority = boosts; } + @Override public FieldComparator newComparator(final String fieldname, final int numHits, int sortPos, boolean reversed) throws IOException { return new FieldComparator() { @@ -482,10 +483,12 @@ class ElevationComparatorSource extends FieldComparatorSource { int bottomVal; private final BytesRef tempBR = new BytesRef(); + @Override public int compare(int slot1, int slot2) { return values[slot2] - values[slot1]; // values will be small enough that there is no overflow concern } + @Override public void setBottom(int slot) { bottomVal = values[slot]; } @@ -496,19 +499,23 @@ class ElevationComparatorSource extends FieldComparatorSource { return prio == null ? 0 : prio.intValue(); } + @Override public int compareBottom(int doc) throws IOException { return docVal(doc) - bottomVal; } + @Override public void copy(int slot, int doc) throws IOException { values[slot] = docVal(doc); } + @Override public FieldComparator setNextReader(AtomicReaderContext context) throws IOException { idIndex = FieldCache.DEFAULT.getTermsIndex(context.reader, fieldname); return this; } + @Override public Comparable value(int slot) { return values[slot]; } diff --git a/solr/src/java/org/apache/solr/handler/component/ShardDoc.java b/solr/src/java/org/apache/solr/handler/component/ShardDoc.java index 469d8adfb6f..5b17b1b5ec8 100755 --- a/solr/src/java/org/apache/solr/handler/component/ShardDoc.java +++ b/solr/src/java/org/apache/solr/handler/component/ShardDoc.java @@ -56,6 +56,7 @@ public class ShardDoc { int positionInResponse; // the ordinal position in the merged response arraylist + @Override public String toString(){ return "id="+id +" ,score="+score @@ -226,6 +227,7 @@ class ShardFieldSortedHitQueue extends PriorityQueue { // the negative sign on the final compareTo(). Comparator comparatorNatural(String fieldName) { return new ShardComparator(fieldName) { + @Override public final int compare(final Object o1, final Object o2) { ShardDoc sd1 = (ShardDoc) o1; ShardDoc sd2 = (ShardDoc) o2; @@ -247,6 +249,7 @@ class ShardFieldSortedHitQueue extends PriorityQueue { Locale locale) { final Collator collator = Collator.getInstance(locale); return new ShardComparator(fieldName) { + @Override public final int compare(final Object o1, final Object o2) { ShardDoc sd1 = (ShardDoc) o1; ShardDoc sd2 = (ShardDoc) o2; @@ -266,6 +269,7 @@ class ShardFieldSortedHitQueue extends PriorityQueue { Comparator comparatorMissingStringLast(final String fieldName) { return new ShardComparator(fieldName) { + @Override public final int compare(final Object o1, final Object o2) { ShardDoc sd1 = (ShardDoc) o1; ShardDoc sd2 = (ShardDoc) o2; diff --git a/solr/src/java/org/apache/solr/handler/component/ShardRequest.java b/solr/src/java/org/apache/solr/handler/component/ShardRequest.java index d8828cb24ac..528447f2723 100755 --- a/solr/src/java/org/apache/solr/handler/component/ShardRequest.java +++ b/solr/src/java/org/apache/solr/handler/component/ShardRequest.java @@ -56,6 +56,7 @@ public class ShardRequest { // this would work well if we ever transitioned to using internal ids and // didn't require a uniqueId + @Override public String toString() { return "ShardRequest:{params=" + params + ", purpose=" + Integer.toHexString(purpose) diff --git a/solr/src/java/org/apache/solr/handler/component/ShardResponse.java b/solr/src/java/org/apache/solr/handler/component/ShardResponse.java index 87f89571c44..8edf03e4984 100755 --- a/solr/src/java/org/apache/solr/handler/component/ShardResponse.java +++ b/solr/src/java/org/apache/solr/handler/component/ShardResponse.java @@ -27,6 +27,7 @@ public final class ShardResponse { private Throwable exception; private SolrResponse rsp; + @Override public String toString() { return "ShardResponse:{shard="+shard+",shardAddress="+shardAddress +"\n\trequest=" + req diff --git a/solr/src/java/org/apache/solr/handler/component/TermVectorComponent.java b/solr/src/java/org/apache/solr/handler/component/TermVectorComponent.java index 1fea0ac618b..8e3e8c8ef3c 100644 --- a/solr/src/java/org/apache/solr/handler/component/TermVectorComponent.java +++ b/solr/src/java/org/apache/solr/handler/component/TermVectorComponent.java @@ -71,6 +71,7 @@ public class TermVectorComponent extends SearchComponent implements SolrCoreAwar public static final String TERM_VECTORS = "termVectors"; + @Override public void process(ResponseBuilder rb) throws IOException { SolrParams params = rb.req.getParams(); if (!params.getBool(COMPONENT_NAME, false)) { @@ -288,6 +289,7 @@ public class TermVectorComponent extends SearchComponent implements SolrCoreAwar this.reader = reader; } + @Override public void map(BytesRef term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions) { NamedList termInfo = new NamedList(); fieldNL.add(term.utf8ToString(), termInfo); @@ -336,6 +338,7 @@ public class TermVectorComponent extends SearchComponent implements SolrCoreAwar return result; } + @Override public void setExpectations(String field, int numTerms, boolean storeOffsets, boolean storePositions) { if (fieldOptions.docFreq == true && reader != null) { @@ -358,6 +361,7 @@ public class TermVectorComponent extends SearchComponent implements SolrCoreAwar } } + @Override public void prepare(ResponseBuilder rb) throws IOException { } @@ -374,18 +378,22 @@ public class TermVectorComponent extends SearchComponent implements SolrCoreAwar } + @Override public String getVersion() { return "$Revision$"; } + @Override public String getSourceId() { return "$Id$"; } + @Override public String getSource() { return "$URL$"; } + @Override public String getDescription() { return "A Component for working with Term Vectors"; } diff --git a/solr/src/java/org/apache/solr/handler/component/TermsComponent.java b/solr/src/java/org/apache/solr/handler/component/TermsComponent.java index 9fc48b352bb..93929eb2fab 100644 --- a/solr/src/java/org/apache/solr/handler/component/TermsComponent.java +++ b/solr/src/java/org/apache/solr/handler/component/TermsComponent.java @@ -68,6 +68,7 @@ public class TermsComponent extends SearchComponent { } } + @Override public void process(ResponseBuilder rb) throws IOException { SolrParams params = rb.req.getParams(); if (!params.getBool(TermsParams.TERMS, false)) return; @@ -463,18 +464,22 @@ public class TermsComponent extends SearchComponent { } } + @Override public String getVersion() { return "$Revision$"; } + @Override public String getSourceId() { return "$Id$"; } + @Override public String getSource() { return "$URL$"; } + @Override public String getDescription() { return "A Component for working with Term Enumerators"; } diff --git a/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java b/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java index 41604fab4b1..7776ac94871 100644 --- a/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java +++ b/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java @@ -120,6 +120,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf } //just for back-compat with the deprecated method private boolean initialized = false; + @Override @Deprecated public void initalize( SolrConfig config) { if (initialized) return; @@ -333,6 +334,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf * @return NamedList containing a NamedList for each document, which in * turns contains sets (field, summary) pairs. */ + @Override @SuppressWarnings("unchecked") public NamedList doHighlighting(DocList docs, Query query, SolrQueryRequest req, String[] defaultFields) throws IOException { SolrParams params = req.getParams(); @@ -639,6 +641,7 @@ class TermOffsetsTokenStream { this.length = length; } + @Override public boolean incrementToken() throws IOException { while( true ){ if( bufferedToken == null ) { diff --git a/solr/src/java/org/apache/solr/highlight/GapFragmenter.java b/solr/src/java/org/apache/solr/highlight/GapFragmenter.java index b8d4f0ded43..765316b864b 100644 --- a/solr/src/java/org/apache/solr/highlight/GapFragmenter.java +++ b/solr/src/java/org/apache/solr/highlight/GapFragmenter.java @@ -92,6 +92,7 @@ class LuceneGapFragmenter extends SimpleFragmenter { /* (non-Javadoc) * @see org.apache.lucene.search.highlight.TextFragmenter#start(java.lang.String) */ + @Override public void start(String originalText, TokenStream tokenStream) { offsetAtt = tokenStream.getAttribute(OffsetAttribute.class); posIncAtt = tokenStream.getAttribute(PositionIncrementAttribute.class); @@ -101,6 +102,7 @@ class LuceneGapFragmenter extends SimpleFragmenter { /* (non-Javadoc) * @see org.apache.lucene.search.highlight.TextFragmenter#isNewFragment(org.apache.lucene.analysis.Token) */ + @Override public boolean isNewFragment() { int endOffset = offsetAtt.endOffset(); boolean isNewFrag = diff --git a/solr/src/java/org/apache/solr/highlight/RegexFragmenter.java b/solr/src/java/org/apache/solr/highlight/RegexFragmenter.java index ec18e33efbd..a958d66a9ab 100644 --- a/solr/src/java/org/apache/solr/highlight/RegexFragmenter.java +++ b/solr/src/java/org/apache/solr/highlight/RegexFragmenter.java @@ -54,6 +54,7 @@ public class RegexFragmenter extends HighlightingPluginBase implements SolrFragm protected String defaultPatternRaw; protected Pattern defaultPattern; + @Override public void init(NamedList args) { super.init(args); defaultPatternRaw = LuceneRegexFragmenter.DEFAULT_PATTERN_RAW; diff --git a/solr/src/java/org/apache/solr/request/ServletSolrParams.java b/solr/src/java/org/apache/solr/request/ServletSolrParams.java index 33b1cfa669a..49922c81332 100644 --- a/solr/src/java/org/apache/solr/request/ServletSolrParams.java +++ b/solr/src/java/org/apache/solr/request/ServletSolrParams.java @@ -29,6 +29,7 @@ public class ServletSolrParams extends MultiMapSolrParams { super(req.getParameterMap()); } + @Override public String get(String name) { String[] arr = map.get(name); if (arr==null) return null; diff --git a/solr/src/java/org/apache/solr/request/SimpleFacets.java b/solr/src/java/org/apache/solr/request/SimpleFacets.java index 2a959a3e87a..3026f2dd5a0 100644 --- a/solr/src/java/org/apache/solr/request/SimpleFacets.java +++ b/solr/src/java/org/apache/solr/request/SimpleFacets.java @@ -1177,9 +1177,11 @@ public class SimpleFacets { } public K key; public V val; + @Override public int hashCode() { return key.hashCode() ^ val.hashCode(); } + @Override public boolean equals(Object o) { if (! (o instanceof CountPair)) return false; CountPair that = (CountPair) o; @@ -1290,9 +1292,11 @@ public class SimpleFacets { extends RangeEndpointCalculator { public FloatRangeEndpointCalculator(final SchemaField f) { super(f); } + @Override protected Float parseVal(String rawval) { return Float.valueOf(rawval); } + @Override public Float parseAndAddGap(Float value, String gap) { return new Float(value.floatValue() + Float.valueOf(gap).floatValue()); } @@ -1301,9 +1305,11 @@ public class SimpleFacets { extends RangeEndpointCalculator { public DoubleRangeEndpointCalculator(final SchemaField f) { super(f); } + @Override protected Double parseVal(String rawval) { return Double.valueOf(rawval); } + @Override public Double parseAndAddGap(Double value, String gap) { return new Double(value.floatValue() + Double.valueOf(gap).floatValue()); } @@ -1312,9 +1318,11 @@ public class SimpleFacets { extends RangeEndpointCalculator { public IntegerRangeEndpointCalculator(final SchemaField f) { super(f); } + @Override protected Integer parseVal(String rawval) { return Integer.valueOf(rawval); } + @Override public Integer parseAndAddGap(Integer value, String gap) { return new Integer(value.intValue() + Integer.valueOf(gap).intValue()); } @@ -1323,9 +1331,11 @@ public class SimpleFacets { extends RangeEndpointCalculator { public LongRangeEndpointCalculator(final SchemaField f) { super(f); } + @Override protected Long parseVal(String rawval) { return Long.valueOf(rawval); } + @Override public Long parseAndAddGap(Long value, String gap) { return new Long(value.intValue() + Long.valueOf(gap).intValue()); } @@ -1342,15 +1352,19 @@ public class SimpleFacets { ("SchemaField must use filed type extending DateField"); } } + @Override public String formatValue(Date val) { return ((DateField)field.getType()).toExternal(val); } + @Override protected Date parseVal(String rawval) { return ((DateField)field.getType()).parseMath(now, rawval); } + @Override protected Object parseGap(final String rawval) { return rawval; } + @Override public Date parseAndAddGap(Date value, String gap) throws java.text.ParseException { final DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.US); dmp.setNow(value); diff --git a/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java b/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java index d598966aeea..699cbe7c74d 100644 --- a/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java +++ b/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java @@ -127,6 +127,7 @@ public abstract class SolrQueryRequestBase implements SolrQueryRequest { return origParams.toString(); } + @Override public String toString() { return this.getClass().getSimpleName() + '{' + params + '}'; } diff --git a/solr/src/java/org/apache/solr/request/UnInvertedField.java b/solr/src/java/org/apache/solr/request/UnInvertedField.java index 9014d1e1e92..ede2328b2f2 100755 --- a/solr/src/java/org/apache/solr/request/UnInvertedField.java +++ b/solr/src/java/org/apache/solr/request/UnInvertedField.java @@ -882,6 +882,7 @@ public class UnInvertedField { return te.skipTo(termNum); } + @Override public String toString() { return "{field=" + field + ",memSize="+memSize() @@ -1158,6 +1159,7 @@ class TermIndex { ArrayList lst; PagedBytes bytes; + @Override protected BytesRef setTerm() throws IOException { BytesRef br = super.setTerm(); if (br != null && (pos & intervalMask)==0) { @@ -1173,10 +1175,12 @@ class TermIndex { return br; } + @Override public BytesRef skipTo(int termNumber) throws IOException { throw new UnsupportedOperationException(); } + @Override public void close() throws IOException { nTerms=pos; super.close(); diff --git a/solr/src/java/org/apache/solr/response/JSONResponseWriter.java b/solr/src/java/org/apache/solr/response/JSONResponseWriter.java index e30477920bd..48e373f5e7e 100644 --- a/solr/src/java/org/apache/solr/response/JSONResponseWriter.java +++ b/solr/src/java/org/apache/solr/response/JSONResponseWriter.java @@ -286,6 +286,7 @@ class JSONWriter extends TextResponseWriter { } + @Override public void writeNamedList(String name, NamedList val) throws IOException { if (val instanceof SimpleOrderedMap) { writeNamedListAsMapWithDups(name,val); @@ -391,6 +392,7 @@ class JSONWriter extends TextResponseWriter { writeMapCloser(); } + @Override public void writeSolrDocument(String name, SolrDocument doc, Set returnFields, Map pseudoFields) throws IOException { writeMapOpener(-1); // no trivial way to determine map size // TODO: could easily figure out size for SolrDocument if needed... @@ -437,6 +439,7 @@ class JSONWriter extends TextResponseWriter { // if a Doc can ever contain another doc, this optimization would have to go. private final HashMap scoreMap = new HashMap(1); + @Override public void writeDoc(String name, Document doc, Set returnFields, float score, boolean includeScore) throws IOException { Map other = null; if (includeScore) { @@ -446,6 +449,7 @@ class JSONWriter extends TextResponseWriter { writeDoc(name, doc.getFields(), returnFields, other); } + @Override public void writeDocList(String name, DocList ids, Set fields, Map otherFields) throws IOException { boolean includeScore=false; if (fields!=null) { @@ -595,6 +599,7 @@ class JSONWriter extends TextResponseWriter { writer.write(']'); } + @Override public void writeStr(String name, String val, boolean needsEscaping) throws IOException { // it might be more efficient to use a stringbuilder or write substrings // if writing chars to the stream is slow. @@ -647,6 +652,7 @@ class JSONWriter extends TextResponseWriter { } + @Override public void writeMap(String name, Map val, boolean excludeOuter, boolean isFirstVal) throws IOException { if (!excludeOuter) { writeMapOpener(val.size()); @@ -678,6 +684,7 @@ class JSONWriter extends TextResponseWriter { } } + @Override public void writeArray(String name, Iterator val) throws IOException { writeArrayOpener(-1); // no trivial way to determine array size incLevel(); @@ -697,30 +704,37 @@ class JSONWriter extends TextResponseWriter { // // Primitive types // + @Override public void writeNull(String name) throws IOException { writer.write("null"); } + @Override public void writeInt(String name, String val) throws IOException { writer.write(val); } + @Override public void writeLong(String name, String val) throws IOException { writer.write(val); } + @Override public void writeBool(String name, String val) throws IOException { writer.write(val); } + @Override public void writeFloat(String name, String val) throws IOException { writer.write(val); } + @Override public void writeDouble(String name, String val) throws IOException { writer.write(val); } + @Override public void writeDate(String name, String val) throws IOException { writeStr(name, val, false); } diff --git a/solr/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java b/solr/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java index 60d84f7b575..0149882cb05 100755 --- a/solr/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java +++ b/solr/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java @@ -92,6 +92,7 @@ class PHPSerializedWriter extends JSONWriter { doIndent = false; } + @Override public void writeResponse() throws IOException { Boolean omitHeader = req.getParams().getBool(CommonParams.OMIT_HEADER); if(omitHeader != null && omitHeader) rsp.getValues().remove("responseHeader"); diff --git a/solr/src/java/org/apache/solr/response/PageTool.java b/solr/src/java/org/apache/solr/response/PageTool.java index e6ad24794a1..6a664d63871 100644 --- a/solr/src/java/org/apache/solr/response/PageTool.java +++ b/solr/src/java/org/apache/solr/response/PageTool.java @@ -73,6 +73,7 @@ public class PageTool { return current_page_number; } + @Override public String toString() { return "Found " + results_found + " Page " + current_page_number + " of " + page_count + diff --git a/solr/src/java/org/apache/solr/response/RubyResponseWriter.java b/solr/src/java/org/apache/solr/response/RubyResponseWriter.java index 7ee0b5bd268..585b248d3e7 100644 --- a/solr/src/java/org/apache/solr/response/RubyResponseWriter.java +++ b/solr/src/java/org/apache/solr/response/RubyResponseWriter.java @@ -45,7 +45,9 @@ public class RubyResponseWriter implements QueryResponseWriter { class RubyWriter extends NaNFloatWriter { + @Override protected String getNaN() { return "(0.0/0.0)"; } + @Override protected String getInf() { return "(1.0/0.0)"; } public RubyWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) { diff --git a/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java b/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java index c9381cf7af8..9784fe01efa 100644 --- a/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java +++ b/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java @@ -49,18 +49,22 @@ public class SolrParamResourceLoader extends ResourceLoader { } } + @Override public void init(ExtendedProperties extendedProperties) { } + @Override public InputStream getResourceStream(String s) throws ResourceNotFoundException { String template = templates.get(s); return template == null ? null : new ByteArrayInputStream(template.getBytes()); } + @Override public boolean isSourceModified(Resource resource) { return false; } + @Override public long getLastModified(Resource resource) { return 0; } diff --git a/solr/src/java/org/apache/solr/response/SolrVelocityResourceLoader.java b/solr/src/java/org/apache/solr/response/SolrVelocityResourceLoader.java index c42dc10a960..67feca0a4a1 100644 --- a/solr/src/java/org/apache/solr/response/SolrVelocityResourceLoader.java +++ b/solr/src/java/org/apache/solr/response/SolrVelocityResourceLoader.java @@ -33,17 +33,21 @@ public class SolrVelocityResourceLoader extends ResourceLoader { this.loader = loader; } + @Override public void init(ExtendedProperties extendedProperties) { } + @Override public InputStream getResourceStream(String template_name) throws ResourceNotFoundException { return loader.openResource(template_name); } + @Override public boolean isSourceModified(Resource resource) { return false; } + @Override public long getLastModified(Resource resource) { return 0; } diff --git a/solr/src/java/org/apache/solr/response/XMLWriter.java b/solr/src/java/org/apache/solr/response/XMLWriter.java index 7f6465fb49d..062ab413b3f 100644 --- a/solr/src/java/org/apache/solr/response/XMLWriter.java +++ b/solr/src/java/org/apache/solr/response/XMLWriter.java @@ -436,6 +436,7 @@ public final class XMLWriter extends TextResponseWriter { } + @Override public void writeVal(String name, Object val) throws IOException { // if there get to be enough types, perhaps hashing on the type @@ -494,6 +495,7 @@ public final class XMLWriter extends TextResponseWriter { // Generic compound types // + @Override public void writeNamedList(String name, NamedList val) throws IOException { int sz = val.size(); startTag("lst", name, sz<=0); diff --git a/solr/src/java/org/apache/solr/schema/AbstractSubTypeFieldType.java b/solr/src/java/org/apache/solr/schema/AbstractSubTypeFieldType.java index 913163b2d4c..8ebe95da7f7 100644 --- a/solr/src/java/org/apache/solr/schema/AbstractSubTypeFieldType.java +++ b/solr/src/java/org/apache/solr/schema/AbstractSubTypeFieldType.java @@ -103,6 +103,7 @@ public abstract class AbstractSubTypeFieldType extends FieldType implements Sche /** * Throws UnsupportedOperationException() */ + @Override public Query getFieldQuery(QParser parser, SchemaField field, String externalVal) { throw new UnsupportedOperationException(); } diff --git a/solr/src/java/org/apache/solr/schema/BCDIntField.java b/solr/src/java/org/apache/solr/schema/BCDIntField.java index 6a2ef7a0ea9..534a7dcf1b0 100644 --- a/solr/src/java/org/apache/solr/schema/BCDIntField.java +++ b/solr/src/java/org/apache/solr/schema/BCDIntField.java @@ -30,9 +30,11 @@ import java.io.IOException; * @version $Id$ */ public class BCDIntField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return getStringSort(field,reverse); } @@ -42,11 +44,13 @@ public class BCDIntField extends FieldType { throw new UnsupportedOperationException("ValueSource not implemented"); } + @Override public String toInternal(String val) { // TODO? make sure each character is a digit? return BCDUtils.base10toBase10kSortableInt(val); } + @Override public String toExternal(Fieldable f) { return indexedToReadable(f.stringValue()); } @@ -57,10 +61,12 @@ public class BCDIntField extends FieldType { return Integer.valueOf( toExternal(f) ); } + @Override public String indexedToReadable(String indexedForm) { return BCDUtils.base10kSortableIntToBase10(indexedForm); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { writer.writeInt(name,toExternal(f)); } diff --git a/solr/src/java/org/apache/solr/schema/BinaryField.java b/solr/src/java/org/apache/solr/schema/BinaryField.java index e78ead4d9f1..c9c22461d4d 100644 --- a/solr/src/java/org/apache/solr/schema/BinaryField.java +++ b/solr/src/java/org/apache/solr/schema/BinaryField.java @@ -33,19 +33,23 @@ public class BinaryField extends FieldType { return Base64.byteArrayToBase64(buf.array(), buf.position(), buf.limit()-buf.position()); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { writer.writeStr(name, toBase64String(toObject(f)), false); } + @Override public SortField getSortField(SchemaField field, boolean top) { throw new RuntimeException("Cannot sort on a Binary field"); } + @Override public String toExternal(Fieldable f) { return toBase64String(toObject(f)); } + @Override public ByteBuffer toObject(Fieldable f) { return ByteBuffer.wrap(f.getBinaryValue(), f.getBinaryOffset(), f.getBinaryLength() ) ; } diff --git a/solr/src/java/org/apache/solr/schema/BoolField.java b/solr/src/java/org/apache/solr/schema/BoolField.java index 907849a15ff..0694e4c4c13 100644 --- a/solr/src/java/org/apache/solr/schema/BoolField.java +++ b/solr/src/java/org/apache/solr/schema/BoolField.java @@ -37,9 +37,11 @@ import java.io.IOException; * @version $Id$ */ public class BoolField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return getStringSort(field,reverse); } @@ -58,6 +60,7 @@ public class BoolField extends FieldType { // handle single valued non-text fields (int,bool,etc) if needed. protected final static Analyzer boolAnalyzer = new SolrAnalyzer() { + @Override public TokenStreamInfo getStream(String fieldName, Reader reader) { Tokenizer tokenizer = new Tokenizer(reader) { final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); @@ -88,19 +91,23 @@ public class BoolField extends FieldType { }; + @Override public Analyzer getAnalyzer() { return boolAnalyzer; } + @Override public Analyzer getQueryAnalyzer() { return boolAnalyzer; } + @Override public String toInternal(String val) { char ch = (val!=null && val.length()>0) ? val.charAt(0) : 0; return (ch=='1' || ch=='t' || ch=='T') ? "T" : "F"; } + @Override public String toExternal(Fieldable f) { return indexedToReadable(f.stringValue()); } @@ -115,6 +122,7 @@ public class BoolField extends FieldType { return term.bytes[0] == 'T'; } + @Override public String indexedToReadable(String indexedForm) { char ch = indexedForm.charAt(0); return ch=='T' ? "true" : "false"; @@ -129,6 +137,7 @@ public class BoolField extends FieldType { } } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { writer.writeBool(name, f.stringValue().charAt(0) =='T'); } diff --git a/solr/src/java/org/apache/solr/schema/ByteField.java b/solr/src/java/org/apache/solr/schema/ByteField.java index ce84ec3b966..204bce94836 100644 --- a/solr/src/java/org/apache/solr/schema/ByteField.java +++ b/solr/src/java/org/apache/solr/schema/ByteField.java @@ -33,11 +33,13 @@ import java.util.Map; * @version $Id$ */ public class ByteField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { restrictProps(SORT_MISSING_FIRST | SORT_MISSING_LAST); } ///////////////////////////////////////////////////////////// + @Override public SortField getSortField(SchemaField field, boolean reverse) { return new SortField(field.name, SortField.BYTE, reverse); } @@ -47,6 +49,7 @@ public class ByteField extends FieldType { return new ByteFieldSource( new ByteValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) ); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { String s = f.stringValue(); diff --git a/solr/src/java/org/apache/solr/schema/DateField.java b/solr/src/java/org/apache/solr/schema/DateField.java index d60584a5f3a..400501308f8 100644 --- a/solr/src/java/org/apache/solr/schema/DateField.java +++ b/solr/src/java/org/apache/solr/schema/DateField.java @@ -125,12 +125,14 @@ public class DateField extends FieldType { // The easiest fix is to simply remove the 'Z' for the internal // format. + @Override protected void init(IndexSchema schema, Map args) { } protected static String NOW = "NOW"; protected static char Z = 'Z'; + @Override public String toInternal(String val) { return toInternal(parseMath(null, val)); } @@ -183,6 +185,7 @@ public class DateField extends FieldType { return formatDate(val); } + @Override public String indexedToReadable(String indexedForm) { return indexedForm + Z; } @@ -193,6 +196,7 @@ public class DateField extends FieldType { out.write(Z); } + @Override public String toExternal(Fieldable f) { return indexedToReadable(f.stringValue()); } @@ -211,6 +215,7 @@ public class DateField extends FieldType { } } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return getStringSort(field,reverse); } @@ -219,6 +224,7 @@ public class DateField extends FieldType { return new OrdFieldSource(field.name); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { writer.writeDate(name, toExternal(f)); } @@ -336,6 +342,7 @@ public class DateField extends FieldType { this.setTimeZone(CANONICAL_TZ); } + @Override public Date parse(String i, ParsePosition p) { /* delegate to SimpleDateFormat for easy stuff */ Date d = super.parse(i, p); @@ -357,6 +364,7 @@ public class DateField extends FieldType { return d; } + @Override public StringBuffer format(Date d, StringBuffer toAppendTo, FieldPosition pos) { /* delegate to SimpleDateFormat for easy stuff */ @@ -375,6 +383,7 @@ public class DateField extends FieldType { return toAppendTo; } + @Override public Object clone() { ISO8601CanonicalDateFormat c = (ISO8601CanonicalDateFormat) super.clone(); @@ -391,6 +400,7 @@ public class DateField extends FieldType { super(); proto = d; } + @Override protected DateFormat initialValue() { return (DateFormat) proto.clone(); } @@ -423,34 +433,42 @@ class DateFieldSource extends FieldCacheSource { this.ft = ft; } + @Override public String description() { return "date(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { return new StringIndexDocValues(this, readerContext, field) { + @Override protected String toTerm(String readableValue) { // needed for frange queries to work properly return ft.toInternal(readableValue); } + @Override public float floatVal(int doc) { return (float)intVal(doc); } + @Override public int intVal(int doc) { int ord=termsIndex.getOrd(doc); return ord; } + @Override public long longVal(int doc) { return (long)intVal(doc); } + @Override public double doubleVal(int doc) { return (double)intVal(doc); } + @Override public String strVal(int doc) { int ord=termsIndex.getOrd(doc); if (ord == 0) { @@ -463,18 +481,21 @@ class DateFieldSource extends FieldCacheSource { } } + @Override public String toString(int doc) { return description() + '=' + intVal(doc); } }; } + @Override public boolean equals(Object o) { return o instanceof DateFieldSource && super.equals(o); } private static int hcode = DateFieldSource.class.hashCode(); + @Override public int hashCode() { return hcode + super.hashCode(); }; diff --git a/solr/src/java/org/apache/solr/schema/DoubleField.java b/solr/src/java/org/apache/solr/schema/DoubleField.java index 79da6845ccd..62e34e7ab82 100644 --- a/solr/src/java/org/apache/solr/schema/DoubleField.java +++ b/solr/src/java/org/apache/solr/schema/DoubleField.java @@ -33,11 +33,13 @@ import java.util.Map; * @version $Id$ */ public class DoubleField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { restrictProps(SORT_MISSING_FIRST | SORT_MISSING_LAST); } ///////////////////////////////////////////////////////////// + @Override public SortField getSortField(SchemaField field, boolean reverse) { return new SortField(field.name, SortField.DOUBLE, reverse); } @@ -48,6 +50,7 @@ public class DoubleField extends FieldType { return new DoubleFieldSource( new DoubleValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) ); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { String s = f.stringValue(); diff --git a/solr/src/java/org/apache/solr/schema/ExternalFileField.java b/solr/src/java/org/apache/solr/schema/ExternalFileField.java index f468202c7ea..2eb539426b8 100755 --- a/solr/src/java/org/apache/solr/schema/ExternalFileField.java +++ b/solr/src/java/org/apache/solr/schema/ExternalFileField.java @@ -59,6 +59,7 @@ public class ExternalFileField extends FieldType { private IndexSchema schema; private float defVal; + @Override protected void init(IndexSchema schema, Map args) { restrictProps(SORT_MISSING_FIRST | SORT_MISSING_LAST); String ftypeS = getArg("valType", args); @@ -74,14 +75,17 @@ public class ExternalFileField extends FieldType { this.schema = schema; } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { throw new UnsupportedOperationException(); } + @Override public SortField getSortField(SchemaField field,boolean reverse) { throw new UnsupportedOperationException(); } + @Override public ValueSource getValueSource(SchemaField field, QParser parser) { // default key field to unique key SchemaField keyField = keyFieldName==null ? schema.getUniqueKeyField() : schema.getField(keyFieldName); diff --git a/solr/src/java/org/apache/solr/schema/FieldType.java b/solr/src/java/org/apache/solr/schema/FieldType.java index a92c0f42578..712c22519f7 100644 --- a/solr/src/java/org/apache/solr/schema/FieldType.java +++ b/solr/src/java/org/apache/solr/schema/FieldType.java @@ -185,6 +185,7 @@ public abstract class FieldType extends FieldProperties { this.typeName = typeName; } + @Override public String toString() { return typeName + "{class=" + this.getClass().getName() // + propertiesToString(properties) @@ -390,6 +391,7 @@ public abstract class FieldType extends FieldProperties { this.maxChars=maxChars; } + @Override public TokenStreamInfo getStream(String fieldName, Reader reader) { Tokenizer ts = new Tokenizer(reader) { final char[] cbuf = new char[maxChars]; diff --git a/solr/src/java/org/apache/solr/schema/FloatField.java b/solr/src/java/org/apache/solr/schema/FloatField.java index 9cd2cad66b0..2df5ec9c345 100644 --- a/solr/src/java/org/apache/solr/schema/FloatField.java +++ b/solr/src/java/org/apache/solr/schema/FloatField.java @@ -32,10 +32,12 @@ import java.io.IOException; * @version $Id$ */ public class FloatField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { restrictProps(SORT_MISSING_FIRST | SORT_MISSING_LAST); } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return new SortField(field.name,SortField.FLOAT, reverse); } @@ -45,6 +47,7 @@ public class FloatField extends FieldType { return new FloatFieldSource( new FloatValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) ); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { String s = f.stringValue(); diff --git a/solr/src/java/org/apache/solr/schema/IndexSchema.java b/solr/src/java/org/apache/solr/schema/IndexSchema.java index df47bbf4de0..b5727233e48 100644 --- a/solr/src/java/org/apache/solr/schema/IndexSchema.java +++ b/solr/src/java/org/apache/solr/schema/IndexSchema.java @@ -316,6 +316,7 @@ public final class IndexSchema { return analyzer!=null ? analyzer : getDynamicFieldType(fieldName).getAnalyzer(); } + @Override public TokenStream tokenStream(String fieldName, Reader reader) { return getAnalyzer(fieldName).tokenStream(fieldName,reader); @@ -497,6 +498,7 @@ public final class IndexSchema { Node node = (Node) xpath.evaluate("/schema/similarity", document, XPathConstants.NODE); if (node==null) { similarityFactory = new SimilarityFactory() { + @Override public SimilarityProvider getSimilarityProvider() { return IndexSearcher.getDefaultSimilarityProvider(); } @@ -512,6 +514,7 @@ public final class IndexSchema { } else { // just like always, assume it's a SimilarityProvider and get a ClassCastException - reasonable error handling similarityFactory = new SimilarityFactory() { + @Override public SimilarityProvider getSimilarityProvider() { return (SimilarityProvider) obj; } @@ -946,6 +949,7 @@ public final class IndexSchema { return new SchemaField(prototype, name); } + @Override public String toString() { return prototype.toString(); } diff --git a/solr/src/java/org/apache/solr/schema/IntField.java b/solr/src/java/org/apache/solr/schema/IntField.java index e8ccab2b667..5d8182d52ae 100644 --- a/solr/src/java/org/apache/solr/schema/IntField.java +++ b/solr/src/java/org/apache/solr/schema/IntField.java @@ -32,10 +32,12 @@ import java.io.IOException; * @version $Id$ */ public class IntField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { restrictProps(SORT_MISSING_FIRST | SORT_MISSING_LAST); } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return new SortField(field.name,SortField.INT, reverse); } @@ -45,6 +47,7 @@ public class IntField extends FieldType { return new IntFieldSource(new IntValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) ); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { String s = f.stringValue(); diff --git a/solr/src/java/org/apache/solr/schema/LongField.java b/solr/src/java/org/apache/solr/schema/LongField.java index c716552f5af..f1189b6adb7 100644 --- a/solr/src/java/org/apache/solr/schema/LongField.java +++ b/solr/src/java/org/apache/solr/schema/LongField.java @@ -32,12 +32,14 @@ import java.util.Map; * @version $Id$ */ public class LongField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { restrictProps(SORT_MISSING_FIRST | SORT_MISSING_LAST); } ///////////////////////////////////////////////////////////// + @Override public SortField getSortField(SchemaField field,boolean reverse) { return new SortField(field.name,SortField.LONG, reverse); diff --git a/solr/src/java/org/apache/solr/schema/RandomSortField.java b/solr/src/java/org/apache/solr/schema/RandomSortField.java index fd69557e3b1..f21047177c8 100644 --- a/solr/src/java/org/apache/solr/schema/RandomSortField.java +++ b/solr/src/java/org/apache/solr/schema/RandomSortField.java @@ -100,33 +100,40 @@ public class RandomSortField extends FieldType { private static FieldComparatorSource randomComparatorSource = new FieldComparatorSource() { + @Override public FieldComparator newComparator(final String fieldname, final int numHits, int sortPos, boolean reversed) throws IOException { return new FieldComparator() { int seed; private final int[] values = new int[numHits]; int bottomVal; + @Override public int compare(int slot1, int slot2) { return values[slot1] - values[slot2]; // values will be positive... no overflow possible. } + @Override public void setBottom(int slot) { bottomVal = values[slot]; } + @Override public int compareBottom(int doc) throws IOException { return bottomVal - hash(doc+seed); } + @Override public void copy(int slot, int doc) throws IOException { values[slot] = hash(doc+seed); } + @Override public FieldComparator setNextReader(AtomicReaderContext context) throws IOException { seed = getSeed(fieldname, context); return this; } + @Override public Comparable value(int slot) { return values[slot]; } diff --git a/solr/src/java/org/apache/solr/schema/ShortField.java b/solr/src/java/org/apache/solr/schema/ShortField.java index 94c77450a74..2db6861ccc0 100644 --- a/solr/src/java/org/apache/solr/schema/ShortField.java +++ b/solr/src/java/org/apache/solr/schema/ShortField.java @@ -35,12 +35,14 @@ import java.util.Map; * **/ public class ShortField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { restrictProps(SORT_MISSING_FIRST | SORT_MISSING_LAST); } ///////////////////////////////////////////////////////////// + @Override public SortField getSortField(SchemaField field, boolean reverse) { return new SortField(field.name, SortField.SHORT, reverse); diff --git a/solr/src/java/org/apache/solr/schema/SortableDoubleField.java b/solr/src/java/org/apache/solr/schema/SortableDoubleField.java index b12858b45c2..bb57454b19c 100644 --- a/solr/src/java/org/apache/solr/schema/SortableDoubleField.java +++ b/solr/src/java/org/apache/solr/schema/SortableDoubleField.java @@ -40,10 +40,13 @@ import java.io.IOException; * * @deprecated use {@link DoubleField} or {@link TrieDoubleField} - will be removed in 5.x */ +@Deprecated public class SortableDoubleField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return getStringSort(field,reverse); } @@ -53,10 +56,12 @@ public class SortableDoubleField extends FieldType { return new SortableDoubleFieldSource(field.name); } + @Override public String toInternal(String val) { return NumberUtils.double2sortableStr(val); } + @Override public String toExternal(Fieldable f) { return indexedToReadable(f.stringValue()); } @@ -66,6 +71,7 @@ public class SortableDoubleField extends FieldType { return NumberUtils.SortableStr2double(f.stringValue()); } + @Override public String indexedToReadable(String indexedForm) { return NumberUtils.SortableStr2doubleStr(indexedForm); } @@ -76,6 +82,7 @@ public class SortableDoubleField extends FieldType { out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) ); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { String sval = f.stringValue(); writer.writeDouble(name, NumberUtils.SortableStr2double(sval)); @@ -97,41 +104,50 @@ class SortableDoubleFieldSource extends FieldCacheSource { this.defVal = defVal; } + @Override public String description() { return "sdouble(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final double def = defVal; return new StringIndexDocValues(this, readerContext, field) { private final BytesRef spare = new BytesRef(); + @Override protected String toTerm(String readableValue) { return NumberUtils.double2sortableStr(readableValue); } + @Override public float floatVal(int doc) { return (float)doubleVal(doc); } + @Override public int intVal(int doc) { return (int)doubleVal(doc); } + @Override public long longVal(int doc) { return (long)doubleVal(doc); } + @Override public double doubleVal(int doc) { int ord=termsIndex.getOrd(doc); return ord==0 ? def : NumberUtils.SortableStr2double(termsIndex.lookup(ord, spare)); } + @Override public String strVal(int doc) { return Double.toString(doubleVal(doc)); } + @Override public String toString(int doc) { return description() + '=' + doubleVal(doc); } @@ -162,6 +178,7 @@ class SortableDoubleFieldSource extends FieldCacheSource { }; } + @Override public boolean equals(Object o) { return o instanceof SortableDoubleFieldSource && super.equals(o) @@ -169,6 +186,7 @@ class SortableDoubleFieldSource extends FieldCacheSource { } private static int hcode = SortableDoubleFieldSource.class.hashCode(); + @Override public int hashCode() { long bits = Double.doubleToLongBits(defVal); int ibits = (int)(bits ^ (bits>>>32)); // mix upper bits into lower. diff --git a/solr/src/java/org/apache/solr/schema/SortableFloatField.java b/solr/src/java/org/apache/solr/schema/SortableFloatField.java index b495227b1f6..5b10892c9d2 100644 --- a/solr/src/java/org/apache/solr/schema/SortableFloatField.java +++ b/solr/src/java/org/apache/solr/schema/SortableFloatField.java @@ -40,10 +40,13 @@ import java.io.IOException; * * @deprecated use {@link FloatField} or {@link TrieFloatField} - will be removed in 5.x */ +@Deprecated public class SortableFloatField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return getStringSort(field,reverse); } @@ -53,10 +56,12 @@ public class SortableFloatField extends FieldType { return new SortableFloatFieldSource(field.name); } + @Override public String toInternal(String val) { return NumberUtils.float2sortableStr(val); } + @Override public String toExternal(Fieldable f) { return indexedToReadable(f.stringValue()); } @@ -66,6 +71,7 @@ public class SortableFloatField extends FieldType { return NumberUtils.SortableStr2float(f.stringValue()); } + @Override public String indexedToReadable(String indexedForm) { return NumberUtils.SortableStr2floatStr(indexedForm); } @@ -76,6 +82,7 @@ public class SortableFloatField extends FieldType { out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) ); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { String sval = f.stringValue(); writer.writeFloat(name, NumberUtils.SortableStr2float(sval)); @@ -97,41 +104,50 @@ class SortableFloatFieldSource extends FieldCacheSource { this.defVal = defVal; } + @Override public String description() { return "sfloat(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final float def = defVal; return new StringIndexDocValues(this, readerContext, field) { private final BytesRef spare = new BytesRef(); + @Override protected String toTerm(String readableValue) { return NumberUtils.float2sortableStr(readableValue); } + @Override public float floatVal(int doc) { int ord=termsIndex.getOrd(doc); return ord==0 ? def : NumberUtils.SortableStr2float(termsIndex.lookup(ord, spare)); } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return (double)floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return description() + '=' + floatVal(doc); } @@ -162,6 +178,7 @@ class SortableFloatFieldSource extends FieldCacheSource { }; } + @Override public boolean equals(Object o) { return o instanceof SortableFloatFieldSource && super.equals(o) @@ -169,6 +186,7 @@ class SortableFloatFieldSource extends FieldCacheSource { } private static int hcode = SortableFloatFieldSource.class.hashCode(); + @Override public int hashCode() { return hcode + super.hashCode() + Float.floatToIntBits(defVal); }; diff --git a/solr/src/java/org/apache/solr/schema/SortableIntField.java b/solr/src/java/org/apache/solr/schema/SortableIntField.java index 421e4bc45fc..14bb248b972 100644 --- a/solr/src/java/org/apache/solr/schema/SortableIntField.java +++ b/solr/src/java/org/apache/solr/schema/SortableIntField.java @@ -40,10 +40,13 @@ import java.io.IOException; * * @deprecated use {@link IntField} or {@link TrieIntField} - will be removed in 5.x */ +@Deprecated public class SortableIntField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return getStringSort(field,reverse); } @@ -53,6 +56,7 @@ public class SortableIntField extends FieldType { return new SortableIntFieldSource(field.name); } + @Override public String toInternal(String val) { // special case single digits? years?, etc // stringCache? general stringCache on a @@ -60,10 +64,12 @@ public class SortableIntField extends FieldType { return NumberUtils.int2sortableStr(val); } + @Override public String toExternal(Fieldable f) { return indexedToReadable(f.stringValue()); } + @Override public String indexedToReadable(String indexedForm) { return NumberUtils.SortableStr2int(indexedForm); } @@ -79,6 +85,7 @@ public class SortableIntField extends FieldType { return NumberUtils.SortableStr2int(f.stringValue(), 0, 3); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { String sval = f.stringValue(); writer.writeInt(name, NumberUtils.SortableStr2int(sval,0,sval.length())); @@ -99,41 +106,50 @@ class SortableIntFieldSource extends FieldCacheSource { this.defVal = defVal; } + @Override public String description() { return "sint(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final int def = defVal; return new StringIndexDocValues(this, readerContext, field) { private final BytesRef spare = new BytesRef(); + @Override protected String toTerm(String readableValue) { return NumberUtils.int2sortableStr(readableValue); } + @Override public float floatVal(int doc) { return (float)intVal(doc); } + @Override public int intVal(int doc) { int ord=termsIndex.getOrd(doc); return ord==0 ? def : NumberUtils.SortableStr2int(termsIndex.lookup(ord, spare),0,3); } + @Override public long longVal(int doc) { return (long)intVal(doc); } + @Override public double doubleVal(int doc) { return (double)intVal(doc); } + @Override public String strVal(int doc) { return Integer.toString(intVal(doc)); } + @Override public String toString(int doc) { return description() + '=' + intVal(doc); } @@ -165,6 +181,7 @@ class SortableIntFieldSource extends FieldCacheSource { }; } + @Override public boolean equals(Object o) { return o instanceof SortableIntFieldSource && super.equals(o) @@ -172,6 +189,7 @@ class SortableIntFieldSource extends FieldCacheSource { } private static int hcode = SortableIntFieldSource.class.hashCode(); + @Override public int hashCode() { return hcode + super.hashCode() + defVal; }; diff --git a/solr/src/java/org/apache/solr/schema/SortableLongField.java b/solr/src/java/org/apache/solr/schema/SortableLongField.java index d23fff2bb26..f68d5e85fd3 100644 --- a/solr/src/java/org/apache/solr/schema/SortableLongField.java +++ b/solr/src/java/org/apache/solr/schema/SortableLongField.java @@ -40,10 +40,13 @@ import java.io.IOException; * * @deprecated use {@link LongField} or {@link TrieLongtField} - will be removed in 5.x */ +@Deprecated public class SortableLongField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return getStringSort(field,reverse); } @@ -53,10 +56,12 @@ public class SortableLongField extends FieldType { return new SortableLongFieldSource(field.name); } + @Override public String toInternal(String val) { return NumberUtils.long2sortableStr(val); } + @Override public String indexedToReadable(String indexedForm) { return NumberUtils.SortableStr2long(indexedForm); } @@ -67,6 +72,7 @@ public class SortableLongField extends FieldType { out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) ); } + @Override public String toExternal(Fieldable f) { return indexedToReadable(f.stringValue()); } @@ -76,6 +82,7 @@ public class SortableLongField extends FieldType { return NumberUtils.SortableStr2long(f.stringValue(),0,5); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { String sval = f.stringValue(); writer.writeLong(name, NumberUtils.SortableStr2long(sval,0,sval.length())); @@ -98,41 +105,50 @@ class SortableLongFieldSource extends FieldCacheSource { this.defVal = defVal; } + @Override public String description() { return "slong(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final long def = defVal; return new StringIndexDocValues(this, readerContext, field) { private final BytesRef spare = new BytesRef(); + @Override protected String toTerm(String readableValue) { return NumberUtils.long2sortableStr(readableValue); } + @Override public float floatVal(int doc) { return (float)longVal(doc); } + @Override public int intVal(int doc) { return (int)longVal(doc); } + @Override public long longVal(int doc) { int ord=termsIndex.getOrd(doc); return ord==0 ? def : NumberUtils.SortableStr2long(termsIndex.lookup(ord, spare),0,5); } + @Override public double doubleVal(int doc) { return (double)longVal(doc); } + @Override public String strVal(int doc) { return Long.toString(longVal(doc)); } + @Override public String toString(int doc) { return description() + '=' + longVal(doc); } @@ -163,6 +179,7 @@ class SortableLongFieldSource extends FieldCacheSource { }; } + @Override public boolean equals(Object o) { return o instanceof SortableLongFieldSource && super.equals(o) @@ -170,6 +187,7 @@ class SortableLongFieldSource extends FieldCacheSource { } private static int hcode = SortableLongFieldSource.class.hashCode(); + @Override public int hashCode() { return hcode + super.hashCode() + (int)defVal; }; diff --git a/solr/src/java/org/apache/solr/schema/StrField.java b/solr/src/java/org/apache/solr/schema/StrField.java index 3bfc5a5a0d9..7e34ab228b5 100644 --- a/solr/src/java/org/apache/solr/schema/StrField.java +++ b/solr/src/java/org/apache/solr/schema/StrField.java @@ -31,18 +31,22 @@ import java.io.IOException; * @version $Id$ */ public class StrField extends FieldType { + @Override protected void init(IndexSchema schema, Map args) { super.init(schema, args); } + @Override public SortField getSortField(SchemaField field,boolean reverse) { return getStringSort(field,reverse); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { writer.writeStr(name, f.stringValue(), true); } + @Override public ValueSource getValueSource(SchemaField field, QParser parser) { return new StrFieldSource(field.getName()); } diff --git a/solr/src/java/org/apache/solr/schema/StrFieldSource.java b/solr/src/java/org/apache/solr/schema/StrFieldSource.java index 36dcfcefcee..c1f78473cec 100755 --- a/solr/src/java/org/apache/solr/schema/StrFieldSource.java +++ b/solr/src/java/org/apache/solr/schema/StrFieldSource.java @@ -32,41 +32,51 @@ public class StrFieldSource extends FieldCacheSource { super(field); } + @Override public String description() { return "str(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { return new StringIndexDocValues(this, readerContext, field) { + @Override protected String toTerm(String readableValue) { return readableValue; } + @Override public float floatVal(int doc) { return (float)intVal(doc); } + @Override public int intVal(int doc) { int ord=termsIndex.getOrd(doc); return ord; } + @Override public long longVal(int doc) { return (long)intVal(doc); } + @Override public double doubleVal(int doc) { return (double)intVal(doc); } + @Override public int ordVal(int doc) { return termsIndex.getOrd(doc); } + @Override public int numOrd() { return termsIndex.numOrd(); } + @Override public String strVal(int doc) { int ord=termsIndex.getOrd(doc); if (ord == 0) { @@ -76,18 +86,21 @@ public class StrFieldSource extends FieldCacheSource { } } + @Override public String toString(int doc) { return description() + '=' + strVal(doc); } }; } + @Override public boolean equals(Object o) { return o instanceof StrFieldSource && super.equals(o); } private static int hcode = SortableFloatFieldSource.class.hashCode(); + @Override public int hashCode() { return hcode + super.hashCode(); }; diff --git a/solr/src/java/org/apache/solr/schema/TextField.java b/solr/src/java/org/apache/solr/schema/TextField.java index 47f6cbdb26b..d43cf54efa6 100644 --- a/solr/src/java/org/apache/solr/schema/TextField.java +++ b/solr/src/java/org/apache/solr/schema/TextField.java @@ -49,6 +49,7 @@ import java.io.StringReader; public class TextField extends FieldType { protected boolean autoGeneratePhraseQueries = true; + @Override protected void init(IndexSchema schema, Map args) { properties |= TOKENIZED; if (schema.getVersion()> 1.1f) properties &= ~OMIT_TF_POSITIONS; @@ -62,10 +63,12 @@ public class TextField extends FieldType { return autoGeneratePhraseQueries; } + @Override public SortField getSortField(SchemaField field, boolean reverse) { return getStringSort(field, reverse); } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { writer.writeStr(name, f.stringValue(), true); } diff --git a/solr/src/java/org/apache/solr/schema/TrieField.java b/solr/src/java/org/apache/solr/schema/TrieField.java index 314bdb38443..6f6d01c7023 100644 --- a/solr/src/java/org/apache/solr/schema/TrieField.java +++ b/solr/src/java/org/apache/solr/schema/TrieField.java @@ -121,6 +121,7 @@ public class TrieField extends FieldType { } } + @Override public SortField getSortField(SchemaField field, boolean top) { int flags = CachedArrayCreator.CACHE_VALUES_AND_BITS; Object missingValue = null; @@ -194,6 +195,7 @@ public class TrieField extends FieldType { } + @Override public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { byte[] arr = f.getBinaryValue(); if (arr==null) { @@ -586,6 +588,7 @@ class TrieDateFieldSource extends LongFieldSource { super(creator); } + @Override public String description() { return "date(" + field + ')'; } diff --git a/solr/src/java/org/apache/solr/search/BitDocSet.java b/solr/src/java/org/apache/solr/search/BitDocSet.java index 5bdd490a148..617986cb8f9 100644 --- a/solr/src/java/org/apache/solr/search/BitDocSet.java +++ b/solr/src/java/org/apache/solr/search/BitDocSet.java @@ -113,15 +113,18 @@ public class BitDocSet extends DocSetBase { * * @return the internal OpenBitSet that should not be modified. */ + @Override public OpenBitSet getBits() { return bits; } + @Override public void add(int doc) { bits.set(doc); size=-1; // invalidate size } + @Override public void addUnique(int doc) { bits.set(doc); size=-1; // invalidate size diff --git a/solr/src/java/org/apache/solr/search/BoostQParserPlugin.java b/solr/src/java/org/apache/solr/search/BoostQParserPlugin.java index a87ce664943..334f1eed83c 100755 --- a/solr/src/java/org/apache/solr/search/BoostQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/BoostQParserPlugin.java @@ -43,12 +43,14 @@ public class BoostQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new QParser(qstr, localParams, params, req) { QParser baseParser; ValueSource vs; String b; + @Override public Query parse() throws ParseException { b = localParams.get(BOOSTFUNC); baseParser = subQuery(localParams.get(QueryParsing.V), null); @@ -65,14 +67,17 @@ public class BoostQParserPlugin extends QParserPlugin { } + @Override public String[] getDefaultHighlightFields() { return baseParser.getDefaultHighlightFields(); } + @Override public Query getHighlightQuery() throws ParseException { return baseParser.getHighlightQuery(); } + @Override public void addDebugInfo(NamedList debugInfo) { // encapsulate base debug info in a sub-list? baseParser.addDebugInfo(debugInfo); diff --git a/solr/src/java/org/apache/solr/search/DisMaxQParser.java b/solr/src/java/org/apache/solr/search/DisMaxQParser.java index 99659743445..f8398a1a63f 100644 --- a/solr/src/java/org/apache/solr/search/DisMaxQParser.java +++ b/solr/src/java/org/apache/solr/search/DisMaxQParser.java @@ -79,6 +79,7 @@ public class DisMaxQParser extends QParser { protected QParser altQParser; + @Override public Query parse() throws ParseException { SolrParams solrParams = localParams == null ? params : new DefaultSolrParams(localParams, params); queryFields = SolrPluginUtils.parseFieldBoosts(solrParams.getParams(DisMaxParams.QF)); @@ -244,6 +245,7 @@ public class DisMaxQParser extends QParser { return parsedUserQuery == null ? altUserQuery : parsedUserQuery; } + @Override public void addDebugInfo(NamedList debugInfo) { super.addDebugInfo(debugInfo); debugInfo.add("altquerystring", altUserQuery); diff --git a/solr/src/java/org/apache/solr/search/DisMaxQParserPlugin.java b/solr/src/java/org/apache/solr/search/DisMaxQParserPlugin.java index f6ae213dfc2..ca90008579e 100755 --- a/solr/src/java/org/apache/solr/search/DisMaxQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/DisMaxQParserPlugin.java @@ -115,6 +115,7 @@ public class DisMaxQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new DisMaxQParser(qstr, localParams, params, req); } diff --git a/solr/src/java/org/apache/solr/search/DocSet.java b/solr/src/java/org/apache/solr/search/DocSet.java index e4482ac0c73..d188389ecd5 100644 --- a/solr/src/java/org/apache/solr/search/DocSet.java +++ b/solr/src/java/org/apache/solr/search/DocSet.java @@ -152,6 +152,7 @@ public interface DocSet /* extends Collection */ { abstract class DocSetBase implements DocSet { // Not implemented efficiently... for testing purposes only + @Override public boolean equals(Object obj) { if (!(obj instanceof DocSet)) return false; DocSet other = (DocSet)obj; @@ -260,6 +261,7 @@ abstract class DocSetBase implements DocSet { final int max = base + maxDoc; // one past the max doc in this segment. return new DocIdSet() { + @Override public DocIdSetIterator iterator() throws IOException { return new DocIdSetIterator() { int pos=base-1; diff --git a/solr/src/java/org/apache/solr/search/DocSetHitCollector.java b/solr/src/java/org/apache/solr/search/DocSetHitCollector.java index c0067a74380..3caafa99727 100644 --- a/solr/src/java/org/apache/solr/search/DocSetHitCollector.java +++ b/solr/src/java/org/apache/solr/search/DocSetHitCollector.java @@ -45,6 +45,7 @@ class DocSetCollector extends Collector { this.maxDoc = maxDoc; this.scratch = new int[smallSetSize]; } + @Override public void collect(int doc) throws IOException { doc += base; // optimistically collect the first docs in an array @@ -77,13 +78,16 @@ class DocSetCollector extends Collector { } } + @Override public void setScorer(Scorer scorer) throws IOException { } + @Override public void setNextReader(AtomicReaderContext context) throws IOException { this.base = context.docBase; } + @Override public boolean acceptsDocsOutOfOrder() { return false; } @@ -97,6 +101,7 @@ class DocSetDelegateCollector extends DocSetCollector { this.collector = collector; } + @Override public void collect(int doc) throws IOException { collector.collect(doc); @@ -120,6 +125,7 @@ class DocSetDelegateCollector extends DocSetCollector { pos++; } + @Override public DocSet getDocSet() { if (pos<=scratch.length) { // assumes docs were collected in sorted order! @@ -131,10 +137,12 @@ class DocSetDelegateCollector extends DocSetCollector { } } + @Override public void setScorer(Scorer scorer) throws IOException { collector.setScorer(scorer); } + @Override public void setNextReader(AtomicReaderContext context) throws IOException { collector.setNextReader(context); this.base = context.docBase; diff --git a/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java b/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java index 3e418520c42..daeab8f73ae 100755 --- a/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java @@ -55,6 +55,7 @@ public class ExtendedDismaxQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new ExtendedDismaxQParser(qstr, localParams, params, req); } @@ -96,6 +97,7 @@ class ExtendedDismaxQParser extends QParser { private QParser altQParser; + @Override public Query parse() throws ParseException { SolrParams localParams = getLocalParams(); SolrParams params = getParams(); @@ -483,6 +485,7 @@ class ExtendedDismaxQParser extends QParser { return parsedUserQuery == null ? altUserQuery : parsedUserQuery; } + @Override public void addDebugInfo(NamedList debugInfo) { super.addDebugInfo(debugInfo); debugInfo.add("altquerystring", altUserQuery); @@ -820,6 +823,7 @@ class ExtendedDismaxQParser extends QParser { analyzer.removeStopFilter = remove; } + @Override protected Query getBooleanQuery(List clauses, boolean disableCoord) throws ParseException { Query q = super.getBooleanQuery(clauses, disableCoord); if (q != null) { @@ -834,6 +838,7 @@ class ExtendedDismaxQParser extends QParser { //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// + @Override protected void addClause(List clauses, int conj, int mods, Query q) { //System.out.println("addClause:clauses="+clauses+" conj="+conj+" mods="+mods+" q="+q); super.addClause(clauses, conj, mods, q); @@ -1075,6 +1080,7 @@ final class ExtendedAnalyzer extends Analyzer { this.queryAnalyzer = parser.getReq().getSchema().getQueryAnalyzer(); } + @Override public TokenStream tokenStream(String fieldName, Reader reader) { if (!removeStopFilter) { return queryAnalyzer.tokenStream(fieldName, reader); @@ -1138,10 +1144,12 @@ final class ExtendedAnalyzer extends Analyzer { return newa.tokenStream(fieldName, reader); } + @Override public int getPositionIncrementGap(String fieldName) { return queryAnalyzer.getPositionIncrementGap(fieldName); } + @Override public TokenStream reusableTokenStream(String fieldName, Reader reader) throws IOException { if (!removeStopFilter) { return queryAnalyzer.reusableTokenStream(fieldName, reader); diff --git a/solr/src/java/org/apache/solr/search/FastLRUCache.java b/solr/src/java/org/apache/solr/search/FastLRUCache.java index a65dbbce9bb..594f37f2b56 100644 --- a/solr/src/java/org/apache/solr/search/FastLRUCache.java +++ b/solr/src/java/org/apache/solr/search/FastLRUCache.java @@ -274,6 +274,7 @@ public class FastLRUCache extends SolrCacheBase implements SolrCache { return lst; } + @Override public String toString() { return name + getStatistics().toString(); } diff --git a/solr/src/java/org/apache/solr/search/FieldQParserPlugin.java b/solr/src/java/org/apache/solr/search/FieldQParserPlugin.java index f9dded8d97b..499086f3ba5 100644 --- a/solr/src/java/org/apache/solr/search/FieldQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/FieldQParserPlugin.java @@ -38,8 +38,10 @@ public class FieldQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new QParser(qstr, localParams, params, req) { + @Override public Query parse() throws ParseException { String field = localParams.get(QueryParsing.F); String queryText = localParams.get(QueryParsing.V); diff --git a/solr/src/java/org/apache/solr/search/FunctionQParser.java b/solr/src/java/org/apache/solr/search/FunctionQParser.java index c5e710acd54..dbd2d0e061f 100755 --- a/solr/src/java/org/apache/solr/search/FunctionQParser.java +++ b/solr/src/java/org/apache/solr/search/FunctionQParser.java @@ -56,6 +56,7 @@ public class FunctionQParser extends QParser { return parseMultipleSources; } + @Override public Query parse() throws ParseException { sp = new QueryParsing.StrParser(getString()); diff --git a/solr/src/java/org/apache/solr/search/FunctionQParserPlugin.java b/solr/src/java/org/apache/solr/search/FunctionQParserPlugin.java index 164e1ccedf0..80cd846e74f 100644 --- a/solr/src/java/org/apache/solr/search/FunctionQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/FunctionQParserPlugin.java @@ -31,6 +31,7 @@ public class FunctionQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new FunctionQParser(qstr, localParams, params, req); } diff --git a/solr/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java b/solr/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java index 1a71af49610..2283e494ffd 100755 --- a/solr/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java @@ -39,11 +39,13 @@ public class FunctionRangeQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new QParser(qstr, localParams, params, req) { ValueSource vs; String funcStr; + @Override public Query parse() throws ParseException { funcStr = localParams.get(QueryParsing.V, null); Query funcQ = subQuery(funcStr, FunctionQParserPlugin.NAME).parse(); diff --git a/solr/src/java/org/apache/solr/search/LRUCache.java b/solr/src/java/org/apache/solr/search/LRUCache.java index ea222a4dc61..00f8379f7be 100644 --- a/solr/src/java/org/apache/solr/search/LRUCache.java +++ b/solr/src/java/org/apache/solr/search/LRUCache.java @@ -77,6 +77,7 @@ public class LRUCache extends SolrCacheBase implements SolrCache { description += ')'; map = new LinkedHashMap(initialSize, 0.75f, true) { + @Override protected boolean removeEldestEntry(Map.Entry eldest) { if (size() > limit) { // increment evictions regardless of state. @@ -277,6 +278,7 @@ public class LRUCache extends SolrCacheBase implements SolrCache { return lst; } + @Override public String toString() { return name + getStatistics().toString(); } diff --git a/solr/src/java/org/apache/solr/search/LuceneQParserPlugin.java b/solr/src/java/org/apache/solr/search/LuceneQParserPlugin.java index 7f8d40a5bb9..b9d61e9ad3a 100755 --- a/solr/src/java/org/apache/solr/search/LuceneQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/LuceneQParserPlugin.java @@ -41,6 +41,7 @@ public class LuceneQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new LuceneQParser(qstr, localParams, params, req); } @@ -55,6 +56,7 @@ class LuceneQParser extends QParser { } + @Override public Query parse() throws ParseException { String qstr = getString(); if (qstr == null) return null; @@ -73,6 +75,7 @@ class LuceneQParser extends QParser { } + @Override public String[] getDefaultHighlightFields() { return lparser == null ? new String[]{} : new String[]{lparser.getField()}; } @@ -87,6 +90,7 @@ class OldLuceneQParser extends LuceneQParser { super(qstr, localParams, params, req); } + @Override public Query parse() throws ParseException { // handle legacy "query;sort" syntax if (getLocalParams() == null) { diff --git a/solr/src/java/org/apache/solr/search/LuceneQueryOptimizer.java b/solr/src/java/org/apache/solr/search/LuceneQueryOptimizer.java index 65812a5bf41..c641239c8f7 100644 --- a/solr/src/java/org/apache/solr/search/LuceneQueryOptimizer.java +++ b/solr/src/java/org/apache/solr/search/LuceneQueryOptimizer.java @@ -46,6 +46,7 @@ class LuceneQueryOptimizer { */ public LuceneQueryOptimizer(final int cacheSize, float threshold) { this.cache = new LinkedHashMap(cacheSize, 0.75f, true) { + @Override protected boolean removeEldestEntry(Map.Entry eldest) { return size() > cacheSize; // limit size of cache } diff --git a/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java b/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java index b8da084eca2..4248750f744 100644 --- a/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java +++ b/solr/src/java/org/apache/solr/search/MissingStringLastComparatorSource.java @@ -47,6 +47,7 @@ public class MissingStringLastComparatorSource extends FieldComparatorSource { this.missingValueProxy=missingValueProxy; } + @Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { return new TermOrdValComparator_SML(numHits, fieldname, sortPos, reversed, missingValueProxy); } diff --git a/solr/src/java/org/apache/solr/search/MutableValue.java b/solr/src/java/org/apache/solr/search/MutableValue.java index 678430832c3..28fbbb99adc 100755 --- a/solr/src/java/org/apache/solr/search/MutableValue.java +++ b/solr/src/java/org/apache/solr/search/MutableValue.java @@ -50,6 +50,7 @@ public abstract class MutableValue implements Comparable { return (c1 == c2) && this.equalsSameType(other); } + @Override public abstract int hashCode(); @Override diff --git a/solr/src/java/org/apache/solr/search/NestedQParserPlugin.java b/solr/src/java/org/apache/solr/search/NestedQParserPlugin.java index ee51c2e172e..4032c6f850a 100755 --- a/solr/src/java/org/apache/solr/search/NestedQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/NestedQParserPlugin.java @@ -38,25 +38,30 @@ public class NestedQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new QParser(qstr, localParams, params, req) { QParser baseParser; ValueSource vs; String b; + @Override public Query parse() throws ParseException { baseParser = subQuery(localParams.get(QueryParsing.V), null); return baseParser.getQuery(); } + @Override public String[] getDefaultHighlightFields() { return baseParser.getDefaultHighlightFields(); } + @Override public Query getHighlightQuery() throws ParseException { return baseParser.getHighlightQuery(); } + @Override public void addDebugInfo(NamedList debugInfo) { // encapsulate base debug info in a sub-list? baseParser.addDebugInfo(debugInfo); diff --git a/solr/src/java/org/apache/solr/search/OldLuceneQParserPlugin.java b/solr/src/java/org/apache/solr/search/OldLuceneQParserPlugin.java index a9c33ccb9ff..1a5e4eb050a 100755 --- a/solr/src/java/org/apache/solr/search/OldLuceneQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/OldLuceneQParserPlugin.java @@ -31,6 +31,7 @@ public class OldLuceneQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new OldLuceneQParser(qstr, localParams, params, req); } diff --git a/solr/src/java/org/apache/solr/search/PrefixQParserPlugin.java b/solr/src/java/org/apache/solr/search/PrefixQParserPlugin.java index 82b33584139..8e1858cfc67 100755 --- a/solr/src/java/org/apache/solr/search/PrefixQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/PrefixQParserPlugin.java @@ -36,8 +36,10 @@ public class PrefixQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new QParser(qstr, localParams, params, req) { + @Override public Query parse() throws ParseException { return new PrefixQuery(new Term(localParams.get(QueryParsing.F), localParams.get(QueryParsing.V))); } diff --git a/solr/src/java/org/apache/solr/search/QueryParsing.java b/solr/src/java/org/apache/solr/search/QueryParsing.java index 624f627797d..1ffbdefb828 100644 --- a/solr/src/java/org/apache/solr/search/QueryParsing.java +++ b/solr/src/java/org/apache/solr/search/QueryParsing.java @@ -828,6 +828,7 @@ public class QueryParsing { return pos < end ? val.charAt(pos) : 0; } + @Override public String toString() { return "'" + val + "'" + ", pos=" + pos; } diff --git a/solr/src/java/org/apache/solr/search/QueryResultKey.java b/solr/src/java/org/apache/solr/search/QueryResultKey.java index 2f191432f41..7c1e080d7a4 100644 --- a/solr/src/java/org/apache/solr/search/QueryResultKey.java +++ b/solr/src/java/org/apache/solr/search/QueryResultKey.java @@ -56,10 +56,12 @@ public final class QueryResultKey { hc = h; } + @Override public int hashCode() { return hc; } + @Override public boolean equals(Object o) { if (o==this) return true; if (!(o instanceof QueryResultKey)) return false; diff --git a/solr/src/java/org/apache/solr/search/RawQParserPlugin.java b/solr/src/java/org/apache/solr/search/RawQParserPlugin.java index 70d4d5d8861..cbbea8978a1 100644 --- a/solr/src/java/org/apache/solr/search/RawQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/RawQParserPlugin.java @@ -40,8 +40,10 @@ public class RawQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new QParser(qstr, localParams, params, req) { + @Override public Query parse() throws ParseException { return new TermQuery(new Term(localParams.get(QueryParsing.F), localParams.get(QueryParsing.V))); } diff --git a/solr/src/java/org/apache/solr/search/SolrCacheBase.java b/solr/src/java/org/apache/solr/search/SolrCacheBase.java index 23a7267df4b..7b639b7dda9 100644 --- a/solr/src/java/org/apache/solr/search/SolrCacheBase.java +++ b/solr/src/java/org/apache/solr/search/SolrCacheBase.java @@ -55,6 +55,7 @@ public abstract class SolrCacheBase { throw new RuntimeException("Can't parse autoWarm value: " + configValue, e); } } + @Override public String toString() { return strVal; } diff --git a/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java b/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java index 653b9c93beb..357ee668d4d 100755 --- a/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java +++ b/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java @@ -41,14 +41,17 @@ public class SolrConstantScoreQuery extends ConstantScoreQuery { } /** Returns the encapsulated filter */ + @Override public Filter getFilter() { return filter; } + @Override public Query rewrite(IndexReader reader) throws IOException { return this; } + @Override public void extractTerms(Set terms) { // OK to not add any terms when used for MultiSearcher, // but may not be OK for highlighting diff --git a/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java index fbc4cedac08..06eaa74139c 100644 --- a/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java +++ b/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java @@ -184,6 +184,7 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { } + @Override public String toString() { return name; } @@ -207,6 +208,7 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { * * In particular, the underlying reader and any cache's in use are closed. */ + @Override public void close() throws IOException { if (cachingEnabled) { StringBuilder sb = new StringBuilder(); @@ -390,6 +392,7 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { /** * Retrieve the {@link Document} instance corresponding to the document id. */ + @Override public Document doc(int i) throws IOException { return doc(i, (Set)null); } @@ -398,6 +401,7 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { * This method does not currently use the Solr document cache. * * @see IndexReader#document(int, FieldSelector) */ + @Override public Document doc(int n, FieldSelector fieldSelector) throws IOException { return getIndexReader().document(n, fieldSelector); } @@ -1129,13 +1133,17 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { if (!needScores) { collector = new Collector () { + @Override public void setScorer(Scorer scorer) throws IOException { } + @Override public void collect(int doc) throws IOException { numHits[0]++; } + @Override public void setNextReader(AtomicReaderContext context) throws IOException { } + @Override public boolean acceptsDocsOutOfOrder() { return true; } @@ -1143,16 +1151,20 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { } else { collector = new Collector() { Scorer scorer; + @Override public void setScorer(Scorer scorer) throws IOException { this.scorer = scorer; } + @Override public void collect(int doc) throws IOException { numHits[0]++; float score = scorer.score(); if (score > topscore[0]) topscore[0]=score; } + @Override public void setNextReader(AtomicReaderContext context) throws IOException { } + @Override public boolean acceptsDocsOutOfOrder() { return true; } @@ -1250,16 +1262,20 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { } else { collector = setCollector = new DocSetDelegateCollector(smallSetSize, maxDoc, new Collector() { Scorer scorer; - public void setScorer(Scorer scorer) throws IOException { + @Override + public void setScorer(Scorer scorer) throws IOException { this.scorer = scorer; } - public void collect(int doc) throws IOException { + @Override + public void collect(int doc) throws IOException { float score = scorer.score(); if (score > topscore[0]) topscore[0]=score; } - public void setNextReader(AtomicReaderContext context) throws IOException { + @Override + public void setNextReader(AtomicReaderContext context) throws IOException { } - public boolean acceptsDocsOutOfOrder() { + @Override + public boolean acceptsDocsOutOfOrder() { return false; } }); diff --git a/solr/src/java/org/apache/solr/search/SortedIntDocSet.java b/solr/src/java/org/apache/solr/search/SortedIntDocSet.java index 07a62d3e041..295a794bde9 100755 --- a/solr/src/java/org/apache/solr/search/SortedIntDocSet.java +++ b/solr/src/java/org/apache/solr/search/SortedIntDocSet.java @@ -587,6 +587,7 @@ public class SortedIntDocSet extends DocSetBase { return new DocIdSet() { + @Override public DocIdSetIterator iterator() throws IOException { return new DocIdSetIterator() { int idx = startIdx; diff --git a/solr/src/java/org/apache/solr/search/SpatialBoxQParserPlugin.java b/solr/src/java/org/apache/solr/search/SpatialBoxQParserPlugin.java index 3dd099fb5ff..37065c5a2a3 100755 --- a/solr/src/java/org/apache/solr/search/SpatialBoxQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/SpatialBoxQParserPlugin.java @@ -31,6 +31,7 @@ public class SpatialBoxQParserPlugin extends SpatialFilterQParserPlugin { return new SpatialFilterQParser(qstr, localParams, params, req, true); } + @Override public void init(NamedList args) { } diff --git a/solr/src/java/org/apache/solr/search/TermQParserPlugin.java b/solr/src/java/org/apache/solr/search/TermQParserPlugin.java index 5499a71dfe0..39ce3d537fa 100644 --- a/solr/src/java/org/apache/solr/search/TermQParserPlugin.java +++ b/solr/src/java/org/apache/solr/search/TermQParserPlugin.java @@ -47,8 +47,10 @@ public class TermQParserPlugin extends QParserPlugin { public void init(NamedList args) { } + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new QParser(qstr, localParams, params, req) { + @Override public Query parse() throws ParseException { String fname = localParams.get(QueryParsing.F); FieldType ft = req.getSchema().getFieldTypeNoEx(fname); diff --git a/solr/src/java/org/apache/solr/search/ValueSourceParser.java b/solr/src/java/org/apache/solr/search/ValueSourceParser.java index b7668608f61..867ec18d067 100755 --- a/solr/src/java/org/apache/solr/search/ValueSourceParser.java +++ b/solr/src/java/org/apache/solr/search/ValueSourceParser.java @@ -81,23 +81,27 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { static { addParser("ord", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { String field = fp.parseId(); return new OrdFieldSource(field); } }); addParser("literal", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { return new LiteralValueSource(fp.getString()); } }); addParser("rord", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { String field = fp.parseId(); return new ReverseOrdFieldSource(field); } }); addParser("top", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { // top(vs) is now a no-op ValueSource source = fp.parseValueSource(); @@ -105,6 +109,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("linear", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource source = fp.parseValueSource(); float slope = fp.parseFloat(); @@ -113,6 +118,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("max", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource source = fp.parseValueSource(); float val = fp.parseFloat(); @@ -120,6 +126,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("recip", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource source = fp.parseValueSource(); float m = fp.parseFloat(); @@ -129,6 +136,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("scale", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource source = fp.parseValueSource(); float min = fp.parseFloat(); @@ -137,6 +145,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("div", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource a = fp.parseValueSource(); ValueSource b = fp.parseValueSource(); @@ -144,6 +153,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("map", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource source = fp.parseValueSource(); float min = fp.parseFloat(); @@ -155,13 +165,16 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("abs", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource source = fp.parseValueSource(); return new SimpleFloatFunction(source) { + @Override protected String name() { return "abs"; } + @Override protected float func(int doc, DocValues vals) { return Math.abs(vals.floatVal(doc)); } @@ -169,6 +182,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("sum", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { List sources = fp.parseValueSourceList(); return new SumFloatFunction(sources.toArray(new ValueSource[sources.size()])); @@ -177,6 +191,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { alias("sum","add"); addParser("product", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { List sources = fp.parseValueSourceList(); return new ProductFloatFunction(sources.toArray(new ValueSource[sources.size()])); @@ -185,14 +200,17 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { alias("product","mul"); addParser("sub", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource a = fp.parseValueSource(); ValueSource b = fp.parseValueSource(); return new DualFloatFunction(a, b) { + @Override protected String name() { return "sub"; } + @Override protected float func(int doc, DocValues aVals, DocValues bVals) { return aVals.floatVal(doc) - bVals.floatVal(doc); } @@ -200,12 +218,14 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("vector", new ValueSourceParser(){ + @Override public ValueSource parse(FunctionQParser fp) throws ParseException{ return new VectorValueSource(fp.parseValueSourceList()); } }); addParser("query", new ValueSourceParser() { // boost(query($q),rating) + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { Query q = fp.parseNestedQuery(); float defVal = 0.0f; @@ -216,6 +236,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("boost", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { Query q = fp.parseNestedQuery(); ValueSource vs = fp.parseValueSource(); @@ -224,6 +245,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("joindf", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { String f0 = fp.parseArg(); String qf = fp.parseArg(); @@ -234,6 +256,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { addParser("geodist", HaversineConstFunction.parser); addParser("hsin", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { double radius = fp.parseDouble(); @@ -274,6 +297,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("ghhsin", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { double radius = fp.parseDouble(); @@ -285,6 +309,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("geohash", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource lat = fp.parseValueSource(); @@ -294,6 +319,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { } }); addParser("strdist", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource str1 = fp.parseValueSource(); @@ -319,117 +345,140 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser(new DoubleParser("rad") { + @Override public double func(int doc, DocValues vals) { return vals.doubleVal(doc) * DistanceUtils.DEGREES_TO_RADIANS; } }); addParser(new DoubleParser("deg") { + @Override public double func(int doc, DocValues vals) { return vals.doubleVal(doc) * DistanceUtils.RADIANS_TO_DEGREES; } }); addParser(new DoubleParser("sqrt") { + @Override public double func(int doc, DocValues vals) { return Math.sqrt(vals.doubleVal(doc)); } }); addParser(new DoubleParser("cbrt") { + @Override public double func(int doc, DocValues vals) { return Math.cbrt(vals.doubleVal(doc)); } }); addParser(new DoubleParser("log") { + @Override public double func(int doc, DocValues vals) { return Math.log10(vals.doubleVal(doc)); } }); addParser(new DoubleParser("ln") { + @Override public double func(int doc, DocValues vals) { return Math.log(vals.doubleVal(doc)); } }); addParser(new DoubleParser("exp") { + @Override public double func(int doc, DocValues vals) { return Math.exp(vals.doubleVal(doc)); } }); addParser(new DoubleParser("sin") { + @Override public double func(int doc, DocValues vals) { return Math.sin(vals.doubleVal(doc)); } }); addParser(new DoubleParser("cos") { + @Override public double func(int doc, DocValues vals) { return Math.cos(vals.doubleVal(doc)); } }); addParser(new DoubleParser("tan") { + @Override public double func(int doc, DocValues vals) { return Math.tan(vals.doubleVal(doc)); } }); addParser(new DoubleParser("asin") { + @Override public double func(int doc, DocValues vals) { return Math.asin(vals.doubleVal(doc)); } }); addParser(new DoubleParser("acos") { + @Override public double func(int doc, DocValues vals) { return Math.acos(vals.doubleVal(doc)); } }); addParser(new DoubleParser("atan") { + @Override public double func(int doc, DocValues vals) { return Math.atan(vals.doubleVal(doc)); } }); addParser(new DoubleParser("sinh") { + @Override public double func(int doc, DocValues vals) { return Math.sinh(vals.doubleVal(doc)); } }); addParser(new DoubleParser("cosh") { + @Override public double func(int doc, DocValues vals) { return Math.cosh(vals.doubleVal(doc)); } }); addParser(new DoubleParser("tanh") { + @Override public double func(int doc, DocValues vals) { return Math.tanh(vals.doubleVal(doc)); } }); addParser(new DoubleParser("ceil") { + @Override public double func(int doc, DocValues vals) { return Math.ceil(vals.doubleVal(doc)); } }); addParser(new DoubleParser("floor") { + @Override public double func(int doc, DocValues vals) { return Math.floor(vals.doubleVal(doc)); } }); addParser(new DoubleParser("rint") { + @Override public double func(int doc, DocValues vals) { return Math.rint(vals.doubleVal(doc)); } }); addParser(new Double2Parser("pow") { + @Override public double func(int doc, DocValues a, DocValues b) { return Math.pow(a.doubleVal(doc), b.doubleVal(doc)); } }); addParser(new Double2Parser("hypot") { + @Override public double func(int doc, DocValues a, DocValues b) { return Math.hypot(a.doubleVal(doc), b.doubleVal(doc)); } }); addParser(new Double2Parser("atan2") { + @Override public double func(int doc, DocValues a, DocValues b) { return Math.atan2(a.doubleVal(doc), b.doubleVal(doc)); } }); addParser("sqedist", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { List sources = fp.parseValueSourceList(); MVResult mvr = getMultiValueSources(sources); @@ -439,6 +488,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("dist", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { float power = fp.parseFloat(); List sources = fp.parseValueSourceList(); @@ -450,11 +500,13 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { addParser("pi", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { return new DoubleConstValueSource(Math.PI); } }); addParser("e", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { return new DoubleConstValueSource(Math.E); } @@ -462,6 +514,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { addParser("docfreq", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { TInfo tinfo = parseTerm(fp); return new DocFreqValueSource(tinfo.field, tinfo.val, tinfo.indexedField, tinfo.indexedBytes); @@ -469,6 +522,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("idf", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { TInfo tinfo = parseTerm(fp); return new IDFValueSource(tinfo.field, tinfo.val, tinfo.indexedField, tinfo.indexedBytes); @@ -476,6 +530,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("termfreq", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { TInfo tinfo = parseTerm(fp); return new TermFreqValueSource(tinfo.field, tinfo.val, tinfo.indexedField, tinfo.indexedBytes); @@ -483,6 +538,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("tf", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { TInfo tinfo = parseTerm(fp); return new TFValueSource(tinfo.field, tinfo.val, tinfo.indexedField, tinfo.indexedBytes); @@ -490,6 +546,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("norm", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { String field = fp.parseArg(); return new NormValueSource(field); @@ -497,12 +554,14 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { }); addParser("maxdoc", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { return new MaxDocValueSource(); } }); addParser("numdocs", new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { return new NumDocsValueSource(); } @@ -599,6 +658,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin { class DateValueSourceParser extends ValueSourceParser { DateField df = new TrieDateField(); + @Override public void init(NamedList args) { } @@ -619,6 +679,7 @@ class DateValueSourceParser extends ValueSourceParser { return f.getType().getValueSource(f, fp); } + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { String first = fp.parseArg(); String second = fp.parseArg(); @@ -655,10 +716,12 @@ class DateValueSourceParser extends ValueSourceParser { // "dv" if (d1 != null && v2 != null) return new DualFloatFunction(new LongConstValueSource(ms1), v2) { + @Override protected String name() { return "ms"; } + @Override protected float func(int doc, DocValues aVals, DocValues bVals) { return ms1 - bVals.longVal(doc); } @@ -667,10 +730,12 @@ class DateValueSourceParser extends ValueSourceParser { // "vd" if (v1 != null && d2 != null) return new DualFloatFunction(v1, new LongConstValueSource(ms2)) { + @Override protected String name() { return "ms"; } + @Override protected float func(int doc, DocValues aVals, DocValues bVals) { return aVals.longVal(doc) - ms2; } @@ -679,10 +744,12 @@ class DateValueSourceParser extends ValueSourceParser { // "vv" if (v1 != null && v2 != null) return new DualFloatFunction(v1, v2) { + @Override protected String name() { return "ms"; } + @Override protected float func(int doc, DocValues aVals, DocValues bVals) { return aVals.longVal(doc) - bVals.longVal(doc); } @@ -706,42 +773,52 @@ class LongConstValueSource extends ConstNumberSource { this.fv = constant; } + @Override public String description() { return "const(" + constant + ")"; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { return new DocValues() { + @Override public float floatVal(int doc) { return fv; } + @Override public int intVal(int doc) { return (int) constant; } + @Override public long longVal(int doc) { return constant; } + @Override public double doubleVal(int doc) { return dv; } + @Override public String strVal(int doc) { return Long.toString(constant); } + @Override public String toString(int doc) { return description(); } }; } + @Override public int hashCode() { return (int) constant + (int) (constant >>> 32); } + @Override public boolean equals(Object o) { if (LongConstValueSource.class != o.getClass()) return false; LongConstValueSource other = (LongConstValueSource) o; @@ -793,6 +870,7 @@ abstract class DoubleParser extends NamedParser { public abstract double func(int doc, DocValues vals); + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { return new Function(fp.parseValueSource()); } @@ -802,6 +880,7 @@ abstract class DoubleParser extends NamedParser { super(source); } + @Override public String name() { return DoubleParser.this.name(); } @@ -810,21 +889,27 @@ abstract class DoubleParser extends NamedParser { public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues vals = source.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return (float)doubleVal(doc); } + @Override public int intVal(int doc) { return (int)doubleVal(doc); } + @Override public long longVal(int doc) { return (long)doubleVal(doc); } + @Override public double doubleVal(int doc) { return func(doc, vals); } + @Override public String strVal(int doc) { return Double.toString(doubleVal(doc)); } + @Override public String toString(int doc) { return name() + '(' + vals.toString(doc) + ')'; } @@ -841,6 +926,7 @@ abstract class Double2Parser extends NamedParser { public abstract double func(int doc, DocValues a, DocValues b); + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { return new Function(fp.parseValueSource(), fp.parseValueSource()); } @@ -858,29 +944,37 @@ abstract class Double2Parser extends NamedParser { this.b = b; } + @Override public String description() { return name() + "(" + a.description() + "," + b.description() + ")"; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues aVals = a.getValues(context, readerContext); final DocValues bVals = b.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return (float)doubleVal(doc); } + @Override public int intVal(int doc) { return (int)doubleVal(doc); } + @Override public long longVal(int doc) { return (long)doubleVal(doc); } + @Override public double doubleVal(int doc) { return func(doc, aVals, bVals); } + @Override public String strVal(int doc) { return Double.toString(doubleVal(doc)); } + @Override public String toString(int doc) { return name() + '(' + aVals.toString(doc) + ',' + bVals.toString(doc) + ')'; } @@ -891,6 +985,7 @@ abstract class Double2Parser extends NamedParser { public void createWeight(Map context, IndexSearcher searcher) throws IOException { } + @Override public int hashCode() { int h = a.hashCode(); h ^= (h << 13) | (h >>> 20); @@ -900,6 +995,7 @@ abstract class Double2Parser extends NamedParser { return h; } + @Override public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; Function other = (Function)o; diff --git a/solr/src/java/org/apache/solr/search/function/BoostedQuery.java b/solr/src/java/org/apache/solr/search/function/BoostedQuery.java index 1283c600b60..c065aef4318 100755 --- a/solr/src/java/org/apache/solr/search/function/BoostedQuery.java +++ b/solr/src/java/org/apache/solr/search/function/BoostedQuery.java @@ -41,6 +41,7 @@ public class BoostedQuery extends Query { public Query getQuery() { return q; } public ValueSource getValueSource() { return boostVal; } + @Override public Query rewrite(IndexReader reader) throws IOException { Query newQ = q.rewrite(reader); if (newQ == q) return this; @@ -49,10 +50,12 @@ public class BoostedQuery extends Query { return bq; } + @Override public void extractTerms(Set terms) { q.extractTerms(terms); } + @Override public Weight createWeight(IndexSearcher searcher) throws IOException { return new BoostedQuery.BoostedWeight(searcher); } @@ -69,10 +72,12 @@ public class BoostedQuery extends Query { boostVal.createWeight(fcontext,searcher); } + @Override public Query getQuery() { return BoostedQuery.this; } + @Override public float getValue() { return getBoost(); } @@ -173,6 +178,7 @@ public class BoostedQuery extends Query { } + @Override public String toString(String field) { StringBuilder sb = new StringBuilder(); sb.append("boost(").append(q.toString(field)).append(',').append(boostVal).append(')'); @@ -180,6 +186,7 @@ public class BoostedQuery extends Query { return sb.toString(); } + @Override public boolean equals(Object o) { if (getClass() != o.getClass()) return false; BoostedQuery other = (BoostedQuery)o; @@ -188,6 +195,7 @@ public class BoostedQuery extends Query { && this.boostVal.equals(other.boostVal); } + @Override public int hashCode() { int h = q.hashCode(); h ^= (h << 17) | (h >>> 16); diff --git a/solr/src/java/org/apache/solr/search/function/ByteFieldSource.java b/solr/src/java/org/apache/solr/search/function/ByteFieldSource.java index 2dd5bb77ddf..36cdddeb716 100644 --- a/solr/src/java/org/apache/solr/search/function/ByteFieldSource.java +++ b/solr/src/java/org/apache/solr/search/function/ByteFieldSource.java @@ -37,10 +37,12 @@ public class ByteFieldSource extends NumericFieldCacheSource { super(creator); } + @Override public String description() { return "byte(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final ByteValues vals = cache.getBytes(readerContext.reader, field, creator); final byte[] arr = vals.values; @@ -56,26 +58,32 @@ public class ByteFieldSource extends NumericFieldCacheSource { return (short) arr[doc]; } + @Override public float floatVal(int doc) { return (float) arr[doc]; } + @Override public int intVal(int doc) { return (int) arr[doc]; } + @Override public long longVal(int doc) { return (long) arr[doc]; } + @Override public double doubleVal(int doc) { return (double) arr[doc]; } + @Override public String strVal(int doc) { return Byte.toString(arr[doc]); } + @Override public String toString(int doc) { return description() + '=' + byteVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/ConstValueSource.java b/solr/src/java/org/apache/solr/search/function/ConstValueSource.java index 846591dafb2..d829fc9ddd8 100755 --- a/solr/src/java/org/apache/solr/search/function/ConstValueSource.java +++ b/solr/src/java/org/apache/solr/search/function/ConstValueSource.java @@ -34,37 +34,47 @@ public class ConstValueSource extends ConstNumberSource { this.dv = constant; } + @Override public String description() { return "const(" + constant + ")"; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { return new DocValues() { + @Override public float floatVal(int doc) { return constant; } + @Override public int intVal(int doc) { return (int)constant; } + @Override public long longVal(int doc) { return (long)constant; } + @Override public double doubleVal(int doc) { return dv; } + @Override public String strVal(int doc) { return Float.toString(constant); } + @Override public String toString(int doc) { return description(); } }; } + @Override public int hashCode() { return Float.floatToIntBits(constant) * 31; } + @Override public boolean equals(Object o) { if (!(o instanceof ConstValueSource)) return false; ConstValueSource other = (ConstValueSource)o; diff --git a/solr/src/java/org/apache/solr/search/function/DivFloatFunction.java b/solr/src/java/org/apache/solr/search/function/DivFloatFunction.java index a66c7c61e1d..ad072b57fd8 100755 --- a/solr/src/java/org/apache/solr/search/function/DivFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/DivFloatFunction.java @@ -28,10 +28,12 @@ public class DivFloatFunction extends DualFloatFunction { super(a,b); } + @Override protected String name() { return "div"; } + @Override protected float func(int doc, DocValues aVals, DocValues bVals) { return aVals.floatVal(doc) / bVals.floatVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/DocFreqValueSource.java b/solr/src/java/org/apache/solr/search/function/DocFreqValueSource.java index 641f2a9aaa8..fff0219ffc0 100755 --- a/solr/src/java/org/apache/solr/search/function/DocFreqValueSource.java +++ b/solr/src/java/org/apache/solr/search/function/DocFreqValueSource.java @@ -45,21 +45,27 @@ class ConstIntDocValues extends DocValues { this.parent = parent; } + @Override public float floatVal(int doc) { return fval; } + @Override public int intVal(int doc) { return ival; } + @Override public long longVal(int doc) { return lval; } + @Override public double doubleVal(int doc) { return dval; } + @Override public String strVal(int doc) { return sval; } + @Override public String toString(int doc) { return parent.description() + '=' + sval; } @@ -82,21 +88,27 @@ class ConstDoubleDocValues extends DocValues { this.parent = parent; } + @Override public float floatVal(int doc) { return fval; } + @Override public int intVal(int doc) { return ival; } + @Override public long longVal(int doc) { return lval; } + @Override public double doubleVal(int doc) { return dval; } + @Override public String strVal(int doc) { return sval; } + @Override public String toString(int doc) { return parent.description() + '=' + sval; } @@ -250,10 +262,12 @@ public class DocFreqValueSource extends ValueSource { context.put("searcher",searcher); } + @Override public int hashCode() { return getClass().hashCode() + indexedField.hashCode()*29 + indexedBytes.hashCode(); } + @Override public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; DocFreqValueSource other = (DocFreqValueSource)o; diff --git a/solr/src/java/org/apache/solr/search/function/DoubleConstValueSource.java b/solr/src/java/org/apache/solr/search/function/DoubleConstValueSource.java index 9df2d685f2d..7c8632dacca 100755 --- a/solr/src/java/org/apache/solr/search/function/DoubleConstValueSource.java +++ b/solr/src/java/org/apache/solr/search/function/DoubleConstValueSource.java @@ -33,43 +33,53 @@ public class DoubleConstValueSource extends ConstNumberSource { this.lv = (long)constant; } + @Override public String description() { return "const(" + constant + ")"; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { return new DocValues() { + @Override public float floatVal(int doc) { return fv; } + @Override public int intVal(int doc) { return (int) lv; } + @Override public long longVal(int doc) { return lv; } + @Override public double doubleVal(int doc) { return constant; } + @Override public String strVal(int doc) { return Double.toString(constant); } + @Override public String toString(int doc) { return description(); } }; } + @Override public int hashCode() { long bits = Double.doubleToRawLongBits(constant); return (int)(bits ^ (bits >>> 32)); } + @Override public boolean equals(Object o) { if (!(o instanceof DoubleConstValueSource)) return false; DoubleConstValueSource other = (DoubleConstValueSource) o; diff --git a/solr/src/java/org/apache/solr/search/function/DoubleFieldSource.java b/solr/src/java/org/apache/solr/search/function/DoubleFieldSource.java index 02017aee0a6..a7bfe94dfd5 100644 --- a/solr/src/java/org/apache/solr/search/function/DoubleFieldSource.java +++ b/solr/src/java/org/apache/solr/search/function/DoubleFieldSource.java @@ -42,36 +42,44 @@ public class DoubleFieldSource extends NumericFieldCacheSource { super(creator); } + @Override public String description() { return "double(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DoubleValues vals = cache.getDoubles(readerContext.reader, field, creator); final double[] arr = vals.values; final Bits valid = vals.valid; return new DocValues() { + @Override public float floatVal(int doc) { return (float) arr[doc]; } + @Override public int intVal(int doc) { return (int) arr[doc]; } + @Override public long longVal(int doc) { return (long) arr[doc]; } + @Override public double doubleVal(int doc) { return arr[doc]; } + @Override public String strVal(int doc) { return Double.toString(arr[doc]); } + @Override public String toString(int doc) { return description() + '=' + doubleVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/DualFloatFunction.java b/solr/src/java/org/apache/solr/search/function/DualFloatFunction.java index 9eaec662091..b7a6d689960 100755 --- a/solr/src/java/org/apache/solr/search/function/DualFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/DualFloatFunction.java @@ -39,29 +39,37 @@ public abstract class DualFloatFunction extends ValueSource { protected abstract String name(); protected abstract float func(int doc, DocValues aVals, DocValues bVals); + @Override public String description() { return name() + "(" + a.description() + "," + b.description() + ")"; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues aVals = a.getValues(context, readerContext); final DocValues bVals = b.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return func(doc, aVals, bVals); } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return name() + '(' + aVals.toString(doc) + ',' + bVals.toString(doc) + ')'; } @@ -74,6 +82,7 @@ public abstract class DualFloatFunction extends ValueSource { b.createWeight(context,searcher); } + @Override public int hashCode() { int h = a.hashCode(); h ^= (h << 13) | (h >>> 20); @@ -83,6 +92,7 @@ public abstract class DualFloatFunction extends ValueSource { return h; } + @Override public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; DualFloatFunction other = (DualFloatFunction)o; diff --git a/solr/src/java/org/apache/solr/search/function/FieldCacheSource.java b/solr/src/java/org/apache/solr/search/function/FieldCacheSource.java index f8f3531b73a..df80cecae03 100644 --- a/solr/src/java/org/apache/solr/search/function/FieldCacheSource.java +++ b/solr/src/java/org/apache/solr/search/function/FieldCacheSource.java @@ -37,10 +37,12 @@ public abstract class FieldCacheSource extends ValueSource { return cache; } + @Override public String description() { return field; } + @Override public boolean equals(Object o) { if (!(o instanceof FieldCacheSource)) return false; FieldCacheSource other = (FieldCacheSource)o; @@ -48,6 +50,7 @@ public abstract class FieldCacheSource extends ValueSource { && this.cache == other.cache; } + @Override public int hashCode() { return cache.hashCode() + field.hashCode(); }; diff --git a/solr/src/java/org/apache/solr/search/function/FileFloatSource.java b/solr/src/java/org/apache/solr/search/function/FileFloatSource.java index 817062c770d..7294ff8c744 100755 --- a/solr/src/java/org/apache/solr/search/function/FileFloatSource.java +++ b/solr/src/java/org/apache/solr/search/function/FileFloatSource.java @@ -53,10 +53,12 @@ public class FileFloatSource extends ValueSource { this.dataDir = parser.getReq().getCore().getDataDir(); } + @Override public String description() { return "float(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { int offset = 0; ReaderContext topLevelContext = ReaderUtil.getTopLevelContext(readerContext); @@ -64,32 +66,39 @@ public class FileFloatSource extends ValueSource { final float[] arr = getCachedFloats(topLevelContext.reader); return new DocValues() { + @Override public float floatVal(int doc) { return arr[doc + off]; } + @Override public int intVal(int doc) { return (int)arr[doc + off]; } + @Override public long longVal(int doc) { return (long)arr[doc + off]; } + @Override public double doubleVal(int doc) { return (double)arr[doc + off]; } + @Override public String strVal(int doc) { return Float.toString(arr[doc + off]); } + @Override public String toString(int doc) { return description() + '=' + floatVal(doc); } }; } + @Override public boolean equals(Object o) { if (o.getClass() != FileFloatSource.class) return false; FileFloatSource other = (FileFloatSource)o; @@ -99,10 +108,12 @@ public class FileFloatSource extends ValueSource { && this.dataDir.equals(other.dataDir); } + @Override public int hashCode() { return FileFloatSource.class.hashCode() + field.getName().hashCode(); }; + @Override public String toString() { return "FileFloatSource(field="+field.getName()+",keyField="+keyField.getName() + ",defVal="+defVal+",dataDir="+dataDir+")"; @@ -114,6 +125,7 @@ public class FileFloatSource extends ValueSource { } static Cache floatCache = new Cache() { + @Override protected Object createValue(IndexReader reader, Object key) { return getFloats(((Entry)key).ffs, reader); } @@ -173,12 +185,14 @@ public class FileFloatSource extends ValueSource { this.ffs = ffs; } + @Override public boolean equals(Object o) { if (!(o instanceof Entry)) return false; Entry other = (Entry)o; return ffs.equals(other.ffs); } + @Override public int hashCode() { return ffs.hashCode(); } diff --git a/solr/src/java/org/apache/solr/search/function/FloatFieldSource.java b/solr/src/java/org/apache/solr/search/function/FloatFieldSource.java index a985b49fe7c..ed53627f1a3 100644 --- a/solr/src/java/org/apache/solr/search/function/FloatFieldSource.java +++ b/solr/src/java/org/apache/solr/search/function/FloatFieldSource.java @@ -41,36 +41,44 @@ public class FloatFieldSource extends NumericFieldCacheSource { super(creator); } + @Override public String description() { return "float(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final FloatValues vals = cache.getFloats(readerContext.reader, field, creator); final float[] arr = vals.values; final Bits valid = vals.valid; return new DocValues() { + @Override public float floatVal(int doc) { return arr[doc]; } + @Override public int intVal(int doc) { return (int)arr[doc]; } + @Override public long longVal(int doc) { return (long)arr[doc]; } + @Override public double doubleVal(int doc) { return (double)arr[doc]; } + @Override public String strVal(int doc) { return Float.toString(arr[doc]); } + @Override public String toString(int doc) { return description() + '=' + floatVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/IntFieldSource.java b/solr/src/java/org/apache/solr/search/function/IntFieldSource.java index 0cee5e769cf..7da8ffb573c 100644 --- a/solr/src/java/org/apache/solr/search/function/IntFieldSource.java +++ b/solr/src/java/org/apache/solr/search/function/IntFieldSource.java @@ -41,11 +41,13 @@ public class IntFieldSource extends NumericFieldCacheSource { super(creator); } + @Override public String description() { return "int(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final IntValues vals = cache.getInts(readerContext.reader, field, creator); final int[] arr = vals.values; @@ -54,26 +56,32 @@ public class IntFieldSource extends NumericFieldCacheSource { return new DocValues() { final MutableValueInt val = new MutableValueInt(); + @Override public float floatVal(int doc) { return (float)arr[doc]; } + @Override public int intVal(int doc) { return arr[doc]; } + @Override public long longVal(int doc) { return (long)arr[doc]; } + @Override public double doubleVal(int doc) { return (double)arr[doc]; } + @Override public String strVal(int doc) { return Float.toString(arr[doc]); } + @Override public String toString(int doc) { return description() + '=' + intVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java b/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java index dae45789fca..a7d5f1f6bb0 100644 --- a/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java +++ b/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java @@ -43,10 +43,12 @@ public class JoinDocFreqValueSource extends FieldCacheSource { this.qfield = qfield; } + @Override public String description() { return NAME + "(" + field +":("+qfield+"))"; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocTerms terms = cache.getTerms(readerContext.reader, field, true ); @@ -55,6 +57,7 @@ public class JoinDocFreqValueSource extends FieldCacheSource { return new DocValues() { BytesRef ref = new BytesRef(); + @Override public int intVal(int doc) { try { @@ -68,28 +71,34 @@ public class JoinDocFreqValueSource extends FieldCacheSource { } } + @Override public float floatVal(int doc) { return (float)intVal(doc); } + @Override public long longVal(int doc) { return (long)intVal(doc); } + @Override public double doubleVal(int doc) { return (double)intVal(doc); } + @Override public String strVal(int doc) { return intVal(doc) + ""; } + @Override public String toString(int doc) { return description() + '=' + intVal(doc); } }; } + @Override public boolean equals(Object o) { if (o.getClass() != JoinDocFreqValueSource.class) return false; JoinDocFreqValueSource other = (JoinDocFreqValueSource)o; @@ -97,6 +106,7 @@ public class JoinDocFreqValueSource extends FieldCacheSource { return super.equals(other); } + @Override public int hashCode() { return qfield.hashCode() + super.hashCode(); }; diff --git a/solr/src/java/org/apache/solr/search/function/LinearFloatFunction.java b/solr/src/java/org/apache/solr/search/function/LinearFloatFunction.java index 7ceb07e2bf9..4fb7a5b5609 100644 --- a/solr/src/java/org/apache/solr/search/function/LinearFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/LinearFloatFunction.java @@ -42,28 +42,36 @@ public class LinearFloatFunction extends ValueSource { this.intercept = intercept; } + @Override public String description() { return slope + "*float(" + source.description() + ")+" + intercept; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues vals = source.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return vals.floatVal(doc) * slope + intercept; } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return (double)floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return slope + "*float(" + vals.toString(doc) + ")+" + intercept; } @@ -75,6 +83,7 @@ public class LinearFloatFunction extends ValueSource { source.createWeight(context, searcher); } + @Override public int hashCode() { int h = Float.floatToIntBits(slope); h = (h >>> 2) | (h << 30); @@ -83,6 +92,7 @@ public class LinearFloatFunction extends ValueSource { return h + source.hashCode(); } + @Override public boolean equals(Object o) { if (LinearFloatFunction.class != o.getClass()) return false; LinearFloatFunction other = (LinearFloatFunction)o; diff --git a/solr/src/java/org/apache/solr/search/function/LongFieldSource.java b/solr/src/java/org/apache/solr/search/function/LongFieldSource.java index dfa92b7b2c1..ffc58a6cdd1 100644 --- a/solr/src/java/org/apache/solr/search/function/LongFieldSource.java +++ b/solr/src/java/org/apache/solr/search/function/LongFieldSource.java @@ -43,6 +43,7 @@ public class LongFieldSource extends NumericFieldCacheSource { super(creator); } + @Override public String description() { return "long(" + field + ')'; } @@ -51,32 +52,39 @@ public class LongFieldSource extends NumericFieldCacheSource { return Long.parseLong(extVal); } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final LongValues vals = cache.getLongs(readerContext.reader, field, creator); final long[] arr = vals.values; final Bits valid = vals.valid; return new DocValues() { + @Override public float floatVal(int doc) { return (float) arr[doc]; } + @Override public int intVal(int doc) { return (int) arr[doc]; } + @Override public long longVal(int doc) { return arr[doc]; } + @Override public double doubleVal(int doc) { return arr[doc]; } + @Override public String strVal(int doc) { return Long.toString(arr[doc]); } + @Override public String toString(int doc) { return description() + '=' + longVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/MaxFloatFunction.java b/solr/src/java/org/apache/solr/search/function/MaxFloatFunction.java index 37af4d94809..f7678f3b53a 100644 --- a/solr/src/java/org/apache/solr/search/function/MaxFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/MaxFloatFunction.java @@ -41,29 +41,37 @@ public class MaxFloatFunction extends ValueSource { this.fval = fval; } + @Override public String description() { return "max(" + source.description() + "," + fval + ")"; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues vals = source.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { float v = vals.floatVal(doc); return v < fval ? fval : v; } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return (double)floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return "max(" + vals.toString(doc) + "," + fval + ")"; } @@ -75,12 +83,14 @@ public class MaxFloatFunction extends ValueSource { source.createWeight(context, searcher); } + @Override public int hashCode() { int h = Float.floatToIntBits(fval); h = (h >>> 2) | (h << 30); return h + source.hashCode(); } + @Override public boolean equals(Object o) { if (MaxFloatFunction.class != o.getClass()) return false; MaxFloatFunction other = (MaxFloatFunction)o; diff --git a/solr/src/java/org/apache/solr/search/function/MultiFloatFunction.java b/solr/src/java/org/apache/solr/search/function/MultiFloatFunction.java index f66bdfe7502..4e28799800e 100644 --- a/solr/src/java/org/apache/solr/search/function/MultiFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/MultiFloatFunction.java @@ -38,6 +38,7 @@ public abstract class MultiFloatFunction extends ValueSource { abstract protected String name(); abstract protected float func(int doc, DocValues[] valsArr); + @Override public String description() { StringBuilder sb = new StringBuilder(); sb.append(name()).append('('); @@ -54,6 +55,7 @@ public abstract class MultiFloatFunction extends ValueSource { return sb.toString(); } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues[] valsArr = new DocValues[sources.length]; for (int i=0; i extends Fie this.creator = creator; } + @Override public final boolean equals(Object o) { if (o.getClass() != this.getClass()) return false; NumericFieldCacheSource other = (NumericFieldCacheSource) o; @@ -40,6 +41,7 @@ public abstract class NumericFieldCacheSource extends Fie this.creator.getClass() == other.creator.getClass(); } + @Override public final int hashCode() { int h = creator == null ? this.getClass().hashCode() : creator.getClass().hashCode(); h += super.hashCode(); diff --git a/solr/src/java/org/apache/solr/search/function/OrdFieldSource.java b/solr/src/java/org/apache/solr/search/function/OrdFieldSource.java index 7c249571c48..09435accaa2 100644 --- a/solr/src/java/org/apache/solr/search/function/OrdFieldSource.java +++ b/solr/src/java/org/apache/solr/search/function/OrdFieldSource.java @@ -52,11 +52,13 @@ public class OrdFieldSource extends ValueSource { this.field = field; } + @Override public String description() { return "ord(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final int off = readerContext.docBase; final IndexReader topReader = ReaderUtil.getTopLevelContext(readerContext).reader; @@ -66,35 +68,43 @@ public class OrdFieldSource extends ValueSource { return readableValue; } + @Override public float floatVal(int doc) { return (float)sindex.getOrd(doc+off); } + @Override public int intVal(int doc) { return sindex.getOrd(doc+off); } + @Override public long longVal(int doc) { return (long)sindex.getOrd(doc+off); } + @Override public double doubleVal(int doc) { return (double)sindex.getOrd(doc+off); } + @Override public int ordVal(int doc) { return sindex.getOrd(doc+off); } + @Override public int numOrd() { return sindex.numOrd(); } + @Override public String strVal(int doc) { // the string value of the ordinal, not the string itself return Integer.toString(sindex.getOrd(doc+off)); } + @Override public String toString(int doc) { return description() + '=' + intVal(doc); } @@ -119,11 +129,13 @@ public class OrdFieldSource extends ValueSource { }; } + @Override public boolean equals(Object o) { return o.getClass() == OrdFieldSource.class && this.field.equals(((OrdFieldSource)o).field); } private static final int hcode = OrdFieldSource.class.hashCode(); + @Override public int hashCode() { return hcode + field.hashCode(); }; diff --git a/solr/src/java/org/apache/solr/search/function/PowFloatFunction.java b/solr/src/java/org/apache/solr/search/function/PowFloatFunction.java index c085e11b641..f5f7f68d930 100755 --- a/solr/src/java/org/apache/solr/search/function/PowFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/PowFloatFunction.java @@ -28,10 +28,12 @@ public class PowFloatFunction extends DualFloatFunction { super(a,b); } + @Override protected String name() { return "pow"; } + @Override protected float func(int doc, DocValues aVals, DocValues bVals) { return (float)Math.pow(aVals.floatVal(doc), bVals.floatVal(doc)); } diff --git a/solr/src/java/org/apache/solr/search/function/ProductFloatFunction.java b/solr/src/java/org/apache/solr/search/function/ProductFloatFunction.java index 99f668e7e97..fa74cfc50ef 100755 --- a/solr/src/java/org/apache/solr/search/function/ProductFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/ProductFloatFunction.java @@ -25,10 +25,12 @@ public class ProductFloatFunction extends MultiFloatFunction { super(sources); } + @Override protected String name() { return "product"; } + @Override protected float func(int doc, DocValues[] valsArr) { float val = 1.0f; for (DocValues vals : valsArr) { diff --git a/solr/src/java/org/apache/solr/search/function/QueryValueSource.java b/solr/src/java/org/apache/solr/search/function/QueryValueSource.java index 8c52d01f029..b7d13efb351 100755 --- a/solr/src/java/org/apache/solr/search/function/QueryValueSource.java +++ b/solr/src/java/org/apache/solr/search/function/QueryValueSource.java @@ -42,6 +42,7 @@ public class QueryValueSource extends ValueSource { public Query getQuery() { return q; } public float getDefaultValue() { return defVal; } + @Override public String description() { return "query(" + q + ",def=" + defVal + ")"; } @@ -51,10 +52,12 @@ public class QueryValueSource extends ValueSource { return new QueryDocValues(readerContext, q, defVal, fcontext); } + @Override public int hashCode() { return q.hashCode() * 29; } + @Override public boolean equals(Object o) { if (QueryValueSource.class != o.getClass()) return false; QueryValueSource other = (QueryValueSource)o; @@ -109,6 +112,7 @@ class QueryDocValues extends DocValues { weight = w; } + @Override public float floatVal(int doc) { try { if (doc < lastDocRequested) { @@ -135,18 +139,23 @@ class QueryDocValues extends DocValues { } } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return (double)floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return "query(" + q + ",def=" + defVal + ")=" + floatVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/RangeMapFloatFunction.java b/solr/src/java/org/apache/solr/search/function/RangeMapFloatFunction.java index 83bedeab8af..1812f0cfccd 100755 --- a/solr/src/java/org/apache/solr/search/function/RangeMapFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/RangeMapFloatFunction.java @@ -46,29 +46,37 @@ public class RangeMapFloatFunction extends ValueSource { this.defaultVal = def; } + @Override public String description() { return "map(" + source.description() + "," + min + "," + max + "," + target + ")"; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues vals = source.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { float val = vals.floatVal(doc); return (val>=min && val<=max) ? target : (defaultVal == null ? val : defaultVal); } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return (double)floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return "map(" + vals.toString(doc) + ",min=" + min + ",max=" + max + ",target=" + target + ")"; } @@ -80,6 +88,7 @@ public class RangeMapFloatFunction extends ValueSource { source.createWeight(context, searcher); } + @Override public int hashCode() { int h = source.hashCode(); h ^= (h << 10) | (h >>> 23); @@ -93,6 +102,7 @@ public class RangeMapFloatFunction extends ValueSource { return h; } + @Override public boolean equals(Object o) { if (RangeMapFloatFunction.class != o.getClass()) return false; RangeMapFloatFunction other = (RangeMapFloatFunction)o; diff --git a/solr/src/java/org/apache/solr/search/function/ReciprocalFloatFunction.java b/solr/src/java/org/apache/solr/search/function/ReciprocalFloatFunction.java index 99627759db8..3b672a2245f 100644 --- a/solr/src/java/org/apache/solr/search/function/ReciprocalFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/ReciprocalFloatFunction.java @@ -57,24 +57,31 @@ public class ReciprocalFloatFunction extends ValueSource { this.b=b; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues vals = source.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return a/(m*vals.floatVal(doc) + b); } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return (double)floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return Float.toString(a) + "/(" + m + "*float(" + vals.toString(doc) + ')' @@ -88,18 +95,21 @@ public class ReciprocalFloatFunction extends ValueSource { source.createWeight(context, searcher); } + @Override public String description() { return Float.toString(a) + "/(" + m + "*float(" + source.description() + ")" + "+" + b + ')'; } + @Override public int hashCode() { int h = Float.floatToIntBits(a) + Float.floatToIntBits(m); h ^= (h << 13) | (h >>> 20); return h + (Float.floatToIntBits(b)) + source.hashCode(); } + @Override public boolean equals(Object o) { if (ReciprocalFloatFunction.class != o.getClass()) return false; ReciprocalFloatFunction other = (ReciprocalFloatFunction)o; diff --git a/solr/src/java/org/apache/solr/search/function/ReverseOrdFieldSource.java b/solr/src/java/org/apache/solr/search/function/ReverseOrdFieldSource.java index 639bdbba72b..e08e6a819f5 100644 --- a/solr/src/java/org/apache/solr/search/function/ReverseOrdFieldSource.java +++ b/solr/src/java/org/apache/solr/search/function/ReverseOrdFieldSource.java @@ -53,10 +53,12 @@ public class ReverseOrdFieldSource extends ValueSource { this.field = field; } + @Override public String description() { return "rord("+field+')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final IndexReader topReader = ReaderUtil.getTopLevelContext(readerContext).reader; final int off = readerContext.docBase; @@ -65,41 +67,50 @@ public class ReverseOrdFieldSource extends ValueSource { final int end = sindex.numOrd(); return new DocValues() { + @Override public float floatVal(int doc) { return (float)(end - sindex.getOrd(doc+off)); } + @Override public int intVal(int doc) { return (end - sindex.getOrd(doc+off)); } + @Override public long longVal(int doc) { return (long)(end - sindex.getOrd(doc+off)); } + @Override public int ordVal(int doc) { return (end - sindex.getOrd(doc+off)); } + @Override public int numOrd() { return end; } + @Override public double doubleVal(int doc) { return (double)(end - sindex.getOrd(doc+off)); } + @Override public String strVal(int doc) { // the string value of the ordinal, not the string itself return Integer.toString((end - sindex.getOrd(doc+off))); } + @Override public String toString(int doc) { return description() + '=' + strVal(doc); } }; } + @Override public boolean equals(Object o) { if (o.getClass() != ReverseOrdFieldSource.class) return false; ReverseOrdFieldSource other = (ReverseOrdFieldSource)o; @@ -107,6 +118,7 @@ public class ReverseOrdFieldSource extends ValueSource { } private static final int hcode = ReverseOrdFieldSource.class.hashCode(); + @Override public int hashCode() { return hcode + field.hashCode(); }; diff --git a/solr/src/java/org/apache/solr/search/function/ScaleFloatFunction.java b/solr/src/java/org/apache/solr/search/function/ScaleFloatFunction.java index 40e3192325c..d277adfb327 100755 --- a/solr/src/java/org/apache/solr/search/function/ScaleFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/ScaleFloatFunction.java @@ -46,6 +46,7 @@ public class ScaleFloatFunction extends ValueSource { this.max = max; } + @Override public String description() { return "scale(" + source.description() + "," + min + "," + max + ")"; } @@ -93,6 +94,7 @@ public class ScaleFloatFunction extends ValueSource { return scaleInfo; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { ScaleInfo scaleInfo = (ScaleInfo)context.get(source); @@ -107,21 +109,27 @@ public class ScaleFloatFunction extends ValueSource { final DocValues vals = source.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return (vals.floatVal(doc) - minSource) * scale + min; } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return (double)floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return "scale(" + vals.toString(doc) + ",toMin=" + min + ",toMax=" + max + ",fromMin=" + minSource @@ -136,6 +144,7 @@ public class ScaleFloatFunction extends ValueSource { source.createWeight(context, searcher); } + @Override public int hashCode() { int h = Float.floatToIntBits(min); h = h*29; @@ -145,6 +154,7 @@ public class ScaleFloatFunction extends ValueSource { return h; } + @Override public boolean equals(Object o) { if (ScaleFloatFunction.class != o.getClass()) return false; ScaleFloatFunction other = (ScaleFloatFunction)o; diff --git a/solr/src/java/org/apache/solr/search/function/ShortFieldSource.java b/solr/src/java/org/apache/solr/search/function/ShortFieldSource.java index fb4e41b5562..701339c0163 100644 --- a/solr/src/java/org/apache/solr/search/function/ShortFieldSource.java +++ b/solr/src/java/org/apache/solr/search/function/ShortFieldSource.java @@ -35,10 +35,12 @@ public class ShortFieldSource extends NumericFieldCacheSource { } + @Override public String description() { return "short(" + field + ')'; } + @Override public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final ShortValues vals = cache.getShorts(readerContext.reader, field, creator); final short[] arr = vals.values; @@ -54,26 +56,32 @@ public class ShortFieldSource extends NumericFieldCacheSource { return arr[doc]; } + @Override public float floatVal(int doc) { return (float) arr[doc]; } + @Override public int intVal(int doc) { return (int) arr[doc]; } + @Override public long longVal(int doc) { return (long) arr[doc]; } + @Override public double doubleVal(int doc) { return (double) arr[doc]; } + @Override public String strVal(int doc) { return Short.toString(arr[doc]); } + @Override public String toString(int doc) { return description() + '=' + shortVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/SimpleFloatFunction.java b/solr/src/java/org/apache/solr/search/function/SimpleFloatFunction.java index e4079ac2dbd..355e161c4ad 100755 --- a/solr/src/java/org/apache/solr/search/function/SimpleFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/SimpleFloatFunction.java @@ -35,21 +35,27 @@ import java.util.Map; public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { final DocValues vals = source.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return func(doc, vals); } + @Override public int intVal(int doc) { return (int)floatVal(doc); } + @Override public long longVal(int doc) { return (long)floatVal(doc); } + @Override public double doubleVal(int doc) { return (double)floatVal(doc); } + @Override public String strVal(int doc) { return Float.toString(floatVal(doc)); } + @Override public String toString(int doc) { return name() + '(' + vals.toString(doc) + ')'; } diff --git a/solr/src/java/org/apache/solr/search/function/SingleFunction.java b/solr/src/java/org/apache/solr/search/function/SingleFunction.java index e040dc5b250..05bba175858 100755 --- a/solr/src/java/org/apache/solr/search/function/SingleFunction.java +++ b/solr/src/java/org/apache/solr/search/function/SingleFunction.java @@ -33,14 +33,17 @@ import java.util.Map; protected abstract String name(); + @Override public String description() { return name() + '(' + source.description() + ')'; } + @Override public int hashCode() { return source.hashCode() + name().hashCode(); } + @Override public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; SingleFunction other = (SingleFunction)o; diff --git a/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java b/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java index f533a7319fc..55891ca36fd 100755 --- a/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java +++ b/solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java @@ -89,6 +89,7 @@ public abstract class StringIndexDocValues extends DocValues { }; } + @Override public String toString(int doc) { return vs.description() + '=' + strVal(doc); } diff --git a/solr/src/java/org/apache/solr/search/function/SumFloatFunction.java b/solr/src/java/org/apache/solr/search/function/SumFloatFunction.java index a0a6c17a68a..bd838c845ef 100755 --- a/solr/src/java/org/apache/solr/search/function/SumFloatFunction.java +++ b/solr/src/java/org/apache/solr/search/function/SumFloatFunction.java @@ -30,6 +30,7 @@ public class SumFloatFunction extends MultiFloatFunction { return "sum"; } + @Override protected float func(int doc, DocValues[] valsArr) { float val = 0.0f; for (DocValues vals : valsArr) { diff --git a/solr/src/java/org/apache/solr/search/function/ValueSource.java b/solr/src/java/org/apache/solr/search/function/ValueSource.java index 7674b803089..ffcdac97a7d 100644 --- a/solr/src/java/org/apache/solr/search/function/ValueSource.java +++ b/solr/src/java/org/apache/solr/search/function/ValueSource.java @@ -49,8 +49,10 @@ public abstract class ValueSource implements Serializable { */ public abstract DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException; + @Override public abstract boolean equals(Object o); + @Override public abstract int hashCode(); /** @@ -58,6 +60,7 @@ public abstract class ValueSource implements Serializable { */ public abstract String description(); + @Override public String toString() { return description(); } @@ -127,6 +130,7 @@ public abstract class ValueSource implements Serializable { this.context = context; } + @Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { return new ValueSourceComparator(context, numHits); @@ -149,6 +153,7 @@ public abstract class ValueSource implements Serializable { values = new double[numHits]; } + @Override public int compare(int slot1, int slot2) { final double v1 = values[slot1]; final double v2 = values[slot2]; @@ -162,6 +167,7 @@ public abstract class ValueSource implements Serializable { } + @Override public int compareBottom(int doc) { final double v2 = docVals.doubleVal(doc); if (bottom > v2) { @@ -173,19 +179,23 @@ public abstract class ValueSource implements Serializable { } } + @Override public void copy(int slot, int doc) { values[slot] = docVals.doubleVal(doc); } + @Override public FieldComparator setNextReader(AtomicReaderContext context) throws IOException { docVals = getValues(fcontext, context); return this; } + @Override public void setBottom(final int bottom) { this.bottom = values[bottom]; } + @Override public Comparable value(int slot) { return values[slot]; } diff --git a/solr/src/java/org/apache/solr/search/function/ValueSourceRangeFilter.java b/solr/src/java/org/apache/solr/search/function/ValueSourceRangeFilter.java index 151b3878111..d17d7d1db28 100755 --- a/solr/src/java/org/apache/solr/search/function/ValueSourceRangeFilter.java +++ b/solr/src/java/org/apache/solr/search/function/ValueSourceRangeFilter.java @@ -49,9 +49,11 @@ public class ValueSourceRangeFilter extends SolrFilter { this.includeUpper = upperVal != null && includeUpper; } + @Override public DocIdSet getDocIdSet(final Map context, final AtomicReaderContext readerContext) throws IOException { return new DocIdSet() { - public DocIdSetIterator iterator() throws IOException { + @Override + public DocIdSetIterator iterator() throws IOException { return valueSource.getValues(context, readerContext).getRangeScorer(readerContext.reader, lowerVal, upperVal, includeLower, includeUpper); } }; @@ -62,6 +64,7 @@ public class ValueSourceRangeFilter extends SolrFilter { valueSource.createWeight(context, searcher); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("frange("); @@ -75,6 +78,7 @@ public class ValueSourceRangeFilter extends SolrFilter { return sb.toString(); } + @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ValueSourceRangeFilter)) return false; @@ -89,6 +93,7 @@ public class ValueSourceRangeFilter extends SolrFilter { return true; } + @Override public int hashCode() { int h = valueSource.hashCode(); h += lowerVal != null ? lowerVal.hashCode() : 0x572353db; diff --git a/solr/src/java/org/apache/solr/search/function/VectorValueSource.java b/solr/src/java/org/apache/solr/search/function/VectorValueSource.java index 523e54670a3..4c6aa8a347f 100644 --- a/solr/src/java/org/apache/solr/search/function/VectorValueSource.java +++ b/solr/src/java/org/apache/solr/search/function/VectorValueSource.java @@ -44,6 +44,7 @@ public class VectorValueSource extends MultiValueSource { return sources; } + @Override public int dimension() { return sources.size(); } @@ -97,6 +98,7 @@ public class VectorValueSource extends MultiValueSource { vals[0] = x.strVal(doc); vals[1] = y.strVal(doc); } + @Override public String toString(int doc) { return name() + "(" + x.toString(doc) + "," + y.toString(doc) + ")"; } @@ -178,12 +180,14 @@ public class VectorValueSource extends MultiValueSource { }; } + @Override public void createWeight(Map context, IndexSearcher searcher) throws IOException { for (ValueSource source : sources) source.createWeight(context, searcher); } + @Override public String description() { StringBuilder sb = new StringBuilder(); sb.append(name()).append('('); diff --git a/solr/src/java/org/apache/solr/search/function/distance/GeohashHaversineFunction.java b/solr/src/java/org/apache/solr/search/function/distance/GeohashHaversineFunction.java index 728b528e578..6a94d2f24f9 100644 --- a/solr/src/java/org/apache/solr/search/function/distance/GeohashHaversineFunction.java +++ b/solr/src/java/org/apache/solr/search/function/distance/GeohashHaversineFunction.java @@ -59,22 +59,27 @@ public class GeohashHaversineFunction extends ValueSource { final DocValues gh2DV = geoHash2.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return (float) doubleVal(doc); } + @Override public int intVal(int doc) { return (int) doubleVal(doc); } + @Override public long longVal(int doc) { return (long) doubleVal(doc); } + @Override public double doubleVal(int doc) { return distance(doc, gh1DV, gh2DV); } + @Override public String strVal(int doc) { return Double.toString(doubleVal(doc)); } diff --git a/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java b/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java index 8ee45f57064..197407e970f 100755 --- a/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java +++ b/solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java @@ -39,6 +39,7 @@ import java.util.Map; public class HaversineConstFunction extends ValueSource { public static ValueSourceParser parser = new ValueSourceParser() { + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { // TODO: dispatch through SpatialQueriable in the future? @@ -198,18 +199,22 @@ public class HaversineConstFunction extends ValueSource { final double latCenterRad_cos = this.latCenterRad_cos; return new DocValues() { + @Override public float floatVal(int doc) { return (float) doubleVal(doc); } + @Override public int intVal(int doc) { return (int) doubleVal(doc); } + @Override public long longVal(int doc) { return (long) doubleVal(doc); } + @Override public double doubleVal(int doc) { double latRad = latVals.doubleVal(doc) * DistanceUtils.DEGREES_TO_RADIANS; double lonRad = lonVals.doubleVal(doc) * DistanceUtils.DEGREES_TO_RADIANS; @@ -222,6 +227,7 @@ public class HaversineConstFunction extends ValueSource { return (EARTH_MEAN_DIAMETER * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h))); } + @Override public String strVal(int doc) { return Double.toString(doubleVal(doc)); } @@ -260,6 +266,7 @@ public class HaversineConstFunction extends ValueSource { return result; } + @Override public String description() { return name() + '(' + p2 + ',' + latCenter + ',' + lonCenter + ')'; } diff --git a/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java b/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java index f54c3aa9ba4..734543e0198 100644 --- a/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java +++ b/solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java @@ -100,22 +100,27 @@ public class HaversineFunction extends ValueSource { final DocValues vals2 = p2.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return (float) doubleVal(doc); } + @Override public int intVal(int doc) { return (int) doubleVal(doc); } + @Override public long longVal(int doc) { return (long) doubleVal(doc); } + @Override public double doubleVal(int doc) { return distance(doc, vals1, vals2); } + @Override public String strVal(int doc) { return Double.toString(doubleVal(doc)); } @@ -159,6 +164,7 @@ public class HaversineFunction extends ValueSource { return result; } + @Override public String description() { StringBuilder sb = new StringBuilder(); sb.append(name()).append('('); diff --git a/solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java b/solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java index 729e7de9e3c..37401b18b4e 100644 --- a/solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java +++ b/solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java @@ -33,6 +33,7 @@ public class SquaredEuclideanFunction extends VectorDistanceFunction { } + @Override protected String name() { return name; @@ -41,6 +42,7 @@ public class SquaredEuclideanFunction extends VectorDistanceFunction { /** * @param doc The doc to score */ + @Override protected double distance(int doc, DocValues dv1, DocValues dv2) { double[] vals1 = new double[source1.dimension()]; diff --git a/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java b/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java index 222ef314b7a..43d4552fc83 100644 --- a/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java +++ b/solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java @@ -53,18 +53,22 @@ public class StringDistanceFunction extends ValueSource { final DocValues str2DV = str2.getValues(context, readerContext); return new DocValues() { + @Override public float floatVal(int doc) { return dist.getDistance(str1DV.strVal(doc), str2DV.strVal(doc)); } + @Override public int intVal(int doc) { return (int) doubleVal(doc); } + @Override public long longVal(int doc) { return (long) doubleVal(doc); } + @Override public double doubleVal(int doc) { return (double) floatVal(doc); } @@ -81,6 +85,7 @@ public class StringDistanceFunction extends ValueSource { }; } + @Override public String description() { StringBuilder sb = new StringBuilder(); sb.append("strdist").append('('); diff --git a/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java b/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java index 3b86177bc04..5a7071927d9 100644 --- a/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java +++ b/solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java @@ -96,22 +96,27 @@ public class VectorDistanceFunction extends ValueSource { return (short) doubleVal(doc); } + @Override public float floatVal(int doc) { return (float) doubleVal(doc); } + @Override public int intVal(int doc) { return (int) doubleVal(doc); } + @Override public long longVal(int doc) { return (long) doubleVal(doc); } + @Override public double doubleVal(int doc) { return distance(doc, vals1, vals2); } + @Override public String strVal(int doc) { return Double.toString(doubleVal(doc)); } diff --git a/solr/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java b/solr/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java index 5400046f161..2a53e0f58f1 100644 --- a/solr/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java +++ b/solr/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java @@ -91,6 +91,7 @@ public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker { protected StringDistance sd; + @Override public String init(NamedList config, SolrCore core) { super.init(config, core); indexDir = (String) config.get(INDEX_DIR); @@ -213,6 +214,7 @@ public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker { return reader; } + @Override public void reload(SolrCore core, SolrIndexSearcher searcher) throws IOException { spellChecker.setSpellIndex(index); diff --git a/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java b/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java index fa0939d9456..6d2a4f3fa5f 100644 --- a/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java +++ b/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java @@ -50,12 +50,14 @@ public class FileBasedSpellChecker extends AbstractLuceneSpellChecker { private String characterEncoding; public static final String WORD_FIELD_NAME = "word"; + @Override public String init(NamedList config, SolrCore core) { super.init(config, core); characterEncoding = (String) config.get(SOURCE_FILE_CHAR_ENCODING); return name; } + @Override public void build(SolrCore core, SolrIndexSearcher searcher) { try { loadExternalFileDictionary(core); diff --git a/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java b/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java index bac6c8cbb47..c81180210f2 100644 --- a/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java +++ b/solr/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java @@ -49,6 +49,7 @@ public class IndexBasedSpellChecker extends AbstractLuceneSpellChecker { protected float threshold; protected IndexReader reader; + @Override public String init(NamedList config, SolrCore core) { super.init(config, core); threshold = config.get(THRESHOLD_TOKEN_FREQUENCY) == null ? 0.0f @@ -68,6 +69,7 @@ public class IndexBasedSpellChecker extends AbstractLuceneSpellChecker { } } + @Override public void build(SolrCore core, SolrIndexSearcher searcher) { IndexReader reader = null; try { diff --git a/solr/src/java/org/apache/solr/spelling/SpellingQueryConverter.java b/solr/src/java/org/apache/solr/spelling/SpellingQueryConverter.java index 0825781bdb0..688f4a64cce 100644 --- a/solr/src/java/org/apache/solr/spelling/SpellingQueryConverter.java +++ b/solr/src/java/org/apache/solr/spelling/SpellingQueryConverter.java @@ -91,6 +91,7 @@ public class SpellingQueryConverter extends QueryConverter { * @param original the original query string * @return a Collection of Lucene Tokens */ + @Override public Collection convert(String original) { if (original == null) { // this can happen with q.alt = and no query return Collections.emptyList(); diff --git a/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java b/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java index e61c600c037..a697fa5df00 100644 --- a/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java +++ b/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java @@ -25,6 +25,7 @@ public abstract class Lookup { this.value = value; } + @Override public String toString() { return key + "/" + value; } diff --git a/solr/src/java/org/apache/solr/update/CommitUpdateCommand.java b/solr/src/java/org/apache/solr/update/CommitUpdateCommand.java index 8d33e0280b1..a6bdb39cd67 100644 --- a/solr/src/java/org/apache/solr/update/CommitUpdateCommand.java +++ b/solr/src/java/org/apache/solr/update/CommitUpdateCommand.java @@ -39,6 +39,7 @@ public class CommitUpdateCommand extends UpdateCommand { super("commit", req); this.optimize=optimize; } + @Override public String toString() { return "commit(optimize="+optimize +",waitFlush="+waitFlush diff --git a/solr/src/java/org/apache/solr/update/DeleteUpdateCommand.java b/solr/src/java/org/apache/solr/update/DeleteUpdateCommand.java index ff2ad4764be..79b865a62ea 100644 --- a/solr/src/java/org/apache/solr/update/DeleteUpdateCommand.java +++ b/solr/src/java/org/apache/solr/update/DeleteUpdateCommand.java @@ -30,6 +30,7 @@ public class DeleteUpdateCommand extends UpdateCommand { super("delete", req); } + @Override public String toString() { StringBuilder sb = new StringBuilder(commandName); sb.append(':'); diff --git a/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java index b096b383a76..55f9ac77fc0 100644 --- a/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java +++ b/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java @@ -134,6 +134,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { } } + @Override public int addDoc(AddUpdateCommand cmd) throws IOException { addCommands.incrementAndGet(); addCommandsCumulative.incrementAndGet(); @@ -202,6 +203,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { // could return the number of docs deleted, but is that always possible to know??? + @Override public void delete(DeleteUpdateCommand cmd) throws IOException { deleteByIdCommands.incrementAndGet(); deleteByIdCommandsCumulative.incrementAndGet(); @@ -221,6 +223,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { // why not return number of docs deleted? // Depending on implementation, we may not be able to immediately determine the num... + @Override public void deleteByQuery(DeleteUpdateCommand cmd) throws IOException { deleteByQueryCommands.incrementAndGet(); deleteByQueryCommandsCumulative.incrementAndGet(); @@ -263,6 +266,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { } } + @Override public int mergeIndexes(MergeIndexesCommand cmd) throws IOException { mergeIndexesCommands.incrementAndGet(); int rc = -1; @@ -300,6 +304,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { } } + @Override public void commit(CommitUpdateCommand cmd) throws IOException { if (cmd.optimize) { @@ -369,6 +374,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { /** * @since Solr 1.4 */ + @Override public void rollback(RollbackUpdateCommand cmd) throws IOException { rollbackCommands.incrementAndGet(); @@ -402,6 +408,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { } + @Override public void close() throws IOException { log.info("closing " + this); iwCommit.lock(); @@ -547,6 +554,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { // to facilitate testing: blocks if called during commit public synchronized int getCommitCount() { return autoCommitCount; } + @Override public String toString() { if(timeUpperBound > 0 || docsUpperBound > 0) { return @@ -619,6 +627,7 @@ public class DirectUpdateHandler2 extends UpdateHandler { return lst; } + @Override public String toString() { return "DirectUpdateHandler2" + getStatistics(); } diff --git a/solr/src/java/org/apache/solr/update/SolrIndexWriter.java b/solr/src/java/org/apache/solr/update/SolrIndexWriter.java index 6073a6a42d7..476104b8bb6 100644 --- a/solr/src/java/org/apache/solr/update/SolrIndexWriter.java +++ b/solr/src/java/org/apache/solr/update/SolrIndexWriter.java @@ -132,6 +132,7 @@ public class SolrIndexWriter extends IndexWriter { * **** */ private volatile boolean isClosed = false; + @Override public void close() throws IOException { log.debug("Closing Writer " + name); try { @@ -178,6 +179,7 @@ public class SolrIndexWriter extends IndexWriter { // We might ideally want to override print(String) as well, but // looking through the code that writes to infoStream, it appears // that all the classes except CheckIndex just use println. + @Override public void println(String x) { print(dateFormat.format(new Date()) + " "); super.println(x); diff --git a/solr/src/java/org/apache/solr/update/UpdateCommand.java b/solr/src/java/org/apache/solr/update/UpdateCommand.java index 83e7ca99bf9..0e8f8bc1e07 100644 --- a/solr/src/java/org/apache/solr/update/UpdateCommand.java +++ b/solr/src/java/org/apache/solr/update/UpdateCommand.java @@ -33,6 +33,7 @@ import org.apache.solr.request.SolrQueryRequest; this.commandName = commandName; } + @Override public String toString() { return commandName; } diff --git a/solr/src/java/org/apache/solr/update/processor/Lookup3Signature.java b/solr/src/java/org/apache/solr/update/processor/Lookup3Signature.java index 1960ffac2b2..d2e5353ef9b 100755 --- a/solr/src/java/org/apache/solr/update/processor/Lookup3Signature.java +++ b/solr/src/java/org/apache/solr/update/processor/Lookup3Signature.java @@ -25,10 +25,12 @@ public class Lookup3Signature extends Signature { public Lookup3Signature() { } + @Override public void add(String content) { hash = Hash.lookup3ycs64(content,0,content.length(),hash); } + @Override public byte[] getSignature() { return new byte[]{(byte)(hash>>56),(byte)(hash>>48),(byte)(hash>>40),(byte)(hash>>32),(byte)(hash>>24),(byte)(hash>>16),(byte)(hash>>8),(byte)(hash>>0)}; } diff --git a/solr/src/java/org/apache/solr/update/processor/MD5Signature.java b/solr/src/java/org/apache/solr/update/processor/MD5Signature.java index c7dec90dfc9..4ad6f37d110 100755 --- a/solr/src/java/org/apache/solr/update/processor/MD5Signature.java +++ b/solr/src/java/org/apache/solr/update/processor/MD5Signature.java @@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory; public class MD5Signature extends Signature { protected final static Logger log = LoggerFactory.getLogger(MD5Signature.class); private static ThreadLocal DIGESTER_FACTORY = new ThreadLocal() { + @Override protected MessageDigest initialValue() { try { return MessageDigest.getInstance("MD5"); @@ -41,6 +42,7 @@ public class MD5Signature extends Signature { digester.reset(); } + @Override public void add(String content) { try { digester.update(content.getBytes("UTF-8")); @@ -51,6 +53,7 @@ public class MD5Signature extends Signature { } } + @Override public byte[] getSignature() { return digester.digest(); } diff --git a/solr/src/java/org/apache/solr/update/processor/TextProfileSignature.java b/solr/src/java/org/apache/solr/update/processor/TextProfileSignature.java index c953a2db2b5..e94a7332bc8 100755 --- a/solr/src/java/org/apache/solr/update/processor/TextProfileSignature.java +++ b/solr/src/java/org/apache/solr/update/processor/TextProfileSignature.java @@ -51,12 +51,14 @@ public class TextProfileSignature extends MD5Signature { private float quantRate; private float minTokenLen; + @Override public void init(SolrParams params) { quantRate = params.getFloat("quantRate", 0.01f); minTokenLen = params.getInt("minTokenLen", 2); } + @Override public byte[] getSignature() { return super.getSignature(); } @@ -144,6 +146,7 @@ public class TextProfileSignature extends MD5Signature { this.val = val; } + @Override public String toString() { return val + " " + cnt; } diff --git a/solr/src/java/org/apache/solr/util/BoundedTreeSet.java b/solr/src/java/org/apache/solr/util/BoundedTreeSet.java index dda5fdab14d..4abe7b44145 100644 --- a/solr/src/java/org/apache/solr/util/BoundedTreeSet.java +++ b/solr/src/java/org/apache/solr/util/BoundedTreeSet.java @@ -55,11 +55,13 @@ public class BoundedTreeSet extends TreeSet { remove(last()); } } + @Override public boolean add(E item) { boolean out = super.add(item); adjust(); return out; } + @Override public boolean addAll(Collection c) { boolean out = super.addAll(c); adjust(); diff --git a/solr/src/java/org/apache/solr/util/SolrPluginUtils.java b/solr/src/java/org/apache/solr/util/SolrPluginUtils.java index f98b4308b92..6cdf1d6c3fb 100644 --- a/solr/src/java/org/apache/solr/util/SolrPluginUtils.java +++ b/solr/src/java/org/apache/solr/util/SolrPluginUtils.java @@ -703,6 +703,7 @@ public class SolrPluginUtils { * DisjunctionMaxQuery. (so yes: aliases which point at other * aliases should work) */ + @Override protected Query getFieldQuery(String field, String queryText, boolean quoted) throws ParseException { diff --git a/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java b/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java index a2fbddc77d1..37bf449a76c 100644 --- a/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java +++ b/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java @@ -36,6 +36,7 @@ import java.util.List; */ public class BinaryRequestWriter extends RequestWriter { + @Override public Collection getContentStreams(SolrRequest req) throws IOException { if (req instanceof UpdateRequest) { UpdateRequest updateRequest = (UpdateRequest) req; @@ -55,10 +56,12 @@ public class BinaryRequestWriter extends RequestWriter { } + @Override public String getUpdateContentType() { return "application/octet-stream"; } + @Override public ContentStream getContentStream(final UpdateRequest request) throws IOException { final BAOS baos = new BAOS(); new JavaBinUpdateRequestCodec().marshal(request, baos); @@ -91,6 +94,7 @@ public class BinaryRequestWriter extends RequestWriter { } + @Override public void write(SolrRequest request, OutputStream os) throws IOException { if (request instanceof UpdateRequest) { UpdateRequest updateRequest = (UpdateRequest) request; @@ -106,6 +110,7 @@ public class BinaryRequestWriter extends RequestWriter { } } + @Override public String getPath(SolrRequest req) { if (req instanceof UpdateRequest) { return "/update/javabin"; diff --git a/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryResponseParser.java b/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryResponseParser.java index 4b29ce8b52b..13794601adb 100755 --- a/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryResponseParser.java +++ b/solr/src/solrj/org/apache/solr/client/solrj/impl/BinaryResponseParser.java @@ -30,10 +30,12 @@ import java.io.Reader; * @since solr 1.3 */ public class BinaryResponseParser extends ResponseParser { + @Override public String getWriterType() { return "javabin"; } + @Override public NamedList processResponse(InputStream body, String encoding) { try { return (NamedList) new JavaBinCodec().unmarshal(body); @@ -44,10 +46,12 @@ public class BinaryResponseParser extends ResponseParser { } + @Override public String getVersion() { return "2"; } + @Override public NamedList processResponse(Reader reader) { throw new RuntimeException("Cannot handle character stream"); } diff --git a/solr/src/solrj/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java b/solr/src/solrj/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java index b13b708e0bf..a12a9397e9b 100644 --- a/solr/src/solrj/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java +++ b/solr/src/solrj/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java @@ -105,6 +105,7 @@ public class LBHttpSolrServer extends SolrServer { this.solrServer = solrServer; } + @Override public String toString() { return solrServer.getBaseURL(); } @@ -376,6 +377,7 @@ public class LBHttpSolrServer extends SolrServer { * @throws SolrServerException * @throws IOException */ + @Override public NamedList request(final SolrRequest request) throws SolrServerException, IOException { Exception ex = null; @@ -535,6 +537,7 @@ public class LBHttpSolrServer extends SolrServer { return httpClient; } + @Override protected void finalize() throws Throwable { try { if(this.aliveCheckExecutor!=null) diff --git a/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java b/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java index bcbf378552f..b0b90864296 100644 --- a/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java +++ b/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java @@ -48,12 +48,14 @@ public class StreamingBinaryResponseParser extends BinaryResponseParser { try { JavaBinCodec codec = new JavaBinCodec() { + @Override public SolrDocument readSolrDocument(FastInputStream dis) throws IOException { SolrDocument doc = super.readSolrDocument(dis); callback.streamSolrDocument( doc ); return null; } + @Override public SolrDocumentList readSolrDocumentList(FastInputStream dis) throws IOException { SolrDocumentList solrDocs = new SolrDocumentList(); List list = (List) readVal(dis); diff --git a/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java b/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java index a45412584f8..0f5842e632e 100644 --- a/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java +++ b/solr/src/solrj/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java @@ -67,6 +67,7 @@ public class JavaBinUpdateRequestCodec { nl.add("delByQ", updateRequest.getDeleteQuery()); nl.add("docs", docIter); new JavaBinCodec(){ + @Override public void writeMap(Map val) throws IOException { if (val instanceof SolrInputDocument) { writeVal(solrInputDocumentToList((SolrInputDocument) val)); @@ -101,6 +102,7 @@ public class JavaBinUpdateRequestCodec { // is ever refactored, this will not work. private boolean seenOuterMostDocIterator = false; + @Override public NamedList readNamedList(FastInputStream dis) throws IOException { int sz = readSize(dis); NamedList nl = new NamedList(); @@ -115,6 +117,7 @@ public class JavaBinUpdateRequestCodec { return nl; } + @Override public List readIterator(FastInputStream fis) throws IOException { // default behavior for reading any regular Iterator in the stream diff --git a/solr/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java b/solr/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java index f2064dd5b3c..d0154c29698 100644 --- a/solr/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java +++ b/solr/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java @@ -94,6 +94,7 @@ public class FieldStatsInfo implements Serializable { } } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java index 1dc858ad0ef..1934bf7cd31 100644 --- a/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java +++ b/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java @@ -98,24 +98,28 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 { public static Logger log = LoggerFactory.getLogger(BaseDistributedSearchTestCase.class); public static RandVal rint = new RandVal() { + @Override public Object val() { return r.nextInt(); } }; public static RandVal rlong = new RandVal() { + @Override public Object val() { return r.nextLong(); } }; public static RandVal rfloat = new RandVal() { + @Override public Object val() { return r.nextFloat(); } }; public static RandVal rdouble = new RandVal() { + @Override public Object val() { return r.nextDouble(); } @@ -337,6 +341,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 { Thread[] threads = new Thread[nThreads]; for (int i = 0; i < threads.length; i++) { threads[i] = new Thread() { + @Override public void run() { for (int j = 0; j < stress; j++) { int which = r.nextInt(clients.size()); @@ -623,6 +628,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 { public static class RandDate extends RandVal { public static TrieDateField df = new TrieDateField(); + @Override public Object val() { long v = r.nextLong(); Date d = new Date(v); diff --git a/solr/src/test/org/apache/solr/BasicFunctionalityTest.java b/solr/src/test/org/apache/solr/BasicFunctionalityTest.java index 7662ca0eff1..3847825c7a5 100644 --- a/solr/src/test/org/apache/solr/BasicFunctionalityTest.java +++ b/solr/src/test/org/apache/solr/BasicFunctionalityTest.java @@ -221,10 +221,15 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 { public void testRequestHandlerBaseException() { final String tmp = "BOO! ignore_exception"; SolrRequestHandler handler = new RequestHandlerBase() { + @Override public String getDescription() { return tmp; } + @Override public String getSourceId() { return tmp; } + @Override public String getSource() { return tmp; } + @Override public String getVersion() { return tmp; } + @Override public void handleRequestBody ( SolrQueryRequest req, SolrQueryResponse rsp ) { throw new RuntimeException(tmp); diff --git a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java b/solr/src/test/org/apache/solr/SolrTestCaseJ4.java index 9eb858da5a6..9efe83751eb 100755 --- a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/src/test/org/apache/solr/SolrTestCaseJ4.java @@ -602,6 +602,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase { /** Neccessary to make method signatures un-ambiguous */ public static class XmlDoc { public String xml; + @Override public String toString() { return xml; } } @@ -727,6 +728,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase { public int order; // the order this document was added to the index + @Override public String toString() { return "Doc("+order+"):"+fields.toString(); } @@ -780,6 +782,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase { public static class Fld { public FldType ftype; public List vals; + @Override public String toString() { return ftype.fname + "=" + (vals.size()==1 ? vals.get(0).toString() : vals.toString()); } diff --git a/solr/src/test/org/apache/solr/TestTrie.java b/solr/src/test/org/apache/solr/TestTrie.java index 9a818099609..861c349b5fa 100644 --- a/solr/src/test/org/apache/solr/TestTrie.java +++ b/solr/src/test/org/apache/solr/TestTrie.java @@ -41,6 +41,7 @@ public class TestTrie extends SolrTestCaseJ4 { initCore("solrconfig.xml","schema-trie.xml"); } + @Override @After public void tearDown() throws Exception { clearIndex(); diff --git a/solr/src/test/org/apache/solr/analysis/TestRemoveDuplicatesTokenFilterFactory.java b/solr/src/test/org/apache/solr/analysis/TestRemoveDuplicatesTokenFilterFactory.java index 6eb8a17f2c0..7795fd640f4 100644 --- a/solr/src/test/org/apache/solr/analysis/TestRemoveDuplicatesTokenFilterFactory.java +++ b/solr/src/test/org/apache/solr/analysis/TestRemoveDuplicatesTokenFilterFactory.java @@ -48,6 +48,7 @@ public class TestRemoveDuplicatesTokenFilterFactory extends BaseTokenTestCase { CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class); PositionIncrementAttribute posIncAtt = addAttribute(PositionIncrementAttribute.class); + @Override public boolean incrementToken() { if (toks.hasNext()) { clearAttributes(); diff --git a/solr/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java b/solr/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java index 5673ea8676e..184f241cff0 100644 --- a/solr/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java +++ b/solr/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java @@ -52,6 +52,7 @@ public class TestReversedWildcardFilterFactory extends SolrTestCaseJ4 { initCore("solrconfig.xml","schema-reversed.xml"); } + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java index d9725aafd93..60fc20123e3 100644 --- a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java +++ b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java @@ -30,6 +30,7 @@ import org.apache.solr.util.AbstractSolrTestCase; */ abstract public class SolrExampleTestBase extends AbstractSolrTestCase { + @Override public String getSolrHome() { return "../../../example/solr/"; } @Override public String getSchemaFile() { return getSolrHome()+"conf/schema.xml"; } diff --git a/solr/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java b/solr/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java index 8886a9445db..75f4e341860 100644 --- a/solr/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java +++ b/solr/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java @@ -48,6 +48,7 @@ public class TestLBHttpSolrServer extends LuceneTestCase { SolrInstance[] solr = new SolrInstance[3]; HttpClient httpClient; + @Override public void setUp() throws Exception { super.setUp(); httpClient = new HttpClient(new MultiThreadedHttpConnectionManager()); diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java b/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java index 997f1cdcb92..937f8778481 100644 --- a/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java +++ b/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java @@ -66,6 +66,7 @@ public class TestSolrProperties extends LuceneTestCase { return "solr.xml"; } + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -77,6 +78,7 @@ public class TestSolrProperties extends LuceneTestCase { cores = new CoreContainer(home.getAbsolutePath(), solrXml); } + @Override @After public void tearDown() throws Exception { if (cores != null) diff --git a/solr/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java b/solr/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java index 053b07732ca..3fe298359ca 100644 --- a/solr/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java +++ b/solr/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java @@ -51,6 +51,7 @@ public abstract class AbstractDistributedZkTestCase extends BaseDistributedSearc System.setProperty("solr.test.sys.prop2", "proptwo"); } + @Override protected void createServers(int numShards) throws Exception { System.setProperty("collection", "control_collection"); controlJetty = createJetty(testDir, testDir + "/control/data", "control_shard"); diff --git a/solr/src/test/org/apache/solr/cloud/AbstractZkTestCase.java b/solr/src/test/org/apache/solr/cloud/AbstractZkTestCase.java index 31721ed2782..72eb68a523b 100644 --- a/solr/src/test/org/apache/solr/cloud/AbstractZkTestCase.java +++ b/solr/src/test/org/apache/solr/cloud/AbstractZkTestCase.java @@ -99,6 +99,7 @@ public abstract class AbstractZkTestCase extends SolrTestCaseJ4 { + File.separator + "conf" + File.separator + name)); } + @Override public void tearDown() throws Exception { if (DEBUG) { printLayout(zkServer.getZkHost()); diff --git a/solr/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java b/solr/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java index 8d836ac6e97..3e60c0401e9 100644 --- a/solr/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java +++ b/solr/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java @@ -229,6 +229,7 @@ public class CloudStateUpdateTest extends SolrTestCaseJ4 { } + @Override public void tearDown() throws Exception { if (VERBOSE) { printLayout(zkServer.getZkHost()); diff --git a/solr/src/test/org/apache/solr/cloud/ZkControllerTest.java b/solr/src/test/org/apache/solr/cloud/ZkControllerTest.java index 4cbbd9e062d..f8eedd9cb5a 100644 --- a/solr/src/test/org/apache/solr/cloud/ZkControllerTest.java +++ b/solr/src/test/org/apache/solr/cloud/ZkControllerTest.java @@ -217,6 +217,7 @@ public class ZkControllerTest extends SolrTestCaseJ4 { .create(shardsPath + "/" + zkNodeName, bytes, CreateMode.PERSISTENT); } + @Override public void tearDown() throws Exception { SolrConfig.severeErrors.clear(); super.tearDown(); diff --git a/solr/src/test/org/apache/solr/cloud/ZkSolrClientTest.java b/solr/src/test/org/apache/solr/cloud/ZkSolrClientTest.java index c8a0bce9b1b..7aece955627 100644 --- a/solr/src/test/org/apache/solr/cloud/ZkSolrClientTest.java +++ b/solr/src/test/org/apache/solr/cloud/ZkSolrClientTest.java @@ -232,6 +232,7 @@ public class ZkSolrClientTest extends AbstractSolrTestCase { return null; } + @Override public void tearDown() throws Exception { SolrConfig.severeErrors.clear(); super.tearDown(); diff --git a/solr/src/test/org/apache/solr/core/AlternateDirectoryTest.java b/solr/src/test/org/apache/solr/core/AlternateDirectoryTest.java index 9f1d46a92b7..b036cb8c35d 100755 --- a/solr/src/test/org/apache/solr/core/AlternateDirectoryTest.java +++ b/solr/src/test/org/apache/solr/core/AlternateDirectoryTest.java @@ -48,6 +48,7 @@ public class AlternateDirectoryTest extends SolrTestCaseJ4 { public static volatile boolean openCalled = false; public static volatile Directory dir; + @Override public Directory open(String path) throws IOException { openCalled = true; // need to close the directory, or otherwise the test fails. @@ -63,6 +64,7 @@ public class AlternateDirectoryTest extends SolrTestCaseJ4 { static public class TestIndexReaderFactory extends IndexReaderFactory { static volatile boolean newReaderCalled = false; + @Override public IndexReader newReader(Directory indexDir, boolean readOnly) throws IOException { TestIndexReaderFactory.newReaderCalled = true; diff --git a/solr/src/test/org/apache/solr/core/DummyValueSourceParser.java b/solr/src/test/org/apache/solr/core/DummyValueSourceParser.java index 96f27c8689e..3e13f693450 100644 --- a/solr/src/test/org/apache/solr/core/DummyValueSourceParser.java +++ b/solr/src/test/org/apache/solr/core/DummyValueSourceParser.java @@ -32,17 +32,21 @@ import org.apache.solr.search.function.ValueSource; public class DummyValueSourceParser extends ValueSourceParser { private NamedList args; + @Override public void init(NamedList args) { this.args = args; } + @Override public ValueSource parse(FunctionQParser fp) throws ParseException { ValueSource source = fp.parseValueSource(); ValueSource result = new SimpleFloatFunction(source) { + @Override protected String name() { return "foo"; } + @Override protected float func(int doc, DocValues vals) { float result = 0; return result; diff --git a/solr/src/test/org/apache/solr/core/IndexReaderFactoryTest.java b/solr/src/test/org/apache/solr/core/IndexReaderFactoryTest.java index 870e21d5567..1fbec3fde3b 100644 --- a/solr/src/test/org/apache/solr/core/IndexReaderFactoryTest.java +++ b/solr/src/test/org/apache/solr/core/IndexReaderFactoryTest.java @@ -20,10 +20,12 @@ import org.apache.solr.util.AbstractSolrTestCase; public class IndexReaderFactoryTest extends AbstractSolrTestCase { + @Override public String getSchemaFile() { return "schema.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig-termindex.xml"; } diff --git a/solr/src/test/org/apache/solr/core/MockQuerySenderListenerReqHandler.java b/solr/src/test/org/apache/solr/core/MockQuerySenderListenerReqHandler.java index d4a27c0ded8..4b351684c23 100644 --- a/solr/src/test/org/apache/solr/core/MockQuerySenderListenerReqHandler.java +++ b/solr/src/test/org/apache/solr/core/MockQuerySenderListenerReqHandler.java @@ -34,36 +34,43 @@ public class MockQuerySenderListenerReqHandler extends RequestHandlerBase { AtomicInteger initCounter = new AtomicInteger(0); + @Override public void init(NamedList args) { initCounter.incrementAndGet(); super.init(args); } + @Override public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { this.req = req; this.rsp = rsp; } + @Override public String getDescription() { String result = null; return result; } + @Override public String getSourceId() { String result = null; return result; } + @Override public String getSource() { String result = null; return result; } + @Override public String getVersion() { String result = null; return result; } + @Override public NamedList getStatistics() { NamedList lst = super.getStatistics(); lst.add("initCount", initCounter.intValue()); diff --git a/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java b/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java index d19895c1994..59d1afba922 100644 --- a/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java +++ b/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java @@ -42,6 +42,7 @@ import org.xml.sax.SAXException; */ public class TestArbitraryIndexDir extends AbstractSolrTestCase{ + @Override public void setUp() throws Exception { super.setUp(); @@ -58,6 +59,7 @@ public class TestArbitraryIndexDir extends AbstractSolrTestCase{ ("standard",0,20,"version","2.2"); } + @Override public void tearDown() throws Exception { super.tearDown(); diff --git a/solr/src/test/org/apache/solr/core/TestBadConfig.java b/solr/src/test/org/apache/solr/core/TestBadConfig.java index 54a742da392..d7ceb8955f4 100644 --- a/solr/src/test/org/apache/solr/core/TestBadConfig.java +++ b/solr/src/test/org/apache/solr/core/TestBadConfig.java @@ -21,9 +21,12 @@ import org.apache.solr.util.AbstractSolrTestCase; public class TestBadConfig extends AbstractSolrTestCase { + @Override public String getSchemaFile() { return "schema.xml"; } + @Override public String getSolrConfigFile() { return "bad_solrconfig.xml"; } + @Override public void setUp() throws Exception { ignoreException("unset.sys.property"); try { diff --git a/solr/src/test/org/apache/solr/core/TestJmxIntegration.java b/solr/src/test/org/apache/solr/core/TestJmxIntegration.java index 46f42d11fec..3977c4a1e94 100644 --- a/solr/src/test/org/apache/solr/core/TestJmxIntegration.java +++ b/solr/src/test/org/apache/solr/core/TestJmxIntegration.java @@ -46,6 +46,7 @@ public class TestJmxIntegration extends AbstractSolrTestCase { return "solrconfig.xml"; } + @Override @Before public void setUp() throws Exception { // Make sure that at least one MBeanServer is available @@ -53,6 +54,7 @@ public class TestJmxIntegration extends AbstractSolrTestCase { super.setUp(); } + @Override @After public void tearDown() throws Exception { super.tearDown(); diff --git a/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java b/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java index 2356df8a6c3..ff91adeb41b 100644 --- a/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java +++ b/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java @@ -51,6 +51,7 @@ public class TestJmxMonitoredMap extends LuceneTestCase { private JmxMonitoredMap monitoredMap; + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -84,6 +85,7 @@ public class TestJmxMonitoredMap extends LuceneTestCase { } } + @Override @After public void tearDown() throws Exception { try { diff --git a/solr/src/test/org/apache/solr/core/TestPropInject.java b/solr/src/test/org/apache/solr/core/TestPropInject.java index 858388a7ac0..345feacb8cb 100644 --- a/solr/src/test/org/apache/solr/core/TestPropInject.java +++ b/solr/src/test/org/apache/solr/core/TestPropInject.java @@ -26,10 +26,12 @@ import org.apache.solr.update.DirectUpdateHandler2; import org.apache.solr.util.AbstractSolrTestCase; public class TestPropInject extends AbstractSolrTestCase { + @Override public String getSchemaFile() { return "schema.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig-propinject.xml"; } diff --git a/solr/src/test/org/apache/solr/core/TestSolrDeletionPolicy1.java b/solr/src/test/org/apache/solr/core/TestSolrDeletionPolicy1.java index 2d9cf6c03b1..29f2f5d8cf2 100644 --- a/solr/src/test/org/apache/solr/core/TestSolrDeletionPolicy1.java +++ b/solr/src/test/org/apache/solr/core/TestSolrDeletionPolicy1.java @@ -34,6 +34,7 @@ public class TestSolrDeletionPolicy1 extends SolrTestCaseJ4 { initCore("solrconfig-delpolicy1.xml","schema.xml"); } + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java b/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java index 905685abeb8..fbe8d74c86a 100644 --- a/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java +++ b/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java @@ -33,11 +33,13 @@ import javax.xml.parsers.DocumentBuilderFactory; public class TestXIncludeConfig extends AbstractSolrTestCase { protected boolean supports; + @Override public String getSchemaFile() { return "schema.xml"; } //public String getSolrConfigFile() { return "solrconfig.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig-xinclude.xml"; } diff --git a/solr/src/test/org/apache/solr/handler/JsonLoaderTest.java b/solr/src/test/org/apache/solr/handler/JsonLoaderTest.java index c9b280d88d4..e6635475356 100644 --- a/solr/src/test/org/apache/solr/handler/JsonLoaderTest.java +++ b/solr/src/test/org/apache/solr/handler/JsonLoaderTest.java @@ -146,23 +146,28 @@ class BufferingRequestProcessor extends UpdateRequestProcessor super(next); } + @Override public void processAdd(AddUpdateCommand cmd) throws IOException { addCommands.add( cmd ); } + @Override public void processDelete(DeleteUpdateCommand cmd) throws IOException { deleteCommands.add( cmd ); } + @Override public void processCommit(CommitUpdateCommand cmd) throws IOException { commitCommands.add( cmd ); } + @Override public void processRollback(RollbackUpdateCommand cmd) throws IOException { rollbackCommands.add( cmd ); } + @Override public void finish() throws IOException { // nothing? } diff --git a/solr/src/test/org/apache/solr/handler/TestCSVLoader.java b/solr/src/test/org/apache/solr/handler/TestCSVLoader.java index 1339a851c7b..37a1f9f9dd4 100755 --- a/solr/src/test/org/apache/solr/handler/TestCSVLoader.java +++ b/solr/src/test/org/apache/solr/handler/TestCSVLoader.java @@ -41,6 +41,7 @@ public class TestCSVLoader extends SolrTestCaseJ4 { String def_charset = "UTF-8"; File file = new File(filename); + @Override @Before public void setUp() throws Exception { // if you override setUp or tearDown, you better call @@ -49,6 +50,7 @@ public class TestCSVLoader extends SolrTestCaseJ4 { cleanup(); } + @Override @After public void tearDown() throws Exception { // if you override setUp or tearDown, you better call diff --git a/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java index b3f68ede013..da6013b5097 100644 --- a/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java +++ b/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java @@ -622,6 +622,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 { class BackupThread extends Thread { volatile String fail = null; + @Override public void run() { String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_BACKUP; URL url; @@ -646,6 +647,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 { volatile String fail = null; volatile String response = null; volatile boolean success = false; + @Override public void run() { String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_DETAILS; URL url; diff --git a/solr/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java b/solr/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java index 257aef389a6..30972f8b881 100644 --- a/solr/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java +++ b/solr/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java @@ -42,6 +42,7 @@ public class SpellCheckComponentTest extends SolrTestCaseJ4 { initCore("solrconfig-spellcheckcomponent.xml","schema.xml"); } + @Override public void setUp() throws Exception { super.setUp(); assertU(adoc("id", "0", "lowerfilt", "This is a title")); @@ -59,6 +60,7 @@ public class SpellCheckComponentTest extends SolrTestCaseJ4 { assertU((commit())); } + @Override public void tearDown() throws Exception { super.tearDown(); assertU(delQ("*:*")); diff --git a/solr/src/test/org/apache/solr/request/TestBinaryResponseWriter.java b/solr/src/test/org/apache/solr/request/TestBinaryResponseWriter.java index 2d6063d2e4f..703a7e121b5 100644 --- a/solr/src/test/org/apache/solr/request/TestBinaryResponseWriter.java +++ b/solr/src/test/org/apache/solr/request/TestBinaryResponseWriter.java @@ -38,10 +38,12 @@ import java.util.UUID; */ public class TestBinaryResponseWriter extends AbstractSolrTestCase { + @Override public String getSchemaFile() { return "schema12.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig.xml"; } diff --git a/solr/src/test/org/apache/solr/request/TestWriterPerf.java b/solr/src/test/org/apache/solr/request/TestWriterPerf.java index e7da448650a..7bc0d774411 100755 --- a/solr/src/test/org/apache/solr/request/TestWriterPerf.java +++ b/solr/src/test/org/apache/solr/request/TestWriterPerf.java @@ -37,15 +37,19 @@ public class TestWriterPerf extends AbstractSolrTestCase { public static final Logger log = LoggerFactory.getLogger(TestWriterPerf.class); + @Override public String getSchemaFile() { return "schema11.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig-functionquery.xml"; } public String getCoreName() { return "basic"; } + @Override public void setUp() throws Exception { // if you override setUp or tearDown, you better call // the super classes version super.setUp(); } + @Override public void tearDown() throws Exception { // if you override setUp or tearDown, you better call // the super classes version diff --git a/solr/src/test/org/apache/solr/schema/CustomSimilarityFactory.java b/solr/src/test/org/apache/solr/schema/CustomSimilarityFactory.java index 88296e00b03..03fbaecaec2 100644 --- a/solr/src/test/org/apache/solr/schema/CustomSimilarityFactory.java +++ b/solr/src/test/org/apache/solr/schema/CustomSimilarityFactory.java @@ -19,6 +19,7 @@ package org.apache.solr.schema; import org.apache.lucene.search.SimilarityProvider; public class CustomSimilarityFactory extends SimilarityFactory { + @Override public SimilarityProvider getSimilarityProvider() { return new MockConfigurableSimilarity(params.get("echo")); } diff --git a/solr/src/test/org/apache/solr/schema/DateFieldTest.java b/solr/src/test/org/apache/solr/schema/DateFieldTest.java index 334067f6608..9168d4fe993 100644 --- a/solr/src/test/org/apache/solr/schema/DateFieldTest.java +++ b/solr/src/test/org/apache/solr/schema/DateFieldTest.java @@ -29,6 +29,7 @@ public class DateFieldTest extends LuceneTestCase { protected DateField f = null; protected DateMathParser p = new DateMathParser(UTC, Locale.US); + @Override public void setUp() throws Exception { super.setUp(); f = new DateField(); diff --git a/solr/src/test/org/apache/solr/schema/TestBinaryField.java b/solr/src/test/org/apache/solr/schema/TestBinaryField.java index 7fab9f0c188..72fb0f1225b 100644 --- a/solr/src/test/org/apache/solr/schema/TestBinaryField.java +++ b/solr/src/test/org/apache/solr/schema/TestBinaryField.java @@ -174,6 +174,7 @@ public class TestBinaryField extends LuceneTestCase { } + @Override public void tearDown() throws Exception { jetty.stop(); super.tearDown(); diff --git a/solr/src/test/org/apache/solr/search/FooQParserPlugin.java b/solr/src/test/org/apache/solr/search/FooQParserPlugin.java index 397e1c349ac..b58006fc2a3 100755 --- a/solr/src/test/org/apache/solr/search/FooQParserPlugin.java +++ b/solr/src/test/org/apache/solr/search/FooQParserPlugin.java @@ -27,6 +27,7 @@ import org.apache.lucene.index.Term; public class FooQParserPlugin extends QParserPlugin { + @Override public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { return new FooQParser(qstr, localParams, params, req); } @@ -40,6 +41,7 @@ class FooQParser extends QParser { super(qstr, localParams, params, req); } + @Override public Query parse() throws ParseException { return new TermQuery(new Term(localParams.get(QueryParsing.F), localParams.get(QueryParsing.V))); } diff --git a/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java b/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java index 3ff940b75a7..1b890801a19 100755 --- a/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java +++ b/solr/src/test/org/apache/solr/search/TestExtendedDismaxParser.java @@ -20,15 +20,19 @@ package org.apache.solr.search; import org.apache.solr.util.AbstractSolrTestCase; public class TestExtendedDismaxParser extends AbstractSolrTestCase { + @Override public String getSchemaFile() { return "schema12.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig.xml"; } // public String getCoreName() { return "collection1"; } + @Override public void setUp() throws Exception { // if you override setUp or tearDown, you better call // the super classes version super.setUp(); } + @Override public void tearDown() throws Exception { // if you override setUp or tearDown, you better call // the super classes version diff --git a/solr/src/test/org/apache/solr/search/TestFastLRUCache.java b/solr/src/test/org/apache/solr/search/TestFastLRUCache.java index 0ff414ba79d..d313eb4d597 100644 --- a/solr/src/test/org/apache/solr/search/TestFastLRUCache.java +++ b/solr/src/test/org/apache/solr/search/TestFastLRUCache.java @@ -334,6 +334,7 @@ public class TestFastLRUCache extends LuceneTestCase { for (int i=0; i> suggestions = new LinkedHashMap>(); - @Before + @Override + @Before public void setUp() throws Exception { super.setUp(); suggestions.clear(); diff --git a/solr/src/test/org/apache/solr/update/AutoCommitTest.java b/solr/src/test/org/apache/solr/update/AutoCommitTest.java index e121423394c..cb0afdded27 100644 --- a/solr/src/test/org/apache/solr/update/AutoCommitTest.java +++ b/solr/src/test/org/apache/solr/update/AutoCommitTest.java @@ -78,7 +78,9 @@ class CommitListener implements SolrEventListener { public class AutoCommitTest extends AbstractSolrTestCase { + @Override public String getSchemaFile() { return "schema.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig.xml"; } /** diff --git a/solr/src/test/org/apache/solr/update/DirectUpdateHandlerOptimizeTest.java b/solr/src/test/org/apache/solr/update/DirectUpdateHandlerOptimizeTest.java index 98f92553e7d..2f425545d65 100644 --- a/solr/src/test/org/apache/solr/update/DirectUpdateHandlerOptimizeTest.java +++ b/solr/src/test/org/apache/solr/update/DirectUpdateHandlerOptimizeTest.java @@ -32,10 +32,12 @@ import java.io.FileFilter; **/ public class DirectUpdateHandlerOptimizeTest extends AbstractSolrTestCase { + @Override public String getSchemaFile() { return "schema12.xml"; } + @Override public String getSolrConfigFile() { // return "solrconfig-duh-optimize.xml"; return "solrconfig.xml"; diff --git a/solr/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java b/solr/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java index 242ea064b3d..654d474d161 100644 --- a/solr/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java +++ b/solr/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java @@ -42,6 +42,7 @@ public class DirectUpdateHandlerTest extends SolrTestCaseJ4 { initCore("solrconfig.xml", "schema12.xml"); } + @Override @Before public void setUp() throws Exception { super.setUp(); diff --git a/solr/src/test/org/apache/solr/update/TestIndexingPerformance.java b/solr/src/test/org/apache/solr/update/TestIndexingPerformance.java index f513a94ca1d..51a55c4aaf1 100755 --- a/solr/src/test/org/apache/solr/update/TestIndexingPerformance.java +++ b/solr/src/test/org/apache/solr/update/TestIndexingPerformance.java @@ -41,7 +41,9 @@ public class TestIndexingPerformance extends AbstractSolrTestCase { public static final Logger log = LoggerFactory.getLogger(TestIndexingPerformance.class); + @Override public String getSchemaFile() { return "schema12.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig_perf.xml"; } public void testIndexingPerf() throws IOException { diff --git a/solr/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java b/solr/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java index 25f1a639442..7bd622b6074 100755 --- a/solr/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java +++ b/solr/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java @@ -129,6 +129,7 @@ public class SignatureUpdateProcessorFactoryTest extends SolrTestCaseJ4 { for (int i = 0; i < threads.length; i++) { threads[i] = new Thread() { + @Override public void run() { for (int i = 0; i < 30; i++) { // h.update(adoc("id", Integer.toString(1+ i), "v_t", @@ -150,6 +151,7 @@ public class SignatureUpdateProcessorFactoryTest extends SolrTestCaseJ4 { for (int i = 0; i < threads2.length; i++) { threads2[i] = new Thread() { + @Override public void run() { for (int i = 0; i < 10; i++) { // h.update(adoc("id" , Integer.toString(1+ i + 10000), "v_t", diff --git a/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java b/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java index fec67be17b0..c9ecd2f3038 100644 --- a/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java +++ b/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java @@ -111,6 +111,7 @@ public abstract class AbstractSolrTestCase extends LuceneTestCase { public static Logger log = LoggerFactory.getLogger(AbstractSolrTestCase.class); private String factoryProp; + @Override public void setUp() throws Exception { super.setUp(); log.info("####SETUP_START " + getName()); @@ -170,6 +171,7 @@ public abstract class AbstractSolrTestCase extends LuceneTestCase { * to delete dataDir, unless the system property "solr.test.leavedatadir" * is set. */ + @Override public void tearDown() throws Exception { log.info("####TEARDOWN_START " + getName()); if (factoryProp == null) { @@ -403,6 +405,7 @@ public abstract class AbstractSolrTestCase extends LuceneTestCase { /** Neccessary to make method signatures un-ambiguous */ public static class Doc { public String xml; + @Override public String toString() { return xml; } } diff --git a/solr/src/test/org/apache/solr/util/TestNumberUtils.java b/solr/src/test/org/apache/solr/util/TestNumberUtils.java index 0e6c915697a..cc462944093 100644 --- a/solr/src/test/org/apache/solr/util/TestNumberUtils.java +++ b/solr/src/test/org/apache/solr/util/TestNumberUtils.java @@ -182,72 +182,88 @@ abstract class Converter { } class Int2Int extends Converter { + @Override public String toInternal(String val) { return Integer.toString(Integer.parseInt(val)); } + @Override public String toExternal(String val) { return Integer.toString(Integer.parseInt(val)); } } class SortInt extends Converter { + @Override public String toInternal(String val) { return NumberUtils.int2sortableStr(val); } + @Override public String toExternal(String val) { return NumberUtils.SortableStr2int(val); } } class SortLong extends Converter { + @Override public String toInternal(String val) { return NumberUtils.long2sortableStr(val); } + @Override public String toExternal(String val) { return NumberUtils.SortableStr2long(val); } } class Float2Float extends Converter { + @Override public String toInternal(String val) { return Float.toString(Float.parseFloat(val)); } + @Override public String toExternal(String val) { return Float.toString(Float.parseFloat(val)); } } class SortFloat extends Converter { + @Override public String toInternal(String val) { return NumberUtils.float2sortableStr(val); } + @Override public String toExternal(String val) { return NumberUtils.SortableStr2floatStr(val); } } class SortDouble extends Converter { + @Override public String toInternal(String val) { return NumberUtils.double2sortableStr(val); } + @Override public String toExternal(String val) { return NumberUtils.SortableStr2doubleStr(val); } } class Base100S extends Converter { + @Override public String toInternal(String val) { return BCDUtils.base10toBase100SortableInt(val); } + @Override public String toExternal(String val) { return BCDUtils.base100SortableIntToBase10(val); } } class Base10kS extends Converter { + @Override public String toInternal(String val) { return BCDUtils.base10toBase10kSortableInt(val); } + @Override public String toExternal(String val) { return BCDUtils.base10kSortableIntToBase10(val); } diff --git a/solr/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java b/solr/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java index f8c61e5a8e1..ae220a0a852 100644 --- a/solr/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java +++ b/solr/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java @@ -26,7 +26,9 @@ import java.io.StringWriter; import java.io.IOException; public class VelocityResponseWriterTest extends AbstractSolrTestCase { + @Override public String getSchemaFile() { return "schema.xml"; } + @Override public String getSolrConfigFile() { return "solrconfig.xml"; } diff --git a/solr/src/webapp/src/org/apache/solr/servlet/LogLevelSelection.java b/solr/src/webapp/src/org/apache/solr/servlet/LogLevelSelection.java index e272d5e973f..e8996e26346 100644 --- a/solr/src/webapp/src/org/apache/solr/servlet/LogLevelSelection.java +++ b/solr/src/webapp/src/org/apache/solr/servlet/LogLevelSelection.java @@ -36,6 +36,7 @@ import java.util.logging.Logger; * @since solr 1.3 */ public final class LogLevelSelection extends HttpServlet { + @Override public void init() throws ServletException { } @@ -43,6 +44,7 @@ public final class LogLevelSelection extends HttpServlet { * Processes an HTTP GET request and changes the logging level as * specified. */ + @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { @@ -147,6 +149,7 @@ public final class LogLevelSelection extends HttpServlet { } + @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { @@ -259,6 +262,7 @@ public final class LogLevelSelection extends HttpServlet { return name.compareTo(((LogWrapper) other).name); } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -275,6 +279,7 @@ public final class LogLevelSelection extends HttpServlet { return true; } + @Override public int hashCode() { final int prime = 31; int result = 1;