You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2012/10/25 15:10:51 UTC
svn commit: r1402140 [13/17] - in /lucene/dev/branches/LUCENE-2878: ./
dev-tools/ dev-tools/eclipse/ dev-tools/eclipse/dot.settings/
dev-tools/idea/.idea/libraries/ dev-tools/idea/lucene/classification/
dev-tools/maven/ dev-tools/maven/lucene/classific...
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java Thu Oct 25 13:10:25 2012
@@ -28,14 +28,18 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
+import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.NoDeletionPolicy;
+import org.apache.lucene.index.SegmentInfos;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.ThrottledIndexOutput;
import org.apache.lucene.util._TestUtil;
@@ -212,15 +216,17 @@ public class MockDirectoryWrapper extend
// first force-close all files, so we can corrupt on windows etc.
// clone the file map, as these guys want to remove themselves on close.
Map<Closeable,Exception> m = new IdentityHashMap<Closeable,Exception>(openFileHandles);
- for (Closeable f : m.keySet())
+ for (Closeable f : m.keySet()) {
try {
f.close();
} catch (Exception ignored) {}
+ }
while(it.hasNext()) {
String name = it.next();
int damage = randomState.nextInt(5);
String action = null;
+
if (damage == 0) {
action = "deleted";
deleteFile(name, true);
@@ -449,7 +455,7 @@ public class MockDirectoryWrapper extend
// throttling REALLY slows down tests, so don't do it very often for SOMETIMES.
if (throttling == Throttling.ALWAYS ||
- (throttling == Throttling.SOMETIMES && randomState.nextInt(50) == 0)) {
+ (throttling == Throttling.SOMETIMES && rateLimiter == null && randomState.nextInt(50) == 0)) {
if (LuceneTestCase.VERBOSE) {
System.out.println("MockDirectoryWrapper: throttling indexOutput");
}
@@ -497,7 +503,23 @@ public class MockDirectoryWrapper extend
throw fillOpenTrace(new IOException("MockDirectoryWrapper: file \"" + name + "\" is still open for writing"), name, false);
}
- IndexInput ii = new MockIndexInputWrapper(this, name, delegate.openInput(name, LuceneTestCase.newIOContext(randomState, context)));
+ IndexInput delegateInput = delegate.openInput(name, LuceneTestCase.newIOContext(randomState, context));
+
+ final IndexInput ii;
+ int randomInt = randomState.nextInt(500);
+ if (randomInt == 0) {
+ if (LuceneTestCase.VERBOSE) {
+ System.out.println("MockDirectoryWrapper: using SlowClosingMockIndexInputWrapper for file " + name);
+ }
+ ii = new SlowClosingMockIndexInputWrapper(this, name, delegateInput);
+ } else if (randomInt == 1) {
+ if (LuceneTestCase.VERBOSE) {
+ System.out.println("MockDirectoryWrapper: using SlowOpeningMockIndexInputWrapper for file " + name);
+ }
+ ii = new SlowOpeningMockIndexInputWrapper(this, name, delegateInput);
+ } else {
+ ii = new MockIndexInputWrapper(this, name, delegateInput);
+ }
addFileHandle(ii, name, Handle.Input);
return ii;
}
@@ -549,6 +571,9 @@ public class MockDirectoryWrapper extend
@Override
public synchronized void close() throws IOException {
+ // files that we tried to delete, but couldn't because readers were open.
+ // all that matters is that we tried! (they will eventually go away)
+ Set<String> pendingDeletions = new HashSet<String>(openFilesDeleted);
maybeYield();
if (openFiles == null) {
openFiles = new HashMap<String,Integer>();
@@ -579,17 +604,98 @@ public class MockDirectoryWrapper extend
}
_TestUtil.checkIndex(this, getCrossCheckTermVectorsOnClose());
+ // TODO: factor this out / share w/ TestIW.assertNoUnreferencedFiles
if (assertNoUnreferencedFilesOnClose) {
- // now look for unreferenced files:
- String[] startFiles = listAll();
- new IndexWriter(this, new IndexWriterConfig(LuceneTestCase.TEST_VERSION_CURRENT, null)).rollback();
- String[] endFiles = listAll();
+ // now look for unreferenced files: discount ones that we tried to delete but could not
+ Set<String> allFiles = new HashSet<String>(Arrays.asList(listAll()));
+ allFiles.removeAll(pendingDeletions);
+ String[] startFiles = allFiles.toArray(new String[0]);
+ IndexWriterConfig iwc = new IndexWriterConfig(LuceneTestCase.TEST_VERSION_CURRENT, null);
+ iwc.setIndexDeletionPolicy(NoDeletionPolicy.INSTANCE);
+ new IndexWriter(delegate, iwc).rollback();
+ String[] endFiles = delegate.listAll();
+
+ Set<String> startSet = new TreeSet<String>(Arrays.asList(startFiles));
+ Set<String> endSet = new TreeSet<String>(Arrays.asList(endFiles));
+
+ if (pendingDeletions.contains("segments.gen") && endSet.contains("segments.gen")) {
+ // this is possible if we hit an exception while writing segments.gen, we try to delete it
+ // and it ends out in pendingDeletions (but IFD wont remove this).
+ startSet.add("segments.gen");
+ if (LuceneTestCase.VERBOSE) {
+ System.out.println("MDW: Unreferenced check: Ignoring segments.gen that we could not delete.");
+ }
+ }
+
+ // its possible we cannot delete the segments_N on windows if someone has it open and
+ // maybe other files too, depending on timing. normally someone on windows wouldnt have
+ // an issue (IFD would nuke this stuff eventually), but we pass NoDeletionPolicy...
+ for (String file : pendingDeletions) {
+ if (file.startsWith("segments") && !file.equals("segments.gen") && endSet.contains(file)) {
+ startSet.add(file);
+ if (LuceneTestCase.VERBOSE) {
+ System.out.println("MDW: Unreferenced check: Ignoring segments file: " + file + " that we could not delete.");
+ }
+ SegmentInfos sis = new SegmentInfos();
+ try {
+ sis.read(delegate, file);
+ } catch (IOException ioe) {
+ // OK: likely some of the .si files were deleted
+ }
+
+ try {
+ Set<String> ghosts = new HashSet<String>(sis.files(delegate, false));
+ for (String s : ghosts) {
+ if (endSet.contains(s) && !startSet.contains(s)) {
+ assert pendingDeletions.contains(s);
+ if (LuceneTestCase.VERBOSE) {
+ System.out.println("MDW: Unreferenced check: Ignoring referenced file: " + s + " " +
+ "from " + file + " that we could not delete.");
+ }
+ startSet.add(s);
+ }
+ }
+ } catch (Throwable t) {
+ System.err.println("ERROR processing leftover segments file " + file + ":");
+ t.printStackTrace();
+ }
+ }
+ }
- Arrays.sort(startFiles);
- Arrays.sort(endFiles);
+ startFiles = startSet.toArray(new String[0]);
+ endFiles = endSet.toArray(new String[0]);
if (!Arrays.equals(startFiles, endFiles)) {
- assert false : "unreferenced files: before delete:\n " + Arrays.toString(startFiles) + "\n after delete:\n " + Arrays.toString(endFiles);
+ List<String> removed = new ArrayList<String>();
+ for(String fileName : startFiles) {
+ if (!endSet.contains(fileName)) {
+ removed.add(fileName);
+ }
+ }
+
+ List<String> added = new ArrayList<String>();
+ for(String fileName : endFiles) {
+ if (!startSet.contains(fileName)) {
+ added.add(fileName);
+ }
+ }
+
+ String extras;
+ if (removed.size() != 0) {
+ extras = "\n\nThese files were removed: " + removed;
+ } else {
+ extras = "";
+ }
+
+ if (added.size() != 0) {
+ extras += "\n\nThese files were added (waaaaaaaaaat!): " + added;
+ }
+
+ if (pendingDeletions.size() != 0) {
+ extras += "\n\nThese files we had previously tried to delete, but couldn't: " + pendingDeletions;
+ }
+
+ assert false : "unreferenced files: before delete:\n " + Arrays.toString(startFiles) + "\n after delete:\n " + Arrays.toString(endFiles) + extras;
}
DirectoryReader ir1 = DirectoryReader.open(this);
@@ -612,7 +718,6 @@ public class MockDirectoryWrapper extend
if (v != null) {
if (v.intValue() == 1) {
openFiles.remove(name);
- openFilesDeleted.remove(name);
} else {
v = Integer.valueOf(v.intValue()-1);
openFiles.put(name, v);
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java Thu Oct 25 13:10:25 2012
@@ -78,7 +78,7 @@ public class MockIndexOutputWrapper exte
long freeSpace = dir.maxSize == 0 ? 0 : dir.maxSize - dir.sizeInBytes();
long realUsage = 0;
- if (dir.rateLimiter != null && len >= 10) {
+ if (dir.rateLimiter != null && len >= 1000) {
dir.rateLimiter.pause(len);
}
@@ -140,11 +140,6 @@ public class MockIndexOutputWrapper exte
}
@Override
- public void seek(long pos) throws IOException {
- delegate.seek(pos);
- }
-
- @Override
public long length() throws IOException {
return delegate.length();
}
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Thu Oct 25 13:10:25 2012
@@ -763,7 +763,6 @@ public abstract class LuceneTestCase ext
} else {
c.setMergePolicy(newLogMergePolicy());
}
-
c.setReaderPooling(r.nextBoolean());
c.setReaderTermsIndexDivisor(_TestUtil.nextInt(r, 1, 4));
return c;
@@ -948,6 +947,7 @@ public abstract class LuceneTestCase ext
if (rarely(random)) {
directory = new NRTCachingDirectory(directory, random.nextDouble(), random.nextDouble());
}
+
if (bare) {
BaseDirectoryWrapper base = new BaseDirectoryWrapper(directory);
closeAfterSuite(new CloseableDirectory(base, suiteFailureMarker));
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/QuickPatchThreadsFilter.java Thu Oct 25 13:10:25 2012
@@ -21,26 +21,10 @@ import com.carrotsearch.randomizedtestin
/**
* Last minute patches.
- * TODO: remove when integrated in system filters in rr.
*/
public class QuickPatchThreadsFilter implements ThreadFilter {
@Override
public boolean reject(Thread t) {
- // MacOS system thread.
- if (t.getName().equals("AWT-AppKit")) {
- return true;
- }
-
- // J9 memory pool thread.
- if (t.getName().equals("MemoryPoolMXBean notification dispatcher")) {
- return true;
- }
-
- // forked process reaper on Unixish systems
- if (t.getName().equals("process reaper")) {
- return true;
- }
-
return false;
}
}
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java Thu Oct 25 13:10:25 2012
@@ -29,9 +29,11 @@ import java.util.TimeZone;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.PostingsFormat;
-import org.apache.lucene.codecs.appending.AppendingCodec;
import org.apache.lucene.codecs.asserting.AssertingCodec;
+import org.apache.lucene.codecs.compressing.CompressingCodec;
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.codecs.lucene40.Lucene40RWPostingsFormat;
+import org.apache.lucene.codecs.lucene41.Lucene41Codec;
import org.apache.lucene.codecs.mockrandom.MockRandomPostingsFormat;
import org.apache.lucene.codecs.simpletext.SimpleTextCodec;
import org.apache.lucene.index.RandomCodec;
@@ -129,26 +131,23 @@ final class TestRuleSetupAndRestoreClass
avoidCodecs.addAll(Arrays.asList(a.value()));
}
- PREFLEX_IMPERSONATION_IS_ACTIVE = false;
savedCodec = Codec.getDefault();
int randomVal = random.nextInt(10);
- /* note: re-enable this if we make a 4.x impersonator
- if ("Lucene3x".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) &&
+ if ("Lucene40".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) &&
"random".equals(TEST_POSTINGSFORMAT) &&
randomVal < 2 &&
- !shouldAvoidCodec("Lucene3x"))) { // preflex-only setup
- codec = Codec.forName("Lucene3x");
- assert (codec instanceof PreFlexRWCodec) : "fix your classpath to have tests-framework.jar before lucene-core.jar";
- PREFLEX_IMPERSONATION_IS_ACTIVE = true;
- } else */ if (!"random".equals(TEST_POSTINGSFORMAT)) {
+ !shouldAvoidCodec("Lucene40"))) {
+ codec = Codec.forName("Lucene40");
+ assert (PostingsFormat.forName("Lucene40") instanceof Lucene40RWPostingsFormat) : "fix your classpath to have tests-framework.jar before lucene-core.jar";
+ } else if (!"random".equals(TEST_POSTINGSFORMAT)) {
final PostingsFormat format;
if ("MockRandom".equals(TEST_POSTINGSFORMAT)) {
format = new MockRandomPostingsFormat(random);
} else {
format = PostingsFormat.forName(TEST_POSTINGSFORMAT);
}
- codec = new Lucene40Codec() {
+ codec = new Lucene41Codec() {
@Override
public PostingsFormat getPostingsFormatForField(String field) {
return format;
@@ -161,10 +160,10 @@ final class TestRuleSetupAndRestoreClass
};
} else if ("SimpleText".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) && randomVal == 9 && !shouldAvoidCodec("SimpleText"))) {
codec = new SimpleTextCodec();
- } else if ("Appending".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) && randomVal == 8 && !shouldAvoidCodec("Appending"))) {
- codec = new AppendingCodec();
} else if ("Asserting".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) && randomVal == 7 && !shouldAvoidCodec("Asserting"))) {
codec = new AssertingCodec();
+ } else if ("Compressing".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) && randomVal == 6 && !shouldAvoidCodec("Compressing"))) {
+ codec = CompressingCodec.randomInstance(random);
} else if (!"random".equals(TEST_CODEC)) {
codec = Codec.forName(TEST_CODEC);
} else if ("random".equals(TEST_POSTINGSFORMAT)) {
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/ThrottledIndexOutput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/ThrottledIndexOutput.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/ThrottledIndexOutput.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/ThrottledIndexOutput.java Thu Oct 25 13:10:25 2012
@@ -89,12 +89,6 @@ public class ThrottledIndexOutput extend
}
@Override
- public void seek(long pos) throws IOException {
- sleep(seekDelayMillis);
- delegate.seek(pos);
- }
-
- @Override
public long length() throws IOException {
return delegate.length();
}
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java Thu Oct 25 13:10:25 2012
@@ -44,7 +44,7 @@ import java.util.zip.ZipFile;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.PostingsFormat;
-import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.codecs.lucene41.Lucene41Codec;
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
import org.apache.lucene.document.ByteDocValuesField;
import org.apache.lucene.document.DerefBytesDocValuesField;
@@ -651,7 +651,7 @@ public class _TestUtil {
if (LuceneTestCase.VERBOSE) {
System.out.println("forcing postings format to:" + format);
}
- return new Lucene40Codec() {
+ return new Lucene41Codec() {
@Override
public PostingsFormat getPostingsFormatForField(String field) {
return format;
@@ -662,7 +662,11 @@ public class _TestUtil {
// TODO: generalize all 'test-checks-for-crazy-codecs' to
// annotations (LUCENE-3489)
public static String getPostingsFormat(String field) {
- PostingsFormat p = Codec.getDefault().postingsFormat();
+ return getPostingsFormat(Codec.getDefault(), field);
+ }
+
+ public static String getPostingsFormat(Codec codec, String field) {
+ PostingsFormat p = codec.postingsFormat();
if (p instanceof PerFieldPostingsFormat) {
return ((PerFieldPostingsFormat)p).getPostingsFormatForField(field).getName();
} else {
@@ -1007,4 +1011,53 @@ public class _TestUtil {
}
}
+ /**
+ * Returns a random string in the specified length range consisting
+ * entirely of whitespace characters
+ * @see #WHITESPACE_CHARACTERS
+ */
+ public static String randomWhitespace(Random r, int minLength, int maxLength) {
+ final int end = nextInt(r, minLength, maxLength);
+ StringBuilder out = new StringBuilder();
+ for (int i = 0; i < end; i++) {
+ int offset = nextInt(r, 0, WHITESPACE_CHARACTERS.length-1);
+ char c = WHITESPACE_CHARACTERS[offset];
+ // sanity check
+ Assert.assertTrue("Not really whitespace? (@"+offset+"): " + c, Character.isWhitespace(c));
+ out.append(c);
+ }
+ return out.toString();
+ }
+
+ /** List of characters that match {@link Character#isWhitespace} */
+ public static final char[] WHITESPACE_CHARACTERS = new char[] {
+ // :TODO: is this list exhaustive?
+ '\u0009',
+ '\n',
+ '\u000B',
+ '\u000C',
+ '\r',
+ '\u001C',
+ '\u001D',
+ '\u001E',
+ '\u001F',
+ '\u0020',
+ // '\u0085', faild sanity check?
+ '\u1680',
+ '\u180E',
+ '\u2000',
+ '\u2001',
+ '\u2002',
+ '\u2003',
+ '\u2004',
+ '\u2005',
+ '\u2006',
+ '\u2008',
+ '\u2009',
+ '\u200A',
+ '\u2028',
+ '\u2029',
+ '\u205F',
+ '\u3000',
+ };
}
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/resources/META-INF/services/org.apache.lucene.codecs.Codec
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/resources/META-INF/services/org.apache.lucene.codecs.Codec?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/resources/META-INF/services/org.apache.lucene.codecs.Codec (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/resources/META-INF/services/org.apache.lucene.codecs.Codec Thu Oct 25 13:10:25 2012
@@ -14,3 +14,4 @@
# limitations under the License.
org.apache.lucene.codecs.asserting.AssertingCodec
+org.apache.lucene.codecs.compressing.CompressingCodec
Modified: lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/resources/META-INF/services/org.apache.lucene.codecs.PostingsFormat
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/resources/META-INF/services/org.apache.lucene.codecs.PostingsFormat?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/resources/META-INF/services/org.apache.lucene.codecs.PostingsFormat (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/test-framework/src/resources/META-INF/services/org.apache.lucene.codecs.PostingsFormat Thu Oct 25 13:10:25 2012
@@ -19,7 +19,7 @@ org.apache.lucene.codecs.mockrandom.Mock
org.apache.lucene.codecs.mocksep.MockSepPostingsFormat
org.apache.lucene.codecs.nestedpulsing.NestedPulsingPostingsFormat
org.apache.lucene.codecs.ramonly.RAMOnlyPostingsFormat
-org.apache.lucene.codecs.lucene40ords.Lucene40WithOrds
-org.apache.lucene.codecs.bloom.TestBloomFilteredLucene40Postings
+org.apache.lucene.codecs.lucene41ords.Lucene41WithOrds
+org.apache.lucene.codecs.bloom.TestBloomFilteredLucene41Postings
org.apache.lucene.codecs.asserting.AssertingPostingsFormat
-
+org.apache.lucene.codecs.lucene40.Lucene40RWPostingsFormat
Modified: lucene/dev/branches/LUCENE-2878/lucene/tools/junit4/cached-timehints.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/tools/junit4/cached-timehints.txt?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/tools/junit4/cached-timehints.txt (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/tools/junit4/cached-timehints.txt Thu Oct 25 13:10:25 2012
@@ -561,7 +561,7 @@ org.apache.lucene.spatial.prefix.TestRec
org.apache.lucene.spatial.prefix.TestSpatialPrefixField=36,285,194,52,200,213,199,280,201,233,195,81,202,289,209,35,249,225
org.apache.lucene.spatial.prefix.TestTermQueryPrefixGridStrategy=381,94,60,568,93,81,60,98,77,94,262,506,127,82,82,422,84,108
org.apache.lucene.spatial.prefix.tree.SpatialPrefixTreeTest=239,52,50,201,72,41,59,56,58,50,75,243,50,58,75,285,66,59
-org.apache.lucene.spatial.vector.TestTwoDoublesStrategy=3717,3129,2399,2794,3135,3154,2813,3657,2500,3682,3621,3363,3430,2567,3481,2450,3663,3450
+org.apache.lucene.spatial.vector.TestPointVectorStrategy=3717,3129,2399,2794,3135,3154,2813,3657,2500,3682,3621,3363,3430,2567,3481,2450,3663,3450
org.apache.lucene.store.TestBufferedIndexInput=1663,1777,1692,2301,2365,1896,2247,3707,1837,2544,1663,1823,2109,2229,1991,2361,1768,2452
org.apache.lucene.store.TestByteArrayDataInput=29,52,205,56,65,39,49,23,57,40,48,38,29,33,56,29,56,31
org.apache.lucene.store.TestCopyBytes=265,380,414,338,340,339,428,647,315,399,291,232,398,468,730,1265,514,323
Modified: lucene/dev/branches/LUCENE-2878/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/CHANGES.txt?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/CHANGES.txt (original)
+++ lucene/dev/branches/LUCENE-2878/solr/CHANGES.txt Thu Oct 25 13:10:25 2012
@@ -24,6 +24,101 @@ $Id$
(No changes)
+================== 4.1.0 ==================
+
+Detailed Change List
+----------------------
+
+New Features
+----------------------
+
+* SOLR-2255: Enhanced pivot faceting to use local-params in the same way that
+ regular field value faceting can. This means support for excluding a filter
+ query, using a different output key, and specifying 'threads' to do
+ facet.method=fcs concurrently. PivotFacetHelper now extends SimpleFacet and
+ the getFacetImplementation() extension hook was removed. (dsmiley)
+
+* SOLR-3897: A highlighter parameter "hl.preserveMulti" to return all of the
+ values of a multiValued field in their original order when highlighting.
+ (Joel Bernstein via yonik)
+
+* SOLR-3929: Support configuring IndexWriter max thread count in solrconfig.
+ (phunt via Mark Miller)
+
+* SOLR-3906: Add support for AnalyzingSuggester (LUCENE-3842), where the
+ underlying analyzed form used for suggestions is separate from the returned
+ text. (Robert Muir)
+
+Optimizations
+----------------------
+
+* SOLR-3788: Admin Cores UI should redirect to newly created core details
+ (steffkes)
+
+* SOLR-3895: XML and XSLT UpdateRequestHandler should not try to resolve
+ external entities. This improves speed of loading e.g. XSL-transformed
+ XHTML documents. (Martin Herfurt, uschindler, hossman)
+
+* SOLR-3614: Fix XML parsing in XPathEntityProcessor to correctly expand
+ named entities, but ignore external entities. (uschindler, hossman)
+
+* SOLR-3734: Improve Schema-Browser Handling for CopyField using
+ dynamicField's (steffkes)
+
+* SOLR-3941: The "commitOnLeader" part of distributed recovery can use
+ openSearcher=false. (Tomas Fernandez Lobbe via Mark Miller)
+
+Bug Fixes
+----------------------
+
+* SOLR-3560: Handle different types of Exception Messages for Logging UI
+ (steffkes)
+
+* SOLR-3637: Commit Status at Core-Admin UI is always false (steffkes)
+
+* SOLR-3917: Partial State on Schema-Browser UI is not defined for Dynamic
+ Fields & Types (steffkes)
+
+* SOLR-3939: Consider a sync attempt from leader to replica that fails due
+ to 404 a success. (Mark Miller, Joel Bernstein)
+
+* SOLR-3940: Rejoining the leader election incorrectly triggers the code path
+ for a fresh cluster start rather than fail over. (Mark Miller)
+
+* SOLR-3961: Fixed error using LimitTokenCountFilterFactory
+ (Jack Krupansky, hossman)
+
+* SOLR-3933: Distributed commits are not guaranteed to be ordered within a
+ request. (Mark Miller)
+
+* SOLR-3939: An empty or just replicated index cannot become the leader of a
+ shard after a leader goes down. (Joel Bernstein, yonik, Mark Miller)
+
+* SOLR-3971: A collection that is created with numShards=1 turns into a
+ numShards=2 collection after starting up a second core and not specifying
+ numShards. (Mark Miller)
+
+* SOLR-3988: Fixed SolrTestCaseJ4.adoc(SolrInputDocument) to respect
+ field and document boosts (hossman)
+
+* SOLR-3981: Fixed bug that resulted in document boosts being compounded in
+ <copyField/> destination fields. (hossman)
+
+Other Changes
+----------------------
+
+* SOLR-3899: SolrCore should not log at warning level when the index directory
+ changes - it's an info event. (Tobias Bergman, Mark Miller)
+
+* SOLR-3861: Refactor SolrCoreState so that it's managed by SolrCore.
+ (Mark Miller, hossman)
+
+* SOLR-3966: Eliminate superfluous warning from LanguageIdentifierUpdateProcessor
+ (Markus Jelsma via hossman)
+
+* SOLR-3932: SolrCmdDistributorTest either takes 3 seconds or 3 minutes.
+ (yonik, Mark Miller)
+
================== 4.0.0 ==================
Versions of Major Components
@@ -167,6 +262,7 @@ Optimizations
* SOLR-3709: Cache the url list created from the ClusterState in CloudSolrServer
on each request. (Mark Miller)
+
Bug Fixes
----------------------
@@ -333,6 +429,28 @@ Bug Fixes
* SOLR-3783: Fixed Pivot Faceting to work with facet.missing=true (hossman)
+* SOLR-3869: A PeerSync attempt to it's replicas by a candidate leader should
+ not fail on o.a.http.conn.ConnectTimeoutException. (Mark Miller)
+
+* SOLR-3875: Fixed index boosts on multi-valued fields when docBoost is used
+ (hossman)
+
+* SOLR-3878: Exception when using open-ended range query with CurrencyField (janhoy)
+
+* SOLR-3891: CacheValue in CachingDirectoryFactory cannot be used outside of
+ solr.core package. (phunt via Mark Miller)
+
+* SOLR-3892: Inconsistent locking when accessing cache in CachingDirectoryFactory
+ from RAMDirectoryFactory and MockDirectoryFactory. (phunt via Mark Miller)
+
+* SOLR-3883: Distributed indexing forwards non-applicable request params.
+ (Dan Sutton, Per Steffensen, yonik, Mark Miller)
+
+* SOLR-3903: Fixed MissingFormatArgumentException in ConcurrentUpdateSolrServer
+ (hossman)
+
+* SOLR-3916: Fixed whitespace bug in parsing the fl param (hossman)
+
Other Changes
----------------------
@@ -385,6 +503,12 @@ Other Changes
* SOLR-3815: SolrCloud - Add properties such as "range" to shards, which changes
the clusterstate.json and puts the shard replicas under "replicas". (yonik)
+* SOLR-3871: SyncStrategy should use an executor for the threads it creates to
+ request recoveries. (Mark Miller)
+
+* SOLR-3870: SyncStrategy should have a close so it can abort earlier on
+ shutdown. (Mark Miller)
+
================== 4.0.0-BETA ===================
Modified: lucene/dev/branches/LUCENE-2878/solr/NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/NOTICE.txt?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/NOTICE.txt (original)
+++ lucene/dev/branches/LUCENE-2878/solr/NOTICE.txt Thu Oct 25 13:10:25 2012
@@ -9,7 +9,6 @@ The Apache Software Foundation (http://w
Includes software from other Apache Software Foundation projects,
including, but not limited to:
- Apache Lucene Java
- - Apache Tomcat (servlet-api-2.4)
- Apache Commons
- Apache Geronimo (stax API)
@@ -152,6 +151,9 @@ LGPL and Creative Commons ShareAlike.
Morfologic includes data from BSD-licensed dictionary of Polish (SGJP)
(http://sgjp.pl/morfeusz/)
+Servlet-api.jar is under the CDDL license, the original source
+code for this can be found at http://www.eclipse.org/jetty/downloads.php
+
===========================================================================
Kuromoji Japanese Morphological Analyzer - Apache Lucene Integration
===========================================================================
@@ -256,7 +258,7 @@ This product includes software developed
(specifically, Jetty, the bundled servlet container in example),
available under the Apache 2 License.
-The bundled servlet-api jar is under the CDDL license, the original source
+Servlet-api.jar is under the CDDL license, the original source
code for this can be found at http://www.eclipse.org/jetty/downloads.php
=========================================================================
Modified: lucene/dev/branches/LUCENE-2878/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/build.xml?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/build.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/build.xml Thu Oct 25 13:10:25 2012
@@ -131,19 +131,20 @@
depends="compile-core, compile-contrib"/>
<target name="test" description="Validate, then run core, solrj, and contrib unit tests."
depends="test-core, test-contrib"/>
+ <!-- "-clover.load" is *not* a useless dependency. do not remove -->
<target name="test-core" description="Runs the core and solrj unit tests."
- depends="test-solr-core, test-solrj"/>
+ depends="-clover.load, test-solr-core, test-solrj"/>
<target name="pitest" description="Validate, then run core, solrj, and contrib unit tests."
depends="pitest-core, pitest-contrib"/>
<target name="compile-test" description="Compile unit tests."
depends="compile-solr-test-framework, compile-test-solr-core, compile-test-solrj, compile-test-contrib"/>
<target name="javadocs" description="Calls javadocs-all, javadocs-solrj, and javadocs-test-framework"
- depends="javadocs-solr-core,javadocs-solrj,javadocs-test-framework,javadocs-contrib"/>
+ depends="define-lucene-javadoc-url,javadocs-solr-core,javadocs-solrj,javadocs-test-framework,javadocs-contrib"/>
<target name="documentation" description="Generate all documentation"
depends="javadocs,changes-to-html,process-webpages"/>
<target name="compile-core" depends="compile-solr-core" unless="solr.core.compiled"/>
- <target name="process-webpages" depends="define-lucene-javadoc-url"> <!--depends="resolve-pegdown">-->
+ <target name="process-webpages" depends="define-lucene-javadoc-url,resolve-groovy,resolve-pegdown">
<makeurl property="process-webpages.buildfiles" separator="|">
<fileset dir="." includes="core/build.xml,test-framework/build.xml,solrj/build.xml,contrib/**/build.xml"/>
</makeurl>
@@ -162,12 +163,10 @@
<param name="luceneJavadocUrl" expression="${lucene.javadoc.url}"/>
</xslt>
- <!--nothing at the moment:
<pegdown todir="${javadoc.dir}">
- <fileset dir="." includes="MIGRATE.txt,JRE_VERSION_MIGRATION.txt"/>
+ <fileset dir="." includes="SYSTEM_REQUIREMENTS.txt"/>
<globmapper from="*.txt" to="*.html"/>
</pegdown>
- -->
<copy todir="${javadoc.dir}">
<fileset dir="site/html" includes="**/*"/>
@@ -369,8 +368,9 @@
<!-- Exclude clover license files incompatible with the ASL -->
<delete dir="${svn.export.dir}/lucene/tools/clover"/>
- <build-changes changes.src.dir="${svn.export.dir}/lucene/site/changes"
- changes.target.dir="${svn.export.dir}/solr/docs/changes"/>
+ <build-changes changes.src.file="${svn.export.dir}/solr/CHANGES.txt"
+ changes.target.dir="${svn.export.dir}/solr/docs/changes"
+ changes.product="SOLR"/>
<tar destfile="${source.package.file}" compression="gzip" longfile="gnu">
<tarfileset dir="${svn.export.dir}"
@@ -437,8 +437,8 @@
<tar destfile="${package.dir}/${fullnamever}.tgz" compression="gzip" longfile="gnu">
<tarfileset dir="."
prefix="${fullnamever}"
- includes="LICENSE.txt NOTICE.txt CHANGES.txt README.txt example/**
- client/README.txt client/ruby/solr-ruby/**
+ includes="LICENSE.txt NOTICE.txt CHANGES.txt README.txt SYSTEM_REQUIREMENTS.txt
+ example/** client/README.txt client/ruby/solr-ruby/**
contrib/**/lib/** contrib/**/README.txt
licenses/**"
excludes="lib/README.committers.txt **/data/ **/logs/*
@@ -498,17 +498,13 @@
</target>
<target name="changes-to-html">
- <build-changes changes.src.dir="${changes.src.dir}" changes.target.dir="${changes.target.dir}" />
+ <build-changes changes.product="SOLR"/>
</target>
<target name="sign-artifacts">
<sign-artifacts-macro artifacts.dir="${package.dir}"/>
</target>
- <target name="javadocs-dep">
- <!-- NOOP -->
- </target>
-
<target name="resolve" depends="resolve-example">
<sequential>
<ant dir="core" target="resolve" inheritall="false">
@@ -524,14 +520,35 @@
</sequential>
</target>
+ <target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint,-documentation-lint-unsupported"
+ description="Validates the generated documentation (HTML errors, broken links,...)"/>
+
<!-- TODO: does solr have any other docs we should check? -->
<!-- TODO: also integrate checkJavaDocs.py, which does more checks -->
- <target name="documentation-lint" depends="documentation">
+ <target name="-documentation-lint" if="documentation-lint.supported" depends="documentation">
+ <jtidy-macro>
+ <!-- NOTE: must currently exclude deprecated-list due to a javadocs bug (as of 1.7.0_09)
+ javadocs generates invalid XML if you deprecate a method that takes a parameter
+ with a generic type -->
+ <fileset dir="build/docs" includes="**/*.html" excludes="**/deprecated-list.html"/>
+ </jtidy-macro>
+ <echo message="Checking for broken links..."/>
<check-broken-links dir="${javadoc.dir}"/>
+ <echo message="Checking for malformed docs..."/>
<!-- TODO: add missing package.htmls and bump this to level=package -->
<check-missing-javadocs dir="${javadoc.dir}" level="none"/>
</target>
+ <target name="-ecj-javadoc-lint" depends="documentation,compile-solr-test-framework,-ecj-resolve">
+ <subant target="-ecj-javadoc-lint" failonerror="true" inheritall="false">
+ <propertyset refid="uptodate.and.compiled.properties"/>
+ <fileset dir="core" includes="build.xml"/>
+ <fileset dir="solrj" includes="build.xml"/>
+ <fileset dir="test-framework" includes="build.xml"/>
+ </subant>
+ <contrib-crawl target="-ecj-javadoc-lint"/>
+ </target>
+
<!-- install-maven-tasks is *not* a useless dependency. do not remove -->
<target name="generate-maven-artifacts" depends="install-maven-tasks">
<sequential>
@@ -570,99 +587,7 @@
<!-- ========================================================================= -->
<!-- ========================= COMMITTERS' HELPERS =========================== -->
<!-- ========================================================================= -->
-
- <target name="stub-factories" depends="dist-core,lucene-jars-to-solr"
- description="Generates stub factories as needed">
-
- <path id="stub.jars">
- <!-- this needs to be a list of all jars that might contain
- classes we want to build factories for
- -->
- <fileset dir="${lucene-libs}">
- <include name="*.jar"/>
- </fileset>
- <fileset dir="${dist}">
- <include name="*.jar"/>
- <exclude name="*solrj*.jar"/>
- </fileset>
- </path>
- <pathconvert property="jar.list" pathsep=" " refid="stub.jars" />
- <path id="missing.factories.classpath">
- <pathelement path="${common.dir}/contrib/queries/lib/jakarta-regexp-1.4.jar"/>
- <path refid="test.classpath"/>
- </path>
- <property name="stub.list" value="${dest}/need-stub-factories.txt" />
- <java fork="false"
- classname="org.apache.solr.util.SuggestMissingFactories"
- logError="true"
- failonerror="true"
- classpathref="missing.factories.classpath"
- output="${stub.list}">
- <arg line="${jar.list}" />
- </java>
- <fail unless="stub.src.path">...
-
- This task requires that the property 'stub.src.path' be set.
-
- It must contain a "path" listing directories containing source
- files that this task should use when looking for classes that
- need factories created, the format is platform specific --
- typically it is colon seperated in Unix, semi-colon seperated
- on windows, ie:
-
- ant stub-factories -Dstub.src.path="core/src:../lucene/contrib:../lucene/core/src/java:../lucene/analysis"
-
- FYI: The file ${stub.list} contains a list of classes
- that seem to need stub factories. (if java files can be found to
- use as guides for creating them).
- </fail>
-
- <pathconvert pathsep=" " property="stub.src.dirs">
- <path>
- <pathelement path="${stub.src.path}"/>
- </path>
- </pathconvert>
- <exec executable="perl"
- dir="core/src/java/org/apache/solr/analysis/"
- failonerror="true">
- <arg value="${common-solr.dir}/dev-tools/stub-analysis-factory-maker.pl"/>
- <redirector input="${stub.list}">
- <!-- place to put special case classes we want to ignore -->
- <inputfilterchain>
- <linecontainsregexp negate="true">
- <!-- only for internal Solr highlighting purposes -->
- <regexp pattern="TokenOrderingFilter"/>
- </linecontainsregexp>
- <linecontainsregexp negate="true">
- <!-- no way to leverage this in Solr -->
- <regexp pattern="CachingTokenFilter"/>
- </linecontainsregexp>
- <linecontainsregexp negate="true">
- <!-- no way to leverage this in Solr -->
- <regexp pattern="HyphenationCompoundWordTokenFilter"/>
- </linecontainsregexp>
- <linecontainsregexp negate="true">
- <!-- no way to leverage these in Solr (yet) -->
- <regexp pattern="Sink|Tee"/>
- </linecontainsregexp>
- <linecontainsregexp negate="true">
- <!-- Solr already has a different impl for this -->
- <regexp pattern="SynonymTokenFilter"/>
- </linecontainsregexp>
- <linecontainsregexp negate="true">
- <!-- solr and lucene both have one? ? ? ? -->
- <regexp pattern="LengthFilter"/>
- </linecontainsregexp>
- <linecontainsregexp negate="true">
- <!-- solr provides it's own SnowballPorterFilter variant -->
- <regexp pattern="SnowballFilter"/>
- </linecontainsregexp>
- </inputfilterchain>
- </redirector>
- <arg line="${stub.src.dirs}"/>
- </exec>
- </target>
-
+
<property name="analysis-common.res.dir" value="../lucene/analysis/common/src/resources/org/apache/lucene/analysis"/>
<property name="analysis-kuromoji.res.dir" value="../lucene/analysis/kuromoji/src/resources/org/apache/lucene/analysis"/>
<property name="analysis.conf.dest" value="${example}/solr/conf/lang"/>
@@ -760,17 +685,7 @@
tofile="${analysis.conf.dest}/stopwords_tr.txt"/>
</target>
- <!-- TODO: in the future, we don't need to actually put
- jars in the lib/ folders, but can just put in classpath.
- only packaging tasks really need that (and could do it
- under build/ directories) -->
- <target name="clean-jars" description="Clean local jars">
- <delete>
- <fileset dir="." includes="**/*.jar"/>
- </delete>
- </target>
-
- <target name="jar-checksums" depends="clean-jars,resolve">
+ <target name="jar-checksums" depends="resolve">
<jar-checksum-macro srcdir="${common-solr.dir}" dstdir="${common-solr.dir}/licenses"/>
</target>
Modified: lucene/dev/branches/LUCENE-2878/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/common-build.xml?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/common-build.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/common-build.xml Thu Oct 25 13:10:25 2012
@@ -275,17 +275,17 @@
</sequential>
</macrodef>
- <target name="define-lucene-javadoc-url" unless="lucene.javadoc.url">
- <script language="javascript"><![CDATA[
- var url, version = project.getProperty('version');
+ <target name="define-lucene-javadoc-url" depends="resolve-groovy" unless="lucene.javadoc.url">
+ <script language="groovy" classpathref="groovy.classpath"><![CDATA[
+ String url, version = project.getProperty('version');
if (version.contains('-SNAPSHOT')) {
- importClass(java.io.File);
url = new File(project.getProperty('common.dir'), 'build' + File.separator + 'docs').toURI().toASCIIString();
- if (!(/\/$/.test(url))) url += '/';
+ if (!(url =~ /\/$/)) url += '/';
} else {
version = version.replace('.', '_');
url = 'http://lucene.apache.org/core/' + version + '/';
}
+ self.log('Using the following URL to refer to Lucene Javadocs: ' + url);
project.setProperty('lucene.javadoc.url', url);
]]></script>
</target>
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/SearchClusteringEngine.java Thu Oct 25 13:10:25 2012
@@ -45,7 +45,6 @@ public abstract class SearchClusteringEn
* Returns the set of field names to load.
* Concrete classes can override this method if needed.
* Default implementation returns null, that is, all stored fields are loaded.
- * @param sreq
* @return set of field names to load
*/
protected Set<String> getFieldsToLoad(SolrQueryRequest sreq){
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler-extras/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler-extras/build.xml?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler-extras/build.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler-extras/build.xml Thu Oct 25 13:10:25 2012
@@ -89,6 +89,8 @@
</ant>
</target>
+ <target name="-ecj-javadoc-lint-tests" depends="compile-solr-dataimporthandler-tests,common.-ecj-javadoc-lint-tests"/>
+
<target name="compile-core" depends="compile-solr-dataimporthandler,resolve-extraction-libs,solr-contrib-build.compile-core"/>
<target name="compile-test" depends="compile-solr-dataimporthandler-tests, common-solr.compile-test"/>
</project>
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/Context.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/Context.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/Context.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/Context.java Thu Oct 25 13:10:25 2012
@@ -87,7 +87,7 @@ public abstract class Context {
/**
* Returns the VariableResolver used in this entity which can be used to
- * resolve the tokens in ${<namespce.name>}
+ * resolve the tokens in ${<namespce.name>}
*
* @return a VariableResolver instance
* @see org.apache.solr.handler.dataimport.VariableResolver
@@ -198,12 +198,10 @@ public abstract class Context {
public abstract String getScriptLanguage();
/**delete a document by id
- * @param id
*/
public abstract void deleteDoc(String id);
/**delete documents by query
- * @param query
*/
public abstract void deleteDocByQuery(String query);
@@ -214,7 +212,6 @@ public abstract class Context {
public abstract Object resolve(String var);
/** Resolve variables in a template
- * @param template
*
* @return The string w/ variables resolved
*/
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHCache.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHCache.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHCache.java Thu Oct 25 13:10:25 2012
@@ -68,8 +68,6 @@ public interface DIHCache extends Iterab
* documents will exist in the cache, as the cache allows duplicate keys. To
* update a key's documents, first call delete(Object key).
* </p>
- *
- * @param rec
*/
public void add(Map<String,Object> rec);
@@ -93,8 +91,6 @@ public interface DIHCache extends Iterab
* <p>
* Delete all documents associated with the given key
* </p>
- *
- * @param key
*/
public void delete(Object key);
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHWriter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHWriter.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHWriter.java Thu Oct 25 13:10:25 2012
@@ -31,7 +31,6 @@ public interface DIHWriter {
* If this writer supports transactions or commit points, then commit any changes,
* optionally optimizing the data for read/write performance
* </p>
- * @param optimize
*/
public void commit(boolean optimize);
@@ -53,7 +52,6 @@ public interface DIHWriter {
* <p>
* Delete from the writer's underlying data store based the passed-in writer-specific query. (Optional Operation)
* </p>
- * @param q
*/
public void deleteByQuery(String q);
@@ -68,7 +66,6 @@ public interface DIHWriter {
* <p>
* Delete from the writer's underlying data store based on the passed-in Primary Key
* </p>
- * @param key
*/
public void deleteDoc(Object key);
@@ -78,7 +75,6 @@ public interface DIHWriter {
* <p>
* Add a document to this writer's underlying data store.
* </p>
- * @param doc
* @return true on success, false on failure
*/
public boolean upload(SolrInputDocument doc);
@@ -89,7 +85,6 @@ public interface DIHWriter {
* <p>
* Provide context information for this writer. init() should be called before using the writer.
* </p>
- * @param context
*/
public void init(Context context) ;
@@ -98,7 +93,6 @@ public interface DIHWriter {
* <p>
* Specify the keys to be modified by a delta update (required by writers that can store duplicate keys)
* </p>
- * @param deltaKeys
*/
public void setDeltaKeys(Set<Map<String, Object>> deltaKeys) ;
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataSource.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataSource.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataSource.java Thu Oct 25 13:10:25 2012
@@ -46,9 +46,6 @@ public abstract class DataSource<T> {
* <p/>
* This is invoked by the <code>DataImporter</code> after creating an
* instance of this class.
- *
- * @param context
- * @param initProps
*/
public abstract void init(Context context, Properties initProps);
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/FieldReaderDataSource.java Thu Oct 25 13:10:25 2012
@@ -32,7 +32,7 @@ import java.util.Properties;
* <p/>
* The datasouce may be configured as follows
* <p/>
- * <datasource name="f1" type="FieldReaderDataSource" />
+ * <datasource name="f1" type="FieldReaderDataSource" />
* <p/>
* The enity which uses this datasource must keep the url value as the variable name url="field-name"
* <p/>
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/VariableResolver.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/VariableResolver.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/VariableResolver.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/VariableResolver.java Thu Oct 25 13:10:25 2012
@@ -46,7 +46,6 @@ public abstract class VariableResolver {
/**
* Given a String with place holders, replace them with the value tokens.
*
- * @param template
* @return the string with the placeholders replaced with their values
*/
public abstract String replaceTokens(String template);
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java Thu Oct 25 13:10:25 2012
@@ -17,6 +17,7 @@
package org.apache.solr.handler.dataimport;
import org.apache.solr.common.util.XMLErrorLogger;
+import org.apache.solr.util.EmptyEntityResolver;
import javax.xml.stream.XMLInputFactory;
import static javax.xml.stream.XMLStreamConstants.*;
import javax.xml.stream.XMLStreamException;
@@ -44,7 +45,7 @@ import org.slf4j.LoggerFactory;
* /a/b/c
* </pre>
* A record is a Map<String,Object> . The key is the provided name
- * and the value is a String or a List<String>
+ * and the value is a String or a List<String>
*
* This class is thread-safe for parsing xml. But adding fields is not
* thread-safe. The recommended usage is to addField() in one thread and
@@ -625,10 +626,22 @@ public class XPathRecordReader {
}
static XMLInputFactory factory = XMLInputFactory.newInstance();
- static{
- factory.setProperty(XMLInputFactory.IS_VALIDATING , Boolean.FALSE);
- factory.setProperty(XMLInputFactory.SUPPORT_DTD , Boolean.FALSE);
+ static {
+ EmptyEntityResolver.configureXMLInputFactory(factory);
factory.setXMLReporter(XMLLOG);
+ try {
+ // The java 1.6 bundled stax parser (sjsxp) does not currently have a thread-safe
+ // XMLInputFactory, as that implementation tries to cache and reuse the
+ // XMLStreamReader. Setting the parser-specific "reuse-instance" property to false
+ // prevents this.
+ // All other known open-source stax parsers (and the bea ref impl)
+ // have thread-safe factories.
+ factory.setProperty("reuse-instance", Boolean.FALSE);
+ } catch (IllegalArgumentException ex) {
+ // Other implementations will likely throw this exception since "reuse-instance"
+ // isimplementation specific.
+ LOG.debug("Unable to set the 'reuse-instance' property for the input chain: " + factory);
+ }
}
/**Implement this interface to stream records as and when one is found.
@@ -638,10 +651,10 @@ public class XPathRecordReader {
/**
* @param record The record map. The key is the field name as provided in
* the addField() methods. The value can be a single String (for single
- * valued fields) or a List<String> (for multiValued).
+ * valued fields) or a List<String> (for multiValued).
* @param xpath The forEach XPATH for which this record is being emitted
* If there is any change all parsing will be aborted and the Exception
- * is propogated up
+ * is propagated up
*/
public void handle(Map<String, Object> record, String xpath);
}
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java Thu Oct 25 13:10:25 2012
@@ -87,7 +87,11 @@ public class TestXPathEntityProcessor ex
break;
result.add(row);
}
- assertEquals(2, ((List)result.get(0).get("a")).size());
+ List l = (List)result.get(0).get("a");
+ assertEquals(3, l.size());
+ assertEquals("1", l.get(0));
+ assertEquals("2", l.get(1));
+ assertEquals("ü", l.get(2));
}
@Test
@@ -298,7 +302,7 @@ public class TestXPathEntityProcessor ex
+ "\t\t<price>9.90</price>\n"
+ "\t\t<year>1982</year>\n" + "\t</cd>\n" + "</catalog>\t";
- private static final String testXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><a>1</a><a>2</a></root>";
+ private static final String testXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE root [\n<!ENTITY uuml \"ü\" >\n]>\n<root><a>1</a><a>2</a><a>ü</a></root>";
private static final String testXmlFlatten = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><a>1<b>B</b>2</a></root>";
}
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java Thu Oct 25 13:10:25 2012
@@ -126,11 +126,6 @@ public class ExtractingDocumentLoader ex
doAdd(handler, templateAdd);
}
- /**
- * @param req
- * @param stream
- * @throws java.io.IOException
- */
@Override
public void load(SolrQueryRequest req, SolrQueryResponse rsp,
ContentStream stream, UpdateRequestProcessor processor) throws Exception {
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingParams.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingParams.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingParams.java Thu Oct 25 13:10:25 2012
@@ -159,7 +159,7 @@ public interface ExtractingParams {
* File format is Java properties format with one key=value per line.
* The key is evaluated as a regex against the file name, and the value is the password
* The rules are evaluated top-bottom, i.e. the first match will be used
- * If you want a fallback password to be always used, supply a .*=<defaultmypassword> at the end
+ * If you want a fallback password to be always used, supply a .*=<defaultmypassword> at the end
*/
public static final String PASSWORD_MAP_FILE = "passwordsFile";
}
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java Thu Oct 25 13:10:25 2012
@@ -40,9 +40,9 @@ import java.util.regex.Pattern;
/**
- * Identifies the language of a set of input fields.
+ * Identifies the language of a set of input fields.
* Also supports mapping of field names based
- * on detected language.
+ * on detected language.
* <p>
* See <a href="http://wiki.apache.org/solr/LanguageDetection">http://wiki.apache.org/solr/LanguageDetection</a>
* @since 3.5
@@ -76,7 +76,7 @@ public abstract class LanguageIdentifier
protected HashSet<String> allMapFieldsSet;
protected HashMap<String,String> lcMap;
protected IndexSchema schema;
-
+
// Regex patterns
protected final Pattern tikaSimilarityPattern = Pattern.compile(".*\\((.*?)\\)");
protected final Pattern langPattern = Pattern.compile("\\{lang\\}");
@@ -85,10 +85,10 @@ public abstract class LanguageIdentifier
SolrQueryResponse rsp, UpdateRequestProcessor next) {
super(next);
schema = req.getSchema();
-
+
initParams(req.getParams());
}
-
+
private void initParams(SolrParams params) {
if (params != null) {
// Document-centric langId params
@@ -129,7 +129,7 @@ public abstract class LanguageIdentifier
if(params.get(MAP_INDIVIDUAL_FL, "").length() > 0) {
mapIndividualFields = params.get(MAP_INDIVIDUAL_FL, "").split(",");
} else {
- mapIndividualFields = mapFields;
+ mapIndividualFields = mapFields;
}
mapIndividualFieldsSet = new HashSet<String>(Arrays.asList(mapIndividualFields));
// Compile a union of the lists of fields to map
@@ -137,7 +137,7 @@ public abstract class LanguageIdentifier
if(Arrays.equals(mapFields, mapIndividualFields)) {
allMapFieldsSet.addAll(mapIndividualFieldsSet);
}
-
+
// Language Code mapping
lcMap = new HashMap<String,String>();
if(params.get(MAP_LCMAP) != null) {
@@ -154,8 +154,8 @@ public abstract class LanguageIdentifier
mapPattern = Pattern.compile(params.get(MAP_PATTERN, MAP_PATTERN_DEFAULT));
mapReplaceStr = params.get(MAP_REPLACE, MAP_REPLACE_DEFAULT);
-
-
+
+
}
log.debug("LangId configured");
@@ -164,7 +164,7 @@ public abstract class LanguageIdentifier
throw new SolrException(ErrorCode.BAD_REQUEST,
"Missing or faulty configuration of LanguageIdentifierUpdateProcessor. Input fields must be specified as a comma separated list");
}
-
+
}
@Override
@@ -176,7 +176,7 @@ public abstract class LanguageIdentifier
}
super.processAdd(cmd);
}
-
+
/**
* This is the main, testable process method called from processAdd()
* @param doc the SolrInputDocument to work on
@@ -186,7 +186,7 @@ public abstract class LanguageIdentifier
String docLang = null;
HashSet<String> docLangs = new HashSet<String>();
String fallbackLang = getFallbackLang(doc, fallbackFields, fallbackValue);
-
+
if(langField == null || !doc.containsKey(langField) || (doc.containsKey(langField) && overwrite)) {
String allText = concatFields(doc, inputFields);
List<DetectedLanguage> languagelist = detectLanguage(allText);
@@ -209,7 +209,7 @@ public abstract class LanguageIdentifier
if(enableMapping) {
for (String fieldName : allMapFieldsSet) {
- if(doc.containsKey(fieldName)) {
+ if(doc.containsKey(fieldName)) {
String fieldLang;
if(mapIndividual && mapIndividualFieldsSet.contains(fieldName)) {
String text = (String) doc.getFieldValue(fieldName);
@@ -226,7 +226,7 @@ public abstract class LanguageIdentifier
log.warn("Unsuccessful field name mapping to {}, field does not exist, skipping mapping.", mappedOutputField, fieldName);
mappedOutputField = fieldName;
}
-
+
if (mappedOutputField != null) {
log.debug("Mapping field {} to {}", doc.getFieldValue(docIdField), fieldLang);
SolrInputField inField = doc.getField(fieldName);
@@ -239,17 +239,15 @@ public abstract class LanguageIdentifier
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Invalid output field mapping for "
+ fieldName + " field and language: " + fieldLang);
}
- } else {
- log.warn("Document {} does not contain input field {}. Skipping this field.", doc.getFieldValue(docIdField), fieldName);
}
}
}
-
+
// Set the languages field to an array of all detected languages
if(langsField != null && langsField.length() != 0) {
doc.setField(langsField, docLangs.toArray());
}
-
+
return doc;
}
@@ -260,7 +258,7 @@ public abstract class LanguageIdentifier
* @param fallbackValue a language code to use in case no fallbackFields are found
*/
private String getFallbackLang(SolrInputDocument doc, String[] fallbackFields, String fallbackValue) {
- String lang = null;
+ String lang = null;
for(String field : fallbackFields) {
if(doc.containsKey(field)) {
lang = (String) doc.getFieldValue(field);
@@ -288,13 +286,13 @@ public abstract class LanguageIdentifier
sb.append((String) doc.getFieldValue(fieldName));
sb.append(" ");
} else {
- log.warn("Field "+fieldName+" not a String value, not including in detection");
+ log.warn("Field "+fieldName+" not a String value, not including in detection");
}
}
}
return sb.toString();
}
-
+
/**
* Detects language(s) from a string.
* Classes wishing to implement their own language detection module should override this method.
@@ -304,7 +302,7 @@ public abstract class LanguageIdentifier
protected abstract List<DetectedLanguage> detectLanguage(String content);
/**
- * Chooses a language based on the list of candidates detected
+ * Chooses a language based on the list of candidates detected
* @param language language code as a string
* @param fallbackLang the language code to use as a fallback
* @return a string of the chosen language
@@ -316,7 +314,7 @@ public abstract class LanguageIdentifier
}
/**
- * Chooses a language based on the list of candidates detected
+ * Chooses a language based on the list of candidates detected
* @param languages a List of DetectedLanguages with certainty score
* @param fallbackLang the language code to use as a fallback
* @return a string of the chosen language
@@ -341,12 +339,12 @@ public abstract class LanguageIdentifier
langStr = fallbackLang;
}
}
-
+
if(langStr == null || langStr.length() == 0) {
log.warn("Language resolved to null or empty string. Fallback not configured?");
langStr = "";
}
-
+
return langStr;
}
@@ -363,7 +361,7 @@ public abstract class LanguageIdentifier
String lc = lcMap.containsKey(language) ? lcMap.get(language) : language;
String newFieldName = langPattern.matcher(mapPattern.matcher(currentField).replaceFirst(mapReplaceStr)).replaceFirst(lc);
log.debug("Doing mapping from "+currentField+" with language "+language+" to field "+newFieldName);
- return newFieldName;
+ return newFieldName;
}
/**
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/SolrUIMAConfiguration.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/SolrUIMAConfiguration.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/SolrUIMAConfiguration.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/SolrUIMAConfiguration.java Thu Oct 25 13:10:25 2012
@@ -26,19 +26,19 @@ import java.util.Map;
*/
public class SolrUIMAConfiguration {
- private String[] fieldsToAnalyze;
+ private final String[] fieldsToAnalyze;
- private boolean fieldsMerging;
+ private final boolean fieldsMerging;
- private Map<String, Map<String, MapField>> typesFeaturesFieldsMapping;
+ private final Map<String, Map<String, MapField>> typesFeaturesFieldsMapping;
- private String aePath;
+ private final String aePath;
- private Map<String, Object> runtimeParameters;
+ private final Map<String, Object> runtimeParameters;
- private boolean ignoreErrors;
+ private final boolean ignoreErrors;
- private String logField;
+ private final String logField;
SolrUIMAConfiguration(String aePath, String[] fieldsToAnalyze, boolean fieldsMerging,
Map<String, Map<String, MapField>> typesFeaturesFieldsMapping,
@@ -82,7 +82,8 @@ public class SolrUIMAConfiguration {
static final class MapField {
- private String fieldName, fieldNameFeature;
+ private String fieldName;
+ private final String fieldNameFeature;
private boolean prefix; // valid if dynamicField == true
// false: *_s, true: s_*
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/SolrUIMAConfigurationReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/SolrUIMAConfigurationReader.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/SolrUIMAConfigurationReader.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/SolrUIMAConfigurationReader.java Thu Oct 25 13:10:25 2012
@@ -32,7 +32,7 @@ import org.apache.solr.uima.processor.So
*/
public class SolrUIMAConfigurationReader {
- private NamedList<Object> args;
+ private final NamedList<Object> args;
public SolrUIMAConfigurationReader(NamedList<Object> args) {
this.args = args;
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java Thu Oct 25 13:10:25 2012
@@ -21,7 +21,6 @@ import java.util.Map;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField;
-import org.apache.solr.uima.processor.exception.FieldMappingException;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.Type;
@@ -39,9 +38,9 @@ public class UIMAToSolrMapper {
private final Logger log = LoggerFactory.getLogger(UIMAToSolrMapper.class);
- private SolrInputDocument document;
+ private final SolrInputDocument document;
- private JCas cas;
+ private final JCas cas;
public UIMAToSolrMapper(SolrInputDocument document, JCas cas) {
this.document = document;
@@ -52,7 +51,6 @@ public class UIMAToSolrMapper {
* map features of a certain UIMA type to corresponding Solr fields based on the mapping
*
* @param typeName name of UIMA type to map
- * @param featureFieldsmapping
*/
void map(String typeName, Map<String, MapField> featureFieldsmapping) throws FieldMappingException {
try {
@@ -66,15 +64,15 @@ public class UIMAToSolrMapper {
String fieldNameFeatureValue = fieldNameFeature == null ? null :
fs.getFeatureValueAsString(type.getFeatureByBaseName(fieldNameFeature));
String fieldName = mapField.getFieldName(fieldNameFeatureValue);
- log.info(new StringBuffer("mapping ").append(typeName).append("@").append(featureName)
+ log.info(new StringBuilder("mapping ").append(typeName).append("@").append(featureName)
.append(" to ").append(fieldName).toString());
- String featureValue = null;
+ String featureValue;
if (fs instanceof Annotation && "coveredText".equals(featureName)) {
featureValue = ((Annotation) fs).getCoveredText();
} else {
featureValue = fs.getFeatureValueAsString(type.getFeatureByBaseName(featureName));
}
- log.info(new StringBuffer("writing ").append(featureValue).append(" in ").append(
+ log.info(new StringBuilder("writing ").append(featureValue).append(" in ").append(
fieldName).toString());
document.addField(fieldName, featureValue, 1.0f);
}
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java Thu Oct 25 13:10:25 2012
@@ -73,16 +73,16 @@ public class UIMAUpdateRequestProcessor
/* get the fields to analyze */
String[] texts = getTextsToAnalyze(solrInputDocument);
- for (int i = 0; i < texts.length; i++) {
- text = texts[i];
- if (text != null && text.length()>0) {
+ for (String currentText : texts) {
+ text = currentText;
+ if (text != null && text.length() > 0) {
/* process the text value */
JCas jcas = processText(text);
UIMAToSolrMapper uimaToSolrMapper = new UIMAToSolrMapper(solrInputDocument, jcas);
/* get field mapping from config */
Map<String, Map<String, MapField>> typesAndFeaturesFieldsMap = solrUIMAConfiguration
- .getTypesFeaturesFieldsMapping();
+ .getTypesFeaturesFieldsMapping();
/* map type features on fields */
for (String typeFQN : typesAndFeaturesFieldsMap.keySet()) {
uimaToSolrMapper.map(typeFQN, typesAndFeaturesFieldsMap.get(typeFQN));
@@ -133,8 +133,8 @@ public class UIMAUpdateRequestProcessor
String[] textVals;
if (merge) {
StringBuilder unifiedText = new StringBuilder("");
- for (int i = 0; i < fieldsToAnalyze.length; i++) {
- unifiedText.append(String.valueOf(solrInputDocument.getFieldValue(fieldsToAnalyze[i])));
+ for (String aFieldsToAnalyze : fieldsToAnalyze) {
+ unifiedText.append(String.valueOf(solrInputDocument.getFieldValue(aFieldsToAnalyze)));
}
textVals = new String[1];
textVals[0] = unifiedText.toString();
@@ -150,7 +150,7 @@ public class UIMAUpdateRequestProcessor
/* process a field value executing UIMA the CAS containing it as document text */
private JCas processText(String textFieldValue) throws ResourceInitializationException,
AnalysisEngineProcessException {
- log.info(new StringBuffer("Analyzing text").toString());
+ log.info(new StringBuilder("Analyzing text").toString());
/* get the UIMA analysis engine */
AnalysisEngine ae = aeProvider.getAE();
@@ -160,7 +160,7 @@ public class UIMAUpdateRequestProcessor
/* perform analysis on text field */
ae.process(jcas);
- log.info(new StringBuilder("Text processing completed").toString());
+ log.info("Text processing completed");
return jcas;
}
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test-files/uima/DummySentimentAnalysisAEDescriptor.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test-files/uima/DummySentimentAnalysisAEDescriptor.xml?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test-files/uima/DummySentimentAnalysisAEDescriptor.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test-files/uima/DummySentimentAnalysisAEDescriptor.xml Thu Oct 25 13:10:25 2012
@@ -29,7 +29,7 @@
<typeSystemDescription>
<types>
<typeDescription>
- <name>org.apache.solr.uima.ts.SentimentAnnotation</name>
+ <name>org.apache.solr.uima.ts.DummySentimentAnnotation</name>
<description/>
<supertypeName>uima.tcas.Annotation</supertypeName>
<features>
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/solrconfig.xml?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/solrconfig.xml Thu Oct 25 13:10:25 2012
@@ -827,7 +827,7 @@
</lst>
</lst>
<lst name="type">
- <str name="name">org.apache.solr.uima.ts.SentimentAnnotation</str>
+ <str name="name">org.apache.solr.uima.ts.DummySentimentAnnotation</str>
<lst name="mapping">
<str name="feature">mood</str>
<str name="field">sentiment</str>
Modified: lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test/org/apache/solr/uima/processor/an/DummySentimentAnnotator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test/org/apache/solr/uima/processor/an/DummySentimentAnnotator.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test/org/apache/solr/uima/processor/an/DummySentimentAnnotator.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/contrib/uima/src/test/org/apache/solr/uima/processor/an/DummySentimentAnnotator.java Thu Oct 25 13:10:25 2012
@@ -2,7 +2,7 @@ package org.apache.solr.uima.processor.a
import java.util.Arrays;
-import org.apache.solr.uima.ts.SentimentAnnotation;
+import org.apache.solr.uima.ts.DummySentimentAnnotation;
import org.apache.uima.TokenAnnotation;
import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
@@ -38,24 +38,24 @@ public class DummySentimentAnnotator ext
String tokenPOS = ((TokenAnnotation) annotation).getPosTag();
if ("jj".equals(tokenPOS)) {
if (Arrays.asList(positiveAdj).contains(annotation.getCoveredText())) {
- SentimentAnnotation sentimentAnnotation = createSentimentAnnotation(jcas, annotation);
- sentimentAnnotation.setMood("positive");
- sentimentAnnotation.addToIndexes();
+ DummySentimentAnnotation dummySentimentAnnotation = createSentimentAnnotation(jcas, annotation);
+ dummySentimentAnnotation.setMood("positive");
+ dummySentimentAnnotation.addToIndexes();
}
else if (Arrays.asList(negativeAdj).contains(annotation.getCoveredText())) {
- SentimentAnnotation sentimentAnnotation = createSentimentAnnotation(jcas, annotation);
- sentimentAnnotation.setMood("negative");
- sentimentAnnotation.addToIndexes();
+ DummySentimentAnnotation dummySentimentAnnotation = createSentimentAnnotation(jcas, annotation);
+ dummySentimentAnnotation.setMood("negative");
+ dummySentimentAnnotation.addToIndexes();
}
}
}
}
- private SentimentAnnotation createSentimentAnnotation(JCas jcas, Annotation annotation) {
- SentimentAnnotation sentimentAnnotation = new SentimentAnnotation(jcas);
- sentimentAnnotation.setBegin(annotation.getBegin());
- sentimentAnnotation.setEnd(annotation.getEnd());
- return sentimentAnnotation;
+ private DummySentimentAnnotation createSentimentAnnotation(JCas jcas, Annotation annotation) {
+ DummySentimentAnnotation dummySentimentAnnotation = new DummySentimentAnnotation(jcas);
+ dummySentimentAnnotation.setBegin(annotation.getBegin());
+ dummySentimentAnnotation.setEnd(annotation.getEnd());
+ return dummySentimentAnnotation;
}
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilter.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilter.java Thu Oct 25 13:10:25 2012
@@ -27,7 +27,7 @@ import org.apache.lucene.analysis.tokena
* This class produces a special form of reversed tokens, suitable for
* better handling of leading wildcards. Tokens from the input TokenStream
* are reversed and prepended with a special "reversed" marker character.
- * If <code>withOriginal<code> argument is <code>true</code> then first the
+ * If <code>withOriginal</code> argument is <code>true</code> then first the
* original token is returned, and then the reversed token (with
* <code>positionIncrement == 0</code>) is returned. Otherwise only reversed
* tokens are returned.
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java Thu Oct 25 13:10:25 2012
@@ -62,8 +62,7 @@ public class EmbeddedSolrServer extends
/**
* Use the other constructor using a CoreContainer and a name.
- * @param core
- * @deprecated
+ * @deprecated use {@link #EmbeddedSolrServer(CoreContainer, String)} instead.
*/
@Deprecated
public EmbeddedSolrServer( SolrCore core )
@@ -231,9 +230,7 @@ public class EmbeddedSolrServer extends
}
/**
- * @param req
- * @param rsp
- * @return a response object equivalent to what you get from the XML/JSON/javabin parser. Documents
+ * Returns a response object equivalent to what you get from the XML/JSON/javabin parser. Documents
* become SolrDocuments, DocList becomes SolrDocumentList etc.
*
* @deprecated use {@link BinaryResponseWriter#getParsedResponse(SolrQueryRequest, SolrQueryResponse)}