You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by us...@apache.org on 2010/02/27 23:51:55 UTC
svn commit: r917067 [4/8] - in /lucene/java/branches/flex_1458: ./ contrib/
contrib/analyzers/common/src/java/org/apache/lucene/analysis/ar/
contrib/analyzers/common/src/java/org/apache/lucene/analysis/bg/
contrib/analyzers/common/src/java/org/apache/l...
Modified: lucene/java/branches/flex_1458/contrib/analyzers/common/src/test/org/apache/lucene/analysis/tr/TestTurkishLowerCaseFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/analyzers/common/src/test/org/apache/lucene/analysis/tr/TestTurkishLowerCaseFilter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/analyzers/common/src/test/org/apache/lucene/analysis/tr/TestTurkishLowerCaseFilter.java (original)
+++ lucene/java/branches/flex_1458/contrib/analyzers/common/src/test/org/apache/lucene/analysis/tr/TestTurkishLowerCaseFilter.java Sat Feb 27 22:51:44 2010
@@ -22,7 +22,6 @@
import org.apache.lucene.analysis.BaseTokenStreamTestCase;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.WhitespaceTokenizer;
-import org.apache.lucene.util.Version;
/**
* Test the Turkish lowercase filter.
@@ -33,7 +32,7 @@
* Test composed forms
*/
public void testTurkishLowerCaseFilter() throws Exception {
- TokenStream stream = new WhitespaceTokenizer(Version.LUCENE_CURRENT, new StringReader(
+ TokenStream stream = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader(
"\u0130STANBUL \u0130ZM\u0130R ISPARTA"));
TurkishLowerCaseFilter filter = new TurkishLowerCaseFilter(stream);
assertTokenStreamContents(filter, new String[] {"istanbul", "izmir",
@@ -44,7 +43,7 @@
* Test decomposed forms
*/
public void testDecomposed() throws Exception {
- TokenStream stream = new WhitespaceTokenizer(Version.LUCENE_CURRENT, new StringReader(
+ TokenStream stream = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader(
"\u0049\u0307STANBUL \u0049\u0307ZM\u0049\u0307R ISPARTA"));
TurkishLowerCaseFilter filter = new TurkishLowerCaseFilter(stream);
assertTokenStreamContents(filter, new String[] {"istanbul", "izmir",
@@ -57,7 +56,7 @@
* to U+0130 + U+0316, and is lowercased the same way.
*/
public void testDecomposed2() throws Exception {
- TokenStream stream = new WhitespaceTokenizer(Version.LUCENE_CURRENT, new StringReader(
+ TokenStream stream = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader(
"\u0049\u0316\u0307STANBUL \u0049\u0307ZM\u0049\u0307R I\u0316SPARTA"));
TurkishLowerCaseFilter filter = new TurkishLowerCaseFilter(stream);
assertTokenStreamContents(filter, new String[] {"i\u0316stanbul", "izmir",
Modified: lucene/java/branches/flex_1458/contrib/ant/src/test/org/apache/lucene/ant/IndexTaskTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/ant/src/test/org/apache/lucene/ant/IndexTaskTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/ant/src/test/org/apache/lucene/ant/IndexTaskTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/ant/src/test/org/apache/lucene/ant/IndexTaskTest.java Sat Feb 27 22:51:44 2010
@@ -20,8 +20,6 @@
import java.io.File;
import java.io.IOException;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.StopAnalyzer;
import org.apache.lucene.queryParser.QueryParser;
@@ -31,13 +29,13 @@
import org.apache.lucene.store.FSDirectory;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
/**
* Test cases for index task
*
*/
-public class IndexTaskTest extends TestCase {
+public class IndexTaskTest extends LuceneTestCase {
private final static String docHandler =
"org.apache.lucene.ant.FileExtensionDocumentHandler";
@@ -55,7 +53,8 @@
*@exception IOException Description of Exception
*/
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
+ super.setUp();
Project project = new Project();
IndexTask task = new IndexTask();
@@ -71,12 +70,12 @@
dir = FSDirectory.open(indexDir);
searcher = new IndexSearcher(dir, true);
- analyzer = new StopAnalyzer(Version.LUCENE_CURRENT);
+ analyzer = new StopAnalyzer(TEST_VERSION_CURRENT);
}
public void testSearch() throws Exception {
- Query query = new QueryParser(Version.LUCENE_CURRENT, "contents",analyzer).parse("test");
+ Query query = new QueryParser(TEST_VERSION_CURRENT, "contents",analyzer).parse("test");
int numHits = searcher.search(query, null, 1000).totalHits;
@@ -88,9 +87,10 @@
* TODO: remove indexDir?
*/
@Override
- public void tearDown() throws IOException {
+ protected void tearDown() throws Exception {
searcher.close();
dir.close();
+ super.tearDown();
}
}
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java Sat Feb 27 22:51:44 2010
@@ -13,10 +13,12 @@
public class LongToEnglishContentSource extends ContentSource{
private long counter = Long.MIN_VALUE + 10;
+ @Override
public void close() throws IOException {
}
//TODO: reduce/clean up synchonization
+ @Override
public synchronized DocData getNextDocData(DocData docData) throws NoMoreDataException, IOException {
docData.clear();
docData.setBody(English.longToEnglish(counter));
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/QueryMaker.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/QueryMaker.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/QueryMaker.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/QueryMaker.java Sat Feb 27 22:51:44 2010
@@ -30,7 +30,7 @@
/**
* Create the next query, of the given size.
* @param size the size of the query - number of terms, etc.
- * @exception if cannot make the query, or if size>0 was specified but this feature is not supported.
+ * @exception Exception if cannot make the query, or if size>0 was specified but this feature is not supported.
*/
public Query makeQuery (int size) throws Exception;
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/Points.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/Points.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/Points.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/Points.java Sat Feb 27 22:51:44 2010
@@ -29,8 +29,6 @@
*/
public class Points {
- private Config config;
-
// stat points ordered by their start time.
// for now we collect points as TaskStats objects.
// later might optimize to collect only native data.
@@ -44,7 +42,6 @@
* Create a Points statistics object.
*/
public Points (Config config) {
- this.config = config;
}
/**
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java Sat Feb 27 22:51:44 2010
@@ -211,7 +211,7 @@
public Object clone() throws CloneNotSupportedException {
TaskStats c = (TaskStats) super.clone();
if (c.countsByTime != null) {
- c.countsByTime = (int[]) c.countsByTime.clone();
+ c.countsByTime = c.countsByTime.clone();
}
return c;
}
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NearRealtimeReaderTask.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NearRealtimeReaderTask.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NearRealtimeReaderTask.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NearRealtimeReaderTask.java Sat Feb 27 22:51:44 2010
@@ -70,7 +70,7 @@
// Parent sequence sets stopNow
reopenCount = 0;
while(!stopNow) {
- long waitForMsec = (long) (pauseMSec - (System.currentTimeMillis() - t));
+ long waitForMsec = (pauseMSec - (System.currentTimeMillis() - t));
if (waitForMsec > 0) {
Thread.sleep(waitForMsec);
//System.out.println("NRT wait: " + waitForMsec + " msec");
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewShingleAnalyzerTask.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewShingleAnalyzerTask.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewShingleAnalyzerTask.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewShingleAnalyzerTask.java Sat Feb 27 22:51:44 2010
@@ -18,12 +18,10 @@
*/
import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.util.StringTokenizer;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.shingle.ShingleAnalyzerWrapper;
-import org.apache.lucene.analysis.shingle.ShingleFilter;
import org.apache.lucene.benchmark.byTask.PerfRunData;
import org.apache.lucene.util.Version;
@@ -39,8 +37,6 @@
public class NewShingleAnalyzerTask extends PerfTask {
private String analyzerClassName = "standard.StandardAnalyzer";
- private static final String shingleAnalyzerClassName
- = "org.apache.lucene.analysis.shingle.ShingleAnalyzerWrapper";
private int maxShingleSize = 2;
private boolean outputUnigrams = true;
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java Sat Feb 27 22:51:44 2010
@@ -140,6 +140,6 @@
}
}
@Override
- public void close() {};
+ public void close() {}
}
}
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java Sat Feb 27 22:51:44 2010
@@ -100,7 +100,6 @@
/**
* Create config without algorithm - useful for a programmatic perf test.
* @param props - configuration properties.
- * @throws IOException
*/
public Config (Properties props) {
this.props = props;
@@ -109,6 +108,7 @@
}
}
+ @SuppressWarnings("unchecked")
private void printProps() {
System.out.println("------------> config properties:");
List<String> propKeys = new ArrayList(props.keySet());
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/stats/TimeData.java Sat Feb 27 22:51:44 2010
@@ -34,7 +34,7 @@
/** Total memory at the end of measurement interval. */
public long totalMem = 0L;
- public TimeData() {};
+ public TimeData() {}
public TimeData(String name) {
this.name = name;
@@ -78,7 +78,7 @@
/** Get rate of processing, defined as number of processed records per second. */
public double getRate() {
- double rps = (double) count * 1000.0 / (double) (elapsed>0 ? elapsed : 1); // assume at least 1ms for any countable op
+ double rps = count * 1000.0 / (elapsed > 0 ? elapsed : 1); // assume at least 1ms for any countable op
return rps;
}
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractReuters.java Sat Feb 27 22:51:44 2010
@@ -94,14 +94,12 @@
StringBuffer outBuffer = new StringBuffer(1024);
String line = null;
- int index = -1;
int docNumber = 0;
while ((line = reader.readLine()) != null)
{
//when we see a closing reuters tag, flush the file
- if ((index = line.indexOf("</REUTERS")) == -1)
- {
+ if (line.indexOf("</REUTERS") == -1) {
//Replace the SGM escape sequences
buffer.append(line).append(' ');//accumulate the strings for now, then apply regular expression to get the pieces,
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java Sat Feb 27 22:51:44 2010
@@ -132,7 +132,7 @@
properties.setProperty("keep.image.only.docs", String.valueOf(keepImageOnlyDocs));
docMaker.setConfig(new Config(properties));
docMaker.resetInputs();
- if (wikipedia != null && wikipedia.exists()) {
+ if (wikipedia.exists()) {
System.out.println("Extracting Wikipedia to: " + outputDir + " using EnwikiContentSource");
outputDir.mkdirs();
ExtractWikipedia extractor = new ExtractWikipedia(docMaker, outputDir);
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java Sat Feb 27 22:51:44 2010
@@ -987,8 +987,8 @@
// Default analyzer, maxShingleSize, and outputUnigrams
Benchmark benchmark = execBenchmark(getShingleConfig(""));
- TokenStream stream = benchmark.getRunData().getAnalyzer().tokenStream
- ("bogus", new StringReader(text));
+ benchmark.getRunData().getAnalyzer().tokenStream
+ ("bogus", new StringReader(text)).close();
assertEqualShingle(benchmark.getRunData().getAnalyzer(), text,
new String[] {"one", "one two", "two", "two three",
"three", "three four", "four", "four five",
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java Sat Feb 27 22:51:44 2010
@@ -19,8 +19,6 @@
import java.io.StringReader;
import java.util.ArrayList;
-import java.util.Iterator;
-
import junit.framework.TestCase;
import org.apache.lucene.benchmark.byTask.tasks.PerfTask;
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java (original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java Sat Feb 27 22:51:44 2010
@@ -49,9 +49,6 @@
private static boolean DEBUG = Boolean.getBoolean("tests.verbose");
- /**
- * @param arg0
- */
public TestQualityRun(String name) {
super(name);
}
Modified: lucene/java/branches/flex_1458/contrib/db/bdb-je/src/test/org/apache/lucene/store/je/JEStoreTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/db/bdb-je/src/test/org/apache/lucene/store/je/JEStoreTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/db/bdb-je/src/test/org/apache/lucene/store/je/JEStoreTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/db/bdb-je/src/test/org/apache/lucene/store/je/JEStoreTest.java Sat Feb 27 22:51:44 2010
@@ -53,7 +53,8 @@
protected Database index, blocks;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
+ super.setUp();
if (!dbHome.exists())
dbHome.mkdir();
@@ -99,7 +100,7 @@
}
@Override
- public void tearDown() throws Exception {
+ protected void tearDown() throws Exception {
if (index != null)
index.close();
@@ -107,6 +108,7 @@
blocks.close();
if (env != null)
env.close();
+ super.tearDown();
}
public void testBytes() throws Exception {
@@ -122,13 +124,12 @@
Date veryStart = new Date();
Date start = new Date();
- Transaction txn = null;
+ Transaction txn = env.beginTransaction(null, null);
Directory store = null;
System.out.println("Writing files byte by byte");
try {
- txn = env.beginTransaction(null, null);
store = new JEDirectory(txn, index, blocks);
for (int i = 0; i < count; i++) {
@@ -149,12 +150,6 @@
txn.abort();
txn = null;
throw e;
- } catch (DatabaseException e) {
- if (txn != null) {
- txn.abort();
- txn = null;
- }
- throw e;
} finally {
if (txn != null)
txn.commit();
@@ -269,13 +264,12 @@
Date veryStart = new Date();
Date start = new Date();
- Transaction txn = null;
+ Transaction txn = env.beginTransaction(null, null);
Directory store = null;
System.out.println("Writing files byte by byte");
try {
- txn = env.beginTransaction(null, null);
store = new JEDirectory(txn, index, blocks);
for (int i = 0; i < count; i++) {
@@ -296,12 +290,6 @@
txn.abort();
txn = null;
throw e;
- } catch (DatabaseException e) {
- if (txn != null) {
- txn.abort();
- txn = null;
- }
- throw e;
} finally {
if (txn != null)
txn.commit();
@@ -500,13 +488,12 @@
Date veryStart = new Date();
Date start = new Date();
- Transaction txn = null;
+ Transaction txn = env.beginTransaction(null, null);
Directory store = null;
System.out.println("Writing files as one byte array");
try {
- txn = env.beginTransaction(null, null);
store = new JEDirectory(txn, index, blocks);
for (int i = 0; i < count; i++) {
@@ -525,12 +512,6 @@
txn.abort();
txn = null;
throw e;
- } catch (DatabaseException e) {
- if (txn != null) {
- txn.abort();
- txn = null;
- }
- throw e;
} finally {
if (txn != null)
txn.commit();
Modified: lucene/java/branches/flex_1458/contrib/db/bdb/src/java/org/apache/lucene/store/db/Block.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/db/bdb/src/java/org/apache/lucene/store/db/Block.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/db/bdb/src/java/org/apache/lucene/store/db/Block.java (original)
+++ lucene/java/branches/flex_1458/contrib/db/bdb/src/java/org/apache/lucene/store/db/Block.java Sat Feb 27 22:51:44 2010
@@ -20,8 +20,6 @@
import java.io.IOException;
import com.sleepycat.db.DatabaseEntry;
-import com.sleepycat.db.internal.Db;
-import com.sleepycat.db.internal.DbTxn;
import com.sleepycat.db.DatabaseException;
Modified: lucene/java/branches/flex_1458/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java (original)
+++ lucene/java/branches/flex_1458/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java Sat Feb 27 22:51:44 2010
@@ -32,7 +32,6 @@
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.IndexInput;
-import com.sleepycat.db.internal.DbEnv;
import com.sleepycat.db.internal.Db;
import com.sleepycat.db.internal.DbConstants;
import com.sleepycat.db.DatabaseEntry;
Modified: lucene/java/branches/flex_1458/contrib/db/bdb/src/test/org/apache/lucene/store/db/DbStoreTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/db/bdb/src/test/org/apache/lucene/store/db/DbStoreTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/db/bdb/src/test/org/apache/lucene/store/db/DbStoreTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/db/bdb/src/test/org/apache/lucene/store/db/DbStoreTest.java Sat Feb 27 22:51:44 2010
@@ -48,9 +48,8 @@
protected Database index, blocks;
@Override
- public void setUp()
- throws Exception
- {
+ protected void setUp() throws Exception {
+ super.setUp();
if (!dbHome.exists())
dbHome.mkdir();
else
@@ -101,15 +100,14 @@
}
@Override
- public void tearDown()
- throws Exception
- {
+ protected void tearDown() throws Exception {
if (index != null)
index.close();
if (blocks != null)
blocks.close();
if (env != null)
env.close();
+ super.tearDown();
}
public void testBytes()
@@ -128,13 +126,12 @@
Date veryStart = new Date();
Date start = new Date();
- Transaction txn = null;
+ Transaction txn = env.beginTransaction(null, null);
Directory store = null;
System.out.println("Writing files byte by byte");
try {
- txn = env.beginTransaction(null, null);
store = new DbDirectory(txn, index, blocks);
for (int i = 0; i < count; i++) {
@@ -155,13 +152,6 @@
txn.abort();
txn = null;
throw e;
- } catch (DatabaseException e) {
- if (txn != null)
- {
- txn.abort();
- txn = null;
- }
- throw e;
} finally {
if (txn != null)
txn.commit();
@@ -281,13 +271,12 @@
Date veryStart = new Date();
Date start = new Date();
- Transaction txn = null;
+ Transaction txn = env.beginTransaction(null, null);
Directory store = null;
System.out.println("Writing files as one byte array");
try {
- txn = env.beginTransaction(null, null);
store = new DbDirectory(txn, index, blocks);
for (int i = 0; i < count; i++) {
@@ -306,13 +295,6 @@
txn.abort();
txn = null;
throw e;
- } catch (DatabaseException e) {
- if (txn != null)
- {
- txn.abort();
- txn = null;
- }
- throw e;
} finally {
if (txn != null)
txn.commit();
Modified: lucene/java/branches/flex_1458/contrib/db/bdb/src/test/org/apache/lucene/store/db/SanityLoadLibrary.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/db/bdb/src/test/org/apache/lucene/store/db/SanityLoadLibrary.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/db/bdb/src/test/org/apache/lucene/store/db/SanityLoadLibrary.java (original)
+++ lucene/java/branches/flex_1458/contrib/db/bdb/src/test/org/apache/lucene/store/db/SanityLoadLibrary.java Sat Feb 27 22:51:44 2010
@@ -31,6 +31,6 @@
public static void main(String[] ignored) throws Exception {
EnvironmentConfig envConfig = EnvironmentConfig.DEFAULT;
envConfig.setAllowCreate(false);
- Environment env = new Environment(null, envConfig);
+ new Environment(null, envConfig);
}
}
Modified: lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldFragList.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldFragList.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldFragList.java (original)
+++ lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldFragList.java Sat Feb 27 22:51:44 2010
@@ -29,7 +29,6 @@
*/
public class FieldFragList {
- private final int fragCharSize;
List<WeightedFragInfo> fragInfos = new ArrayList<WeightedFragInfo>();
/**
@@ -38,7 +37,6 @@
* @param fragCharSize the length (number of chars) of a fragment
*/
public FieldFragList( int fragCharSize ){
- this.fragCharSize = fragCharSize;
}
/**
Modified: lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java (original)
+++ lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java Sat Feb 27 22:51:44 2010
@@ -64,7 +64,7 @@
writer.close();
IndexReader reader = IndexReader.open( dir, true );
- FieldTermStack ftl = new FieldTermStack( reader, 0, "f", fieldQuery );
+ new FieldTermStack( reader, 0, "f", fieldQuery );
reader.close();
}
Modified: lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java (original)
+++ lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java Sat Feb 27 22:51:44 2010
@@ -21,11 +21,8 @@
import java.io.Reader;
import java.util.Collection;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.KeywordAnalyzer;
-import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
@@ -47,9 +44,9 @@
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
-public abstract class AbstractTestCase extends TestCase {
+public abstract class AbstractTestCase extends LuceneTestCase {
protected final String F = "f";
protected final String F1 = "f1";
@@ -87,11 +84,12 @@
@Override
protected void setUp() throws Exception {
- analyzerW = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ super.setUp();
+ analyzerW = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
analyzerB = new BigramAnalyzer();
analyzerK = new KeywordAnalyzer();
- paW = new QueryParser(Version.LUCENE_CURRENT, F, analyzerW );
- paB = new QueryParser(Version.LUCENE_CURRENT, F, analyzerB );
+ paW = new QueryParser(TEST_VERSION_CURRENT, F, analyzerW );
+ paB = new QueryParser(TEST_VERSION_CURRENT, F, analyzerB );
dir = new RAMDirectory();
}
@@ -101,6 +99,7 @@
reader.close();
reader = null;
}
+ super.tearDown();
}
protected Query tq( String text ){
@@ -282,7 +281,7 @@
}
charBufferIndex = 0;
}
- int c = (int)charBuffer[charBufferIndex++];
+ int c = charBuffer[charBufferIndex++];
nextStartOffset++;
return c;
}
@@ -291,11 +290,13 @@
return delimiters.indexOf( c ) >= 0;
}
+ @Override
public void reset( Reader input ) throws IOException {
super.reset( input );
reset();
}
+ @Override
public void reset() throws IOException {
startTerm = 0;
nextStartOffset = 0;
Modified: lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java Sat Feb 27 22:51:44 2010
@@ -17,7 +17,6 @@
* limitations under the License.
*/
-import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Index;
Propchange: lucene/java/branches/flex_1458/contrib/highlighter/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 27 22:51:44 2010
@@ -2,4 +2,4 @@
/lucene/java/branches/lucene_2_9/contrib/highlighter/src/test:817269-818600,825998,826775,829134,829816,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/contrib/highlighter/src/test:818601-821336
/lucene/java/branches/lucene_3_0/contrib/highlighter/src/test:880793,896906
-/lucene/java/trunk/contrib/highlighter/src/test:829439-833960,880727-886190,889185,889614-916543
+/lucene/java/trunk/contrib/highlighter/src/test:829439-833960,880727-886190,889185,889614-916543,916596,916685,916769,917019
Modified: lucene/java/branches/flex_1458/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java Sat Feb 27 22:51:44 2010
@@ -48,12 +48,10 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.OpenBitSet;
-import org.apache.lucene.util.Version;
-import junit.framework.TestCase;
-
-public class HighlighterPhraseTest extends TestCase {
+public class HighlighterPhraseTest extends LuceneTestCase {
private static final String FIELD = "text";
public void testConcurrentPhrase() throws CorruptIndexException,
@@ -61,7 +59,7 @@
final String TEXT = "the fox jumped";
final Directory directory = new RAMDirectory();
final IndexWriter indexWriter = new IndexWriter(directory,
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT), MaxFieldLength.UNLIMITED);
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT), MaxFieldLength.UNLIMITED);
try {
final Document document = new Document();
document.add(new Field(FIELD, new TokenStreamConcurrent(),
@@ -104,7 +102,7 @@
final String TEXT = "the fox jumped";
final Directory directory = new RAMDirectory();
final IndexWriter indexWriter = new IndexWriter(directory,
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT), MaxFieldLength.UNLIMITED);
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT), MaxFieldLength.UNLIMITED);
try {
final Document document = new Document();
document.add(new Field(FIELD, new TokenStreamConcurrent(),
@@ -125,19 +123,23 @@
indexSearcher.search(phraseQuery, new Collector() {
private int baseDoc;
+ @Override
public boolean acceptsDocsOutOfOrder() {
return true;
}
+ @Override
public void collect(int i) throws IOException {
bitset.set(this.baseDoc + i);
}
+ @Override
public void setNextReader(IndexReader indexreader, int i)
throws IOException {
this.baseDoc = i;
}
+ @Override
public void setScorer(org.apache.lucene.search.Scorer scorer)
throws IOException {
// Do Nothing
@@ -169,7 +171,7 @@
final String TEXT = "the fox did not jump";
final Directory directory = new RAMDirectory();
final IndexWriter indexWriter = new IndexWriter(directory,
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT), MaxFieldLength.UNLIMITED);
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT), MaxFieldLength.UNLIMITED);
try {
final Document document = new Document();
document.add(new Field(FIELD, new TokenStreamSparse(),
@@ -211,7 +213,7 @@
final String TEXT = "the fox did not jump";
final Directory directory = new RAMDirectory();
final IndexWriter indexWriter = new IndexWriter(directory,
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT), MaxFieldLength.UNLIMITED);
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT), MaxFieldLength.UNLIMITED);
try {
final Document document = new Document();
document.add(new Field(FIELD, TEXT, Store.YES, Index.ANALYZED,
@@ -251,7 +253,7 @@
final String TEXT = "the fox did not jump";
final Directory directory = new RAMDirectory();
final IndexWriter indexWriter = new IndexWriter(directory,
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT), MaxFieldLength.UNLIMITED);
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT), MaxFieldLength.UNLIMITED);
try {
final Document document = new Document();
document.add(new Field(FIELD, new TokenStreamSparse(),
@@ -322,6 +324,7 @@
return true;
}
+ @Override
public void reset() {
this.i = -1;
this.tokens = new Token[] {
@@ -367,6 +370,7 @@
return true;
}
+ @Override
public void reset() {
this.i = -1;
this.tokens = new Token[] {
Modified: lucene/java/branches/flex_1458/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java Sat Feb 27 22:51:44 2010
@@ -79,6 +79,7 @@
import org.apache.lucene.search.spans.SpanTermQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.Version;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -89,7 +90,7 @@
*/
public class HighlighterTest extends BaseTokenStreamTestCase implements Formatter {
// TODO: change to CURRENT, does not work because posIncr:
- static final Version TEST_VERSION = Version.LUCENE_CURRENT;
+ static final Version TEST_VERSION = TEST_VERSION_CURRENT;
private IndexReader reader;
static final String FIELD_NAME = "contents";
@@ -118,7 +119,7 @@
}
public void testQueryScorerHits() throws Exception {
- Analyzer analyzer = new SimpleAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer analyzer = new SimpleAnalyzer(TEST_VERSION_CURRENT);
QueryParser qp = new QueryParser(TEST_VERSION, FIELD_NAME, analyzer);
query = qp.parse("\"very long\"");
searcher = new IndexSearcher(ramDir, true);
@@ -226,7 +227,7 @@
String f2c = f2 + ":";
String q = "(" + f1c + ph1 + " OR " + f2c + ph1 + ") AND (" + f1c + ph2
+ " OR " + f2c + ph2 + ")";
- Analyzer analyzer = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer analyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
QueryParser qp = new QueryParser(TEST_VERSION, f1, analyzer);
Query query = qp.parse(q);
@@ -374,8 +375,8 @@
highlighter.setTextFragmenter(new SimpleFragmenter(40));
- String result = highlighter.getBestFragments(tokenStream, text, maxNumFragmentsRequired,
- "...");
+// String result =
+ highlighter.getBestFragments(tokenStream, text, maxNumFragmentsRequired,"...");
//System.out.println("\t" + result);
}
@@ -1389,9 +1390,9 @@
// highlighting respects fieldnames used in query
Scorer fieldSpecificScorer = null;
- if (mode == this.QUERY) {
+ if (mode == TestHighlightRunner.QUERY) {
fieldSpecificScorer = new QueryScorer(query, FIELD_NAME);
- } else if (mode == this.QUERY_TERM) {
+ } else if (mode == TestHighlightRunner.QUERY_TERM) {
fieldSpecificScorer = new QueryTermScorer(query, "contents");
}
Highlighter fieldSpecificHighlighter = new Highlighter(new SimpleHTMLFormatter(),
@@ -1402,9 +1403,9 @@
// highlighting does not respect fieldnames used in query
Scorer fieldInSpecificScorer = null;
- if (mode == this.QUERY) {
+ if (mode == TestHighlightRunner.QUERY) {
fieldInSpecificScorer = new QueryScorer(query, null);
- } else if (mode == this.QUERY_TERM) {
+ } else if (mode == TestHighlightRunner.QUERY_TERM) {
fieldInSpecificScorer = new QueryTermScorer(query);
}
@@ -1529,64 +1530,64 @@
Highlighter highlighter;
String result;
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("foo");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("foo");
highlighter = getHighlighter(query, "text", getTS2(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
assertEquals("Hi-Speed10 <B>foo</B>", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("10");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("10");
highlighter = getHighlighter(query, "text", getTS2(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
assertEquals("Hi-Speed<B>10</B> foo", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("hi");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("hi");
highlighter = getHighlighter(query, "text", getTS2(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
assertEquals("<B>Hi</B>-Speed10 foo", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("speed");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("speed");
highlighter = getHighlighter(query, "text", getTS2(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
assertEquals("Hi-<B>Speed</B>10 foo", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("hispeed");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("hispeed");
highlighter = getHighlighter(query, "text", getTS2(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
assertEquals("<B>Hi-Speed</B>10 foo", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("hi speed");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("hi speed");
highlighter = getHighlighter(query, "text", getTS2(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
assertEquals("<B>Hi-Speed</B>10 foo", result);
// ///////////////// same tests, just put the bigger overlapping token
// first
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("foo");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("foo");
highlighter = getHighlighter(query, "text", getTS2a(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
assertEquals("Hi-Speed10 <B>foo</B>", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("10");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("10");
highlighter = getHighlighter(query, "text", getTS2a(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
assertEquals("Hi-Speed<B>10</B> foo", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("hi");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("hi");
highlighter = getHighlighter(query, "text", getTS2a(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
assertEquals("<B>Hi</B>-Speed10 foo", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("speed");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("speed");
highlighter = getHighlighter(query, "text", getTS2a(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
assertEquals("Hi-<B>Speed</B>10 foo", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("hispeed");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("hispeed");
highlighter = getHighlighter(query, "text", getTS2a(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
assertEquals("<B>Hi-Speed</B>10 foo", result);
- query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("hi speed");
+ query = new QueryParser(TEST_VERSION, "text", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("hi speed");
highlighter = getHighlighter(query, "text", getTS2a(), HighlighterTest.this);
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
assertEquals("<B>Hi-Speed</B>10 foo", result);
@@ -1597,7 +1598,7 @@
}
private Directory dir = new RAMDirectory();
- private Analyzer a = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ private Analyzer a = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
public void testWeightedTermsWithDeletes() throws IOException, ParseException, InvalidTokenOffsetsException {
makeIndex();
@@ -1762,11 +1763,6 @@
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
private static Token createToken(String term, int start, int offset)
{
Token token = new Token(start, offset);
@@ -1801,7 +1797,7 @@
*/
@Override
public TokenStream tokenStream(String arg0, Reader arg1) {
- LowerCaseTokenizer stream = new LowerCaseTokenizer(Version.LUCENE_CURRENT, arg1);
+ LowerCaseTokenizer stream = new LowerCaseTokenizer(LuceneTestCase.TEST_VERSION_CURRENT, arg1);
stream.addAttribute(TermAttribute.class);
stream.addAttribute(PositionIncrementAttribute.class);
stream.addAttribute(OffsetAttribute.class);
@@ -1816,7 +1812,6 @@
class SynonymTokenizer extends TokenStream {
private TokenStream realStream;
private Token currentRealToken = null;
- private org.apache.lucene.analysis.Token cRealToken = null;
private Map<String,String> synonyms;
StringTokenizer st = null;
private TermAttribute realTermAtt;
Modified: lucene/java/branches/flex_1458/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java (original)
+++ lucene/java/branches/flex_1458/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java Sat Feb 27 22:51:44 2010
@@ -43,16 +43,16 @@
public class TestAnalyzer extends Analyzer {
- private Collator collator;
+ private Collator _collator;
TestAnalyzer(Collator collator) {
- this.collator = collator;
+ _collator = collator;
}
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
TokenStream result = new KeywordTokenizer(reader);
- result = new ICUCollationKeyFilter(result, collator);
+ result = new ICUCollationKeyFilter(result, _collator);
return result;
}
}
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java Sat Feb 27 22:51:44 2010
@@ -30,7 +30,7 @@
public class InstantiatedDocument
implements Serializable {
- private static long serialVersionUID = 1l;
+ private static final long serialVersionUID = 1l;
private Document document;
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java Sat Feb 27 22:51:44 2010
@@ -16,13 +16,12 @@
* limitations under the License.
*/
+import java.io.Closeable;
import java.io.IOException;
import java.io.Serializable;
-import java.io.Closeable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java Sat Feb 27 22:51:44 2010
@@ -167,11 +167,9 @@
}
@Override
- protected void doCommit(Map commitUserData) throws IOException {
+ protected void doCommit(Map<String,String> commitUserData) throws IOException {
// todo: read/write lock
- boolean updated = false;
-
// 1. update norms
if (uncommittedNormsByFieldNameAndDocumentNumber != null) {
for (Map.Entry<String,List<NormUpdate>> e : uncommittedNormsByFieldNameAndDocumentNumber.entrySet()) {
@@ -181,8 +179,6 @@
}
}
uncommittedNormsByFieldNameAndDocumentNumber = null;
-
- updated = true;
}
// 2. remove deleted documents
@@ -197,9 +193,6 @@
}
}
uncommittedDeletedDocuments = null;
-
- updated = true;
-
}
// todo unlock read/writelock
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java Sat Feb 27 22:51:44 2010
@@ -37,7 +37,6 @@
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
@@ -470,7 +469,7 @@
// normalize settings per field name in document
Map<String /* field name */, FieldSetting> fieldSettingsByFieldName = new HashMap<String, FieldSetting>();
- for (Fieldable field : (List<Fieldable>) document.getDocument().getFields()) {
+ for (Fieldable field : document.getDocument().getFields()) {
FieldSetting fieldSetting = fieldSettingsByFieldName.get(field.name());
if (fieldSetting == null) {
fieldSetting = new FieldSetting();
@@ -514,7 +513,7 @@
Map<Fieldable, LinkedList<Token>> tokensByField = new LinkedHashMap<Fieldable, LinkedList<Token>>(20);
// tokenize indexed fields.
- for (Iterator<Fieldable> it = (Iterator<Fieldable>) document.getDocument().getFields().iterator(); it.hasNext();) {
+ for (Iterator<Fieldable> it = document.getDocument().getFields().iterator(); it.hasNext();) {
Fieldable field = it.next();
@@ -526,7 +525,6 @@
tokensByField.put(field, tokens);
if (field.isTokenized()) {
- int termCounter = 0;
final TokenStream tokenStream;
// todo readerValue(), binaryValue()
if (field.tokenStreamValue() != null) {
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java Sat Feb 27 22:51:44 2010
@@ -16,12 +16,10 @@
* limitations under the License.
*/
-import org.apache.lucene.index.Term;
-
import java.io.Serializable;
import java.util.Comparator;
-import java.util.Collections;
-import java.util.Arrays;
+
+import org.apache.lucene.index.Term;
/**
* A term in the inverted index, coupled to the documents it occurs in.
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java Sat Feb 27 22:51:44 2010
@@ -19,14 +19,10 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermEnum;
-import java.io.IOException;
-import java.util.Arrays;
-
/**
* A {@link org.apache.lucene.index.TermEnum} navigating an {@link org.apache.lucene.store.instantiated.InstantiatedIndexReader}.
*/
-public class InstantiatedTermEnum
- extends TermEnum {
+public class InstantiatedTermEnum extends TermEnum {
private final InstantiatedIndexReader reader;
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java Sat Feb 27 22:51:44 2010
@@ -22,8 +22,6 @@
import java.util.Iterator;
import java.util.List;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -42,11 +40,12 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.AttributeImpl;
+import org.apache.lucene.util.LuceneTestCase;
/**
* Asserts equality of content and behaviour of two index readers.
*/
-public class TestIndicesEquals extends TestCase {
+public class TestIndicesEquals extends LuceneTestCase {
// public void test2() throws Exception {
// FSDirectory fsdir = FSDirectory.open(new File("/tmp/fatcorpus"));
@@ -61,7 +60,7 @@
RAMDirectory dir = new RAMDirectory();
// create dir data
- IndexWriter indexWriter = new IndexWriter(dir, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ IndexWriter indexWriter = new IndexWriter(dir, new StandardAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
for (int i = 0; i < 20; i++) {
Document document = new Document();
assembleDocument(document, i);
@@ -85,7 +84,7 @@
InstantiatedIndex ii = new InstantiatedIndex();
// create dir data
- IndexWriter indexWriter = new IndexWriter(dir, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ IndexWriter indexWriter = new IndexWriter(dir, new StandardAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
for (int i = 0; i < 500; i++) {
Document document = new Document();
assembleDocument(document, i);
@@ -94,7 +93,7 @@
indexWriter.close();
// test ii writer
- InstantiatedIndexWriter instantiatedIndexWriter = ii.indexWriterFactory(new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT), true);
+ InstantiatedIndexWriter instantiatedIndexWriter = ii.indexWriterFactory(new StandardAnalyzer(TEST_VERSION_CURRENT), true);
for (int i = 0; i < 500; i++) {
Document document = new Document();
assembleDocument(document, i);
Propchange: lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 27 22:51:44 2010
@@ -1 +1,2 @@
/lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:909334
+/lucene/java/trunk/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:916596,916685,916769,917019
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestSerialization.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestSerialization.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestSerialization.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestSerialization.java Sat Feb 27 22:51:44 2010
@@ -17,10 +17,9 @@
*/
-import junit.framework.TestCase;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
@@ -30,13 +29,13 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
-public class TestSerialization extends TestCase {
+public class TestSerialization extends LuceneTestCase {
public void test() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
Document doc = new Document();
doc.add(new Field("foo", "bar rab abr bra rba", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
doc.add(new Field("moo", "bar rab abr bra rba", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java Sat Feb 27 22:51:44 2010
@@ -15,16 +15,12 @@
*
*/
-import junit.framework.TestCase;
-
import java.io.IOException;
-import java.util.Map;
-
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -32,21 +28,21 @@
/**
* @since 2009-mar-30 13:15:49
*/
-public class TestUnoptimizedReaderOnConstructor extends TestCase {
+public class TestUnoptimizedReaderOnConstructor extends LuceneTestCase {
public void test() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
addDocument(iw, "Hello, world!");
addDocument(iw, "All work and no play makes jack a dull boy");
iw.close();
- iw = new IndexWriter(dir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), false, IndexWriter.MaxFieldLength.UNLIMITED);
+ iw = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.UNLIMITED);
addDocument(iw, "Hello, tellus!");
addDocument(iw, "All work and no play makes danny a dull boy");
iw.close();
- iw = new IndexWriter(dir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), false, IndexWriter.MaxFieldLength.UNLIMITED);
+ iw = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.UNLIMITED);
addDocument(iw, "Hello, earth!");
addDocument(iw, "All work and no play makes wendy a dull girl");
iw.close();
@@ -54,9 +50,8 @@
IndexReader unoptimizedReader = IndexReader.open(dir, false);
unoptimizedReader.deleteDocument(2);
- InstantiatedIndex ii;
try {
- ii = new InstantiatedIndex(unoptimizedReader);
+ new InstantiatedIndex(unoptimizedReader);
} catch (Exception e) {
fail("No exceptions when loading an unoptimized reader!");
}
Modified: lucene/java/branches/flex_1458/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/java/branches/flex_1458/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Sat Feb 27 22:51:44 2010
@@ -793,41 +793,41 @@
return new TermEnum() {
- private int i = ix; // index into info.sortedTerms
- private int j = jx; // index into sortedFields
+ private int srtTermsIdx = ix; // index into info.sortedTerms
+ private int srtFldsIdx = jx; // index into sortedFields
@Override
public boolean next() {
if (DEBUG) System.err.println("TermEnum.next");
- if (j >= sortedFields.length) return false;
- Info info = getInfo(j);
- if (++i < info.sortedTerms.length) return true;
+ if (srtFldsIdx >= sortedFields.length) return false;
+ Info info = getInfo(srtFldsIdx);
+ if (++srtTermsIdx < info.sortedTerms.length) return true;
// move to successor
- j++;
- i = 0;
- if (j >= sortedFields.length) return false;
- getInfo(j).sortTerms();
+ srtFldsIdx++;
+ srtTermsIdx = 0;
+ if (srtFldsIdx >= sortedFields.length) return false;
+ getInfo(srtFldsIdx).sortTerms();
return true;
}
@Override
public Term term() {
- if (DEBUG) System.err.println("TermEnum.term: " + i);
- if (j >= sortedFields.length) return null;
- Info info = getInfo(j);
- if (i >= info.sortedTerms.length) return null;
+ if (DEBUG) System.err.println("TermEnum.term: " + srtTermsIdx);
+ if (srtFldsIdx >= sortedFields.length) return null;
+ Info info = getInfo(srtFldsIdx);
+ if (srtTermsIdx >= info.sortedTerms.length) return null;
// if (DEBUG) System.err.println("TermEnum.term: " + i + ", " + info.sortedTerms[i].getKey());
- return createTerm(info, j, info.sortedTerms[i].getKey());
+ return createTerm(info, srtFldsIdx, info.sortedTerms[srtTermsIdx].getKey());
}
@Override
public int docFreq() {
if (DEBUG) System.err.println("TermEnum.docFreq");
- if (j >= sortedFields.length) return 0;
- Info info = getInfo(j);
- if (i >= info.sortedTerms.length) return 0;
- return numPositions(info.getPositions(i));
+ if (srtFldsIdx >= sortedFields.length) return 0;
+ Info info = getInfo(srtFldsIdx);
+ if (srtTermsIdx >= info.sortedTerms.length) return 0;
+ return numPositions(info.getPositions(srtTermsIdx));
}
@Override
Modified: lucene/java/branches/flex_1458/contrib/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java Sat Feb 27 22:51:44 2010
@@ -31,7 +31,6 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Set;
import org.apache.lucene.analysis.BaseTokenStreamTestCase;
import org.apache.lucene.analysis.Analyzer;
@@ -52,7 +51,6 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.index.TermDocs;
-import org.apache.lucene.util.Version;
/**
Verifies that Lucene MemoryIndex and RAMDirectory have the same behaviour,
@@ -202,7 +200,6 @@
public class MemoryIndexTest extends BaseTokenStreamTestCase {
private Analyzer analyzer;
- private boolean fastMode = false;
private final boolean verbose = false;
@@ -271,16 +268,14 @@
}
}
- boolean toLowerCase = true;
// boolean toLowerCase = false;
// Set stopWords = null;
- Set<?> stopWords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
Analyzer[] analyzers = new Analyzer[] {
- new SimpleAnalyzer(Version.LUCENE_CURRENT),
- new StopAnalyzer(Version.LUCENE_CURRENT),
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT),
-// new WhitespaceAnalyzer(Version.LUCENE_CURRENT),
+ new SimpleAnalyzer(TEST_VERSION_CURRENT),
+ new StopAnalyzer(TEST_VERSION_CURRENT),
+ new StandardAnalyzer(TEST_VERSION_CURRENT),
+// new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
// new PatternAnalyzer(PatternAnalyzer.NON_WORD_PATTERN, false, null),
// new PatternAnalyzer(PatternAnalyzer.NON_WORD_PATTERN, true, stopWords),
// new SnowballAnalyzer("English", StopAnalyzer.ENGLISH_STOP_WORDS),
@@ -465,7 +460,8 @@
}
}
- private int getMemorySize(Object index) {
+ // for debugging purposes
+ int getMemorySize(Object index) {
if (index instanceof Directory) {
try {
Directory dir = (Directory) index;
@@ -486,7 +482,7 @@
}
private Query parseQuery(String expression) throws ParseException {
- QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, FIELD_NAME, analyzer);
+ QueryParser parser = new QueryParser(TEST_VERSION_CURRENT, FIELD_NAME, analyzer);
// parser.setPhraseSlop(0);
return parser.parse(expression);
}
@@ -559,7 +555,7 @@
System.arraycopy(output, 0, buffer, 0, len);
return buffer;
} finally {
- if (input != null) input.close();
+ input.close();
}
}
Modified: lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/BalancedSegmentMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/BalancedSegmentMergePolicy.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/BalancedSegmentMergePolicy.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/BalancedSegmentMergePolicy.java Sat Feb 27 22:51:44 2010
@@ -59,7 +59,7 @@
protected long size(SegmentInfo info) throws IOException {
long byteSize = info.sizeInBytes();
float delRatio = (info.docCount <= 0 ? 0.0f : ((float)info.getDelCount() / (float)info.docCount));
- return (info.docCount <= 0 ? byteSize : (long)((float)byteSize * (1.0f - delRatio)));
+ return (info.docCount <= 0 ? byteSize : (long)((1.0f - delRatio) * byteSize));
}
public void setPartialExpunge(boolean doPartialExpunge) {
Modified: lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/ChainedFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/ChainedFilter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/ChainedFilter.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/ChainedFilter.java Sat Feb 27 22:51:44 2010
@@ -25,7 +25,6 @@
import org.apache.lucene.search.Filter;
import org.apache.lucene.util.OpenBitSet;
import org.apache.lucene.util.OpenBitSetDISI;
-import org.apache.lucene.util.SortedVIntList;
/**
* <p>
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java Sat Feb 27 22:51:44 2010
@@ -20,8 +20,6 @@
import java.io.IOException;
import java.util.Arrays;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -34,12 +32,13 @@
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
/**
* Tests changing of field norms with a custom similarity and with fake norms.
*/
-public class TestFieldNormModifier extends TestCase {
+public class TestFieldNormModifier extends LuceneTestCase {
+
public TestFieldNormModifier(String name) {
super(name);
}
@@ -57,8 +56,9 @@
};
@Override
- public void setUp() throws Exception {
- IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(Version.LUCENE_CURRENT), true, MaxFieldLength.UNLIMITED);
+ protected void setUp() throws Exception {
+ super.setUp();
+ IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, MaxFieldLength.UNLIMITED);
for (int i = 0; i < NUM_DOCS; i++) {
Document d = new Document();
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java Sat Feb 27 22:51:44 2010
@@ -23,7 +23,6 @@
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.Version;
import org.apache.lucene.util._TestUtil;
public class TestIndexSplitter extends LuceneTestCase {
@@ -36,7 +35,7 @@
_TestUtil.rmDir(destDir);
destDir.mkdirs();
FSDirectory fsDir = FSDirectory.open(dir);
- IndexWriter iw = new IndexWriter(fsDir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true, MaxFieldLength.UNLIMITED);
+ IndexWriter iw = new IndexWriter(fsDir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, MaxFieldLength.UNLIMITED);
for (int x=0; x < 100; x++) {
Document doc = TestIndexWriterReader.createDocument(x, "index", 5);
iw.addDocument(doc);
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java Sat Feb 27 22:51:44 2010
@@ -22,18 +22,17 @@
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
-import junit.framework.TestCase;
-
-public class TestMultiPassIndexSplitter extends TestCase {
+public class TestMultiPassIndexSplitter extends LuceneTestCase {
IndexReader input;
int NUM_DOCS = 11;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
+ super.setUp();
RAMDirectory dir = new RAMDirectory();
- IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true,
+ IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
MaxFieldLength.LIMITED);
Document doc;
for (int i = 0; i < NUM_DOCS; i++) {
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java Sat Feb 27 22:51:44 2010
@@ -1,12 +1,11 @@
package org.apache.lucene.index;
-import junit.framework.TestCase;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
import java.util.Collections;
/*
@@ -24,13 +23,12 @@
*
*/
-
-public class TestTermVectorAccessor extends TestCase {
+public class TestTermVectorAccessor extends LuceneTestCase {
public void test() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(Version.LUCENE_CURRENT, Collections.emptySet()), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(TEST_VERSION_CURRENT, Collections.emptySet()), true, IndexWriter.MaxFieldLength.UNLIMITED);
Document doc;
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/ChainedFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/ChainedFilterTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/ChainedFilterTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/ChainedFilterTest.java Sat Feb 27 22:51:44 2010
@@ -20,8 +20,6 @@
import java.util.Calendar;
import java.util.GregorianCalendar;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
@@ -43,9 +41,9 @@
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
-public class ChainedFilterTest extends TestCase {
+public class ChainedFilterTest extends LuceneTestCase {
public static final int MAX = 500;
private RAMDirectory directory;
@@ -57,10 +55,11 @@
private QueryWrapperFilter sueFilter;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
+ super.setUp();
directory = new RAMDirectory();
IndexWriter writer =
- new IndexWriter(directory, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
Calendar cal = new GregorianCalendar();
cal.clear();
@@ -188,7 +187,7 @@
public void testWithCachingFilter() throws Exception {
Directory dir = new RAMDirectory();
- Analyzer analyzer = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer analyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
IndexWriter writer = new IndexWriter(dir, analyzer, true, MaxFieldLength.LIMITED);
writer.close();
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java Sat Feb 27 22:51:44 2010
@@ -18,30 +18,10 @@
package org.apache.lucene.misc;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.Similarity;
-import org.apache.lucene.search.DefaultSimilarity;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.PhraseQuery;
-import org.apache.lucene.search.DisjunctionMaxQuery;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanClause.Occur;
-
-import junit.framework.Test;
import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import java.io.File;
-import java.math.BigDecimal;
-import java.util.Random;
-import java.util.Date;
-import java.util.List;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
+import org.apache.lucene.search.DefaultSimilarity;
+import org.apache.lucene.search.Similarity;
/**
* Test of the SweetSpotSimilarity
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java Sat Feb 27 22:51:44 2010
@@ -19,8 +19,6 @@
import java.io.IOException;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -37,12 +35,13 @@
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
/**
* Tests changing the norms after changing the simularity
*/
-public class TestLengthNormModifier extends TestCase {
+public class TestLengthNormModifier extends LuceneTestCase {
+
public TestLengthNormModifier(String name) {
super(name);
}
@@ -60,8 +59,9 @@
};
@Override
- public void setUp() throws Exception {
- IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(Version.LUCENE_CURRENT), true, MaxFieldLength.UNLIMITED);
+ protected void setUp() throws Exception {
+ super.setUp();
+ IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, MaxFieldLength.UNLIMITED);
for (int i = 0; i < NUM_DOCS; i++) {
Document d = new Document();