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 20:14:09 UTC
svn commit: r917019 [5/8] - in /lucene/java/trunk: ./
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/lucene/analysis/br/ con...
Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java Sat Feb 27 19:14:01 2010
@@ -19,8 +19,6 @@
import java.io.IOException;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -28,18 +26,17 @@
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
-public class BooleanFilterTest extends TestCase
-{
+public class BooleanFilterTest extends LuceneTestCase {
private RAMDirectory directory;
private IndexReader reader;
@Override
- protected 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);
+ IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
//Add series of docs with filterable fields : acces rights, prices, dates and "in-stock" flags
addDoc(writer, "admin guest", "010", "20040101","Y");
Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java Sat Feb 27 19:14:01 2010
@@ -20,8 +20,6 @@
import java.io.IOException;
import java.util.HashSet;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -30,9 +28,9 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
-public class DuplicateFilterTest extends TestCase
-{
+public class DuplicateFilterTest extends LuceneTestCase {
private static final String KEY_FIELD = "url";
private RAMDirectory directory;
private IndexReader reader;
@@ -40,10 +38,10 @@
private IndexSearcher searcher;
@Override
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
+ super.setUp();
directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
//Add series of docs with filterable fields : url, text and dates flags
addDoc(writer, "http://lucene.apache.org", "lucene 1.4.3 available", "20040101");
@@ -62,11 +60,11 @@
}
@Override
- protected void tearDown() throws Exception
- {
+ protected void tearDown() throws Exception {
reader.close();
searcher.close();
directory.close();
+ super.tearDown();
}
private void addDoc(IndexWriter writer, String url, String text, String date) throws IOException
Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java Sat Feb 27 19:14:01 2010
@@ -20,8 +20,6 @@
import java.io.IOException;
import java.util.HashSet;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
@@ -30,17 +28,16 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
-public class FuzzyLikeThisQueryTest extends TestCase
-{
+public class FuzzyLikeThisQueryTest extends LuceneTestCase {
private RAMDirectory directory;
private IndexSearcher searcher;
- private Analyzer analyzer=new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ private Analyzer analyzer=new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
@Override
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
+ super.setUp();
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, analyzer,true, MaxFieldLength.UNLIMITED);
@@ -115,7 +112,7 @@
}
public void testFuzzyLikeThisQueryEquals() {
- Analyzer analyzer = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer analyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
FuzzyLikeThisQuery fltq1 = new FuzzyLikeThisQuery(10, analyzer);
fltq1.addTerms("javi", "subject", 0.5f, 2);
FuzzyLikeThisQuery fltq2 = new FuzzyLikeThisQuery(10, analyzer);
Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java Sat Feb 27 19:14:01 2010
@@ -19,8 +19,6 @@
import java.util.HashSet;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -29,11 +27,11 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.OpenBitSet;
-import org.apache.lucene.util.Version;
-public class TermsFilterTest extends TestCase
-{
+public class TermsFilterTest extends LuceneTestCase {
+
public void testCachability() throws Exception
{
TermsFilter a=new TermsFilter();
@@ -56,7 +54,7 @@
{
String fieldName="field1";
RAMDirectory rd=new RAMDirectory();
- IndexWriter w=new IndexWriter(rd,new WhitespaceAnalyzer(Version.LUCENE_CURRENT),MaxFieldLength.UNLIMITED);
+ IndexWriter w=new IndexWriter(rd,new WhitespaceAnalyzer(TEST_VERSION_CURRENT),MaxFieldLength.UNLIMITED);
for (int i = 0; i < 100; i++)
{
Document doc=new Document();
Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java Sat Feb 27 19:14:01 2010
@@ -43,8 +43,9 @@
@Override
protected void setUp() throws Exception {
+ super.setUp();
directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT),
+ IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(TEST_VERSION_CURRENT),
true, MaxFieldLength.UNLIMITED);
// Add series of docs with specific information for MoreLikeThis
@@ -62,6 +63,7 @@
reader.close();
searcher.close();
directory.close();
+ super.tearDown();
}
private void addDoc(IndexWriter writer, String text) throws IOException {
@@ -96,7 +98,7 @@
for (int i = 0; i < clauses.size(); i++) {
BooleanClause clause = clauses.get(i);
TermQuery tq = (TermQuery) clause.getQuery();
- Float termBoost = (Float) originalValues.get(tq.getTerm().text());
+ Float termBoost = originalValues.get(tq.getTerm().text());
assertNotNull("Expected term " + tq.getTerm().text(), termBoost);
float totalBoost = termBoost.floatValue() * boostFactor;
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java Sat Feb 27 19:14:01 2010
@@ -45,7 +45,7 @@
*/
public abstract class QueryConfigHandler extends AttributeSource {
- private LinkedList<FieldConfigListener> listeners = new LinkedList<FieldConfigListener>();;
+ private LinkedList<FieldConfigListener> listeners = new LinkedList<FieldConfigListener>();
/**
* Returns an implementation of
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java Sat Feb 27 19:14:01 2010
@@ -77,7 +77,7 @@
@SuppressWarnings("unchecked")
public MultiFieldQueryParserWrapper(String[] fields, Analyzer analyzer, Map boosts) {
this(fields, analyzer);
- StandardQueryParser qpHelper = (StandardQueryParser) getQueryParserHelper();
+ StandardQueryParser qpHelper = getQueryParserHelper();
qpHelper.setMultiFields(fields);
qpHelper.setFieldsBoost(boosts);
@@ -113,7 +113,7 @@
public MultiFieldQueryParserWrapper(String[] fields, Analyzer analyzer) {
super(null, analyzer);
- StandardQueryParser qpHelper = (StandardQueryParser) getQueryParserHelper();
+ StandardQueryParser qpHelper = getQueryParserHelper();
qpHelper.setAnalyzer(analyzer);
qpHelper.setMultiFields(fields);
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java Sat Feb 27 19:14:01 2010
@@ -345,7 +345,7 @@
try {
QueryNode queryTree = this.syntaxParser.parse(query, getField());
queryTree = this.processorPipeline.process(queryTree);
- return (Query) this.builder.build(queryTree);
+ return this.builder.build(queryTree);
} catch (QueryNodeException e) {
throw new ParseException("parse exception");
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/BoostAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/BoostAttributeImpl.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/BoostAttributeImpl.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/BoostAttributeImpl.java Sat Feb 27 19:14:01 2010
@@ -62,7 +62,7 @@
@Override
public boolean equals(Object other) {
- if (other instanceof BoostAttributeImpl && other != null
+ if (other instanceof BoostAttributeImpl
&& ((BoostAttributeImpl) other).boost == this.boost) {
return true;
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/DefaultPhraseSlopAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/DefaultPhraseSlopAttributeImpl.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/DefaultPhraseSlopAttributeImpl.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/DefaultPhraseSlopAttributeImpl.java Sat Feb 27 19:14:01 2010
@@ -62,7 +62,6 @@
public boolean equals(Object other) {
if (other instanceof DefaultPhraseSlopAttributeImpl
- && other != null
&& ((DefaultPhraseSlopAttributeImpl) other).defaultPhraseSlop == this.defaultPhraseSlop) {
return true;
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java Sat Feb 27 19:14:01 2010
@@ -66,7 +66,7 @@
@Override
public boolean equals(Object other) {
- if (other instanceof FieldBoostMapAttributeImpl && other != null
+ if (other instanceof FieldBoostMapAttributeImpl
&& ((FieldBoostMapAttributeImpl) other).boosts.equals(this.boosts) ) {
return true;
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldDateResolutionMapAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldDateResolutionMapAttributeImpl.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldDateResolutionMapAttributeImpl.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldDateResolutionMapAttributeImpl.java Sat Feb 27 19:14:01 2010
@@ -63,7 +63,7 @@
@Override
public boolean equals(Object other) {
- if (other instanceof FieldDateResolutionMapAttributeImpl && other != null
+ if (other instanceof FieldDateResolutionMapAttributeImpl
&& ((FieldDateResolutionMapAttributeImpl) other).dateRes.equals(this.dateRes) ) {
return true;
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttributeImpl.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttributeImpl.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttributeImpl.java Sat Feb 27 19:14:01 2010
@@ -72,7 +72,7 @@
@Override
public boolean equals(Object other) {
- if (other instanceof FuzzyAttributeImpl && other != null
+ if (other instanceof FuzzyAttributeImpl
&& ((FuzzyAttributeImpl) other).prefixLength == this.prefixLength) {
return true;
Modified: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java Sat Feb 27 19:14:01 2010
@@ -61,7 +61,6 @@
public boolean equals(Object other) {
if (other instanceof PositionIncrementsAttributeImpl
- && other != null
&& ((PositionIncrementsAttributeImpl) other).positionIncrementsEnabled == this.positionIncrementsEnabled) {
return true;
Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerQPHelper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerQPHelper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerQPHelper.java Sat Feb 27 19:14:01 2010
@@ -17,12 +17,10 @@
* limitations under the License.
*/
-import java.io.IOException;
import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
-import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardTokenizer;
@@ -31,10 +29,8 @@
import org.apache.lucene.analysis.tokenattributes.TermAttribute;
import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
import org.apache.lucene.queryParser.core.QueryNodeException;
-import org.apache.lucene.queryParser.standard.StandardQueryParser;
import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute.Operator;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.Version;
/**
* This test case is a copy of the core Lucene query parser test, it was adapted
@@ -156,9 +152,9 @@
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
- TokenStream result = new StandardTokenizer(Version.LUCENE_CURRENT, reader);
+ TokenStream result = new StandardTokenizer(TEST_VERSION_CURRENT, reader);
result = new TestFilter(result);
- result = new LowerCaseFilter(Version.LUCENE_CURRENT, result);
+ result = new LowerCaseFilter(TEST_VERSION_CURRENT, result);
return result;
}
}
@@ -226,9 +222,9 @@
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
- TokenStream result = new StandardTokenizer(Version.LUCENE_CURRENT, reader);
+ TokenStream result = new StandardTokenizer(TEST_VERSION_CURRENT, reader);
result = new TestPosIncrementFilter(result);
- result = new LowerCaseFilter(Version.LUCENE_CURRENT, result);
+ result = new LowerCaseFilter(TEST_VERSION_CURRENT, result);
return result;
}
}
Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerWrapper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerWrapper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerWrapper.java Sat Feb 27 19:14:01 2010
@@ -17,12 +17,10 @@
* limitations under the License.
*/
-import java.io.IOException;
import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
-import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardTokenizer;
@@ -31,9 +29,7 @@
import org.apache.lucene.analysis.tokenattributes.TermAttribute;
import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.standard.QueryParserWrapper;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.Version;
/**
* This test case is a copy of the core Lucene query parser test, it was adapted
@@ -150,9 +146,9 @@
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
- TokenStream result = new StandardTokenizer(Version.LUCENE_CURRENT, reader);
+ TokenStream result = new StandardTokenizer(TEST_VERSION_CURRENT, reader);
result = new TestFilter(result);
- result = new LowerCaseFilter(Version.LUCENE_CURRENT, result);
+ result = new LowerCaseFilter(TEST_VERSION_CURRENT, result);
return result;
}
}
@@ -220,9 +216,9 @@
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
- TokenStream result = new StandardTokenizer(Version.LUCENE_CURRENT, reader);
+ TokenStream result = new StandardTokenizer(TEST_VERSION_CURRENT, reader);
result = new TestPosIncrementFilter(result);
- result = new LowerCaseFilter(Version.LUCENE_CURRENT, result);
+ result = new LowerCaseFilter(TEST_VERSION_CURRENT, result);
return result;
}
}
Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java Sat Feb 27 19:14:01 2010
@@ -22,14 +22,12 @@
import java.util.Map;
import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.queryParser.core.QueryNodeException;
-import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler;
import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute.Operator;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.IndexSearcher;
@@ -83,7 +81,7 @@
String[] fields = { "b", "t" };
StandardQueryParser mfqp = new StandardQueryParser();
mfqp.setMultiFields(fields);
- mfqp.setAnalyzer(new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ mfqp.setAnalyzer(new StandardAnalyzer(TEST_VERSION_CURRENT));
Query q = mfqp.parse("one", null);
assertEquals("b:one t:one", q.toString());
@@ -153,7 +151,7 @@
StandardQueryParser mfqp = new StandardQueryParser();
mfqp.setMultiFields(fields);
mfqp.setFieldsBoost(boosts);
- mfqp.setAnalyzer(new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ mfqp.setAnalyzer(new StandardAnalyzer(TEST_VERSION_CURRENT));
// Check for simple
Query q = mfqp.parse("one", null);
@@ -181,24 +179,24 @@
public void testStaticMethod1() throws QueryNodeException {
String[] fields = { "b", "t" };
String[] queries = { "one", "two" };
- Query q = QueryParserUtil.parse(queries, fields, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ Query q = QueryParserUtil.parse(queries, fields, new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("b:one t:two", q.toString());
String[] queries2 = { "+one", "+two" };
- q = QueryParserUtil.parse(queries2, fields, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ q = QueryParserUtil.parse(queries2, fields, new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("(+b:one) (+t:two)", q.toString());
String[] queries3 = { "one", "+two" };
- q = QueryParserUtil.parse(queries3, fields, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ q = QueryParserUtil.parse(queries3, fields, new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("b:one (+t:two)", q.toString());
String[] queries4 = { "one +more", "+two" };
- q = QueryParserUtil.parse(queries4, fields, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ q = QueryParserUtil.parse(queries4, fields, new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("(b:one +b:more) (+t:two)", q.toString());
String[] queries5 = { "blah" };
try {
- q = QueryParserUtil.parse(queries5, fields, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ q = QueryParserUtil.parse(queries5, fields, new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -222,15 +220,15 @@
BooleanClause.Occur[] flags = { BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT };
Query q = QueryParserUtil.parse("one", fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+b:one -t:one", q.toString());
- q = QueryParserUtil.parse("one two", fields, flags, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ q = QueryParserUtil.parse("one two", fields, flags, new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+(b:one b:two) -(t:one t:two)", q.toString());
try {
BooleanClause.Occur[] flags2 = { BooleanClause.Occur.MUST };
- q = QueryParserUtil.parse("blah", fields, flags2, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ q = QueryParserUtil.parse("blah", fields, flags2, new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -243,19 +241,19 @@
BooleanClause.Occur.MUST_NOT };
StandardQueryParser parser = new StandardQueryParser();
parser.setMultiFields(fields);
- parser.setAnalyzer(new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ parser.setAnalyzer(new StandardAnalyzer(TEST_VERSION_CURRENT));
Query q = QueryParserUtil.parse("one", fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));// , fields, flags, new
+ new StandardAnalyzer(TEST_VERSION_CURRENT));// , fields, flags, new
// StandardAnalyzer());
assertEquals("+b:one -t:one", q.toString());
- q = QueryParserUtil.parse("one two", fields, flags, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ q = QueryParserUtil.parse("one two", fields, flags, new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+(b:one b:two) -(t:one t:two)", q.toString());
try {
BooleanClause.Occur[] flags2 = { BooleanClause.Occur.MUST };
- q = QueryParserUtil.parse("blah", fields, flags2, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ q = QueryParserUtil.parse("blah", fields, flags2, new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -268,13 +266,13 @@
BooleanClause.Occur[] flags = { BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT, BooleanClause.Occur.SHOULD };
Query q = QueryParserUtil.parse(queries, fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+f1:one -f2:two f3:three", q.toString());
try {
BooleanClause.Occur[] flags2 = { BooleanClause.Occur.MUST };
q = QueryParserUtil
- .parse(queries, fields, flags2, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ .parse(queries, fields, flags2, new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -287,13 +285,13 @@
BooleanClause.Occur[] flags = { BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT };
Query q = QueryParserUtil.parse(queries, fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+b:one -t:two", q.toString());
try {
BooleanClause.Occur[] flags2 = { BooleanClause.Occur.MUST };
q = QueryParserUtil
- .parse(queries, fields, flags2, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ .parse(queries, fields, flags2, new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -319,7 +317,7 @@
}
public void testStopWordSearching() throws Exception {
- Analyzer analyzer = new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT);
+ Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
Directory ramDir = new RAMDirectory();
IndexWriter iw = new IndexWriter(ramDir, analyzer, true,
IndexWriter.MaxFieldLength.LIMITED);
@@ -345,7 +343,7 @@
* Return empty tokens for field "f1".
*/
private static class AnalyzerReturningNull extends Analyzer {
- StandardAnalyzer stdAnalyzer = new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT);
+ StandardAnalyzer stdAnalyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
public AnalyzerReturningNull() {
}
Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java Sat Feb 27 19:14:01 2010
@@ -22,7 +22,6 @@
import java.util.Map;
import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
@@ -78,7 +77,7 @@
public void testSimple() throws Exception {
String[] fields = { "b", "t" };
MultiFieldQueryParserWrapper mfqp = new MultiFieldQueryParserWrapper(
- fields, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ fields, new StandardAnalyzer(TEST_VERSION_CURRENT));
Query q = mfqp.parse("one");
assertEquals("b:one t:one", q.toString());
@@ -146,7 +145,7 @@
boosts.put("t", Float.valueOf(10));
String[] fields = { "b", "t" };
MultiFieldQueryParserWrapper mfqp = new MultiFieldQueryParserWrapper(
- fields, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT), boosts);
+ fields, new StandardAnalyzer(TEST_VERSION_CURRENT), boosts);
// Check for simple
Query q = mfqp.parse("one");
@@ -175,28 +174,28 @@
String[] fields = { "b", "t" };
String[] queries = { "one", "two" };
Query q = MultiFieldQueryParserWrapper.parse(queries, fields,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("b:one t:two", q.toString());
String[] queries2 = { "+one", "+two" };
q = MultiFieldQueryParserWrapper.parse(queries2, fields,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("(+b:one) (+t:two)", q.toString());
String[] queries3 = { "one", "+two" };
q = MultiFieldQueryParserWrapper.parse(queries3, fields,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("b:one (+t:two)", q.toString());
String[] queries4 = { "one +more", "+two" };
q = MultiFieldQueryParserWrapper.parse(queries4, fields,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("(b:one +b:more) (+t:two)", q.toString());
String[] queries5 = { "blah" };
try {
q = MultiFieldQueryParserWrapper.parse(queries5, fields,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -220,17 +219,17 @@
BooleanClause.Occur[] flags = { BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT };
Query q = MultiFieldQueryParserWrapper.parse("one", fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+b:one -t:one", q.toString());
q = MultiFieldQueryParserWrapper.parse("one two", fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+(b:one b:two) -(t:one t:two)", q.toString());
try {
BooleanClause.Occur[] flags2 = { BooleanClause.Occur.MUST };
q = MultiFieldQueryParserWrapper.parse("blah", fields, flags2,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -243,21 +242,19 @@
// MultiFieldQueryParserWrapper.PROHIBITED_FIELD};
BooleanClause.Occur[] flags = { BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT };
- MultiFieldQueryParserWrapper parser = new MultiFieldQueryParserWrapper(
- fields, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
Query q = MultiFieldQueryParserWrapper.parse("one", fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));// , fields, flags, new StandardAnalyzer());
+ new StandardAnalyzer(TEST_VERSION_CURRENT));// , fields, flags, new StandardAnalyzer());
assertEquals("+b:one -t:one", q.toString());
q = MultiFieldQueryParserWrapper.parse("one two", fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+(b:one b:two) -(t:one t:two)", q.toString());
try {
BooleanClause.Occur[] flags2 = { BooleanClause.Occur.MUST };
q = MultiFieldQueryParserWrapper.parse("blah", fields, flags2,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -270,13 +267,13 @@
BooleanClause.Occur[] flags = { BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT, BooleanClause.Occur.SHOULD };
Query q = MultiFieldQueryParserWrapper.parse(queries, fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+f1:one -f2:two f3:three", q.toString());
try {
BooleanClause.Occur[] flags2 = { BooleanClause.Occur.MUST };
q = MultiFieldQueryParserWrapper.parse(queries, fields, flags2,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -289,13 +286,13 @@
BooleanClause.Occur[] flags = { BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT };
Query q = MultiFieldQueryParserWrapper.parse(queries, fields, flags,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
assertEquals("+b:one -t:two", q.toString());
try {
BooleanClause.Occur[] flags2 = { BooleanClause.Occur.MUST };
q = MultiFieldQueryParserWrapper.parse(queries, fields, flags2,
- new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
fail();
} catch (IllegalArgumentException e) {
// expected exception, array length differs
@@ -319,7 +316,7 @@
}
public void testStopWordSearching() throws Exception {
- Analyzer analyzer = new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT);
+ Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
Directory ramDir = new RAMDirectory();
IndexWriter iw = new IndexWriter(ramDir, analyzer, true,
IndexWriter.MaxFieldLength.LIMITED);
@@ -343,7 +340,7 @@
* Return empty tokens for field "f1".
*/
private static class AnalyzerReturningNull extends Analyzer {
- StandardAnalyzer stdAnalyzer = new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT);
+ StandardAnalyzer stdAnalyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
public AnalyzerReturningNull() {
}
Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java Sat Feb 27 19:14:01 2010
@@ -38,7 +38,6 @@
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.analysis.StopAnalyzer;
import org.apache.lucene.analysis.StopFilter;
-import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
@@ -78,7 +77,6 @@
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.store.MockRAMDirectory;
import org.apache.lucene.util.LocalizedTestCase;
-import org.apache.lucene.util.Version;
/**
* This test case is a copy of the core Lucene query parser test, it was adapted
@@ -144,7 +142,7 @@
/** Filters LowerCaseTokenizer with StopFilter. */
@Override
public final TokenStream tokenStream(String fieldName, Reader reader) {
- return new QPTestFilter(new LowerCaseTokenizer(Version.LUCENE_CURRENT, reader));
+ return new QPTestFilter(new LowerCaseTokenizer(TEST_VERSION_CURRENT, reader));
}
}
@@ -197,14 +195,14 @@
private int originalMaxClauses;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
originalMaxClauses = BooleanQuery.getMaxClauseCount();
}
public StandardQueryParser getParser(Analyzer a) throws Exception {
if (a == null)
- a = new SimpleAnalyzer(Version.LUCENE_CURRENT);
+ a = new SimpleAnalyzer(TEST_VERSION_CURRENT);
StandardQueryParser qp = new StandardQueryParser();
qp.setAnalyzer(a);
@@ -294,7 +292,7 @@
public Query getQueryDOA(String query, Analyzer a) throws Exception {
if (a == null)
- a = new SimpleAnalyzer(Version.LUCENE_CURRENT);
+ a = new SimpleAnalyzer(TEST_VERSION_CURRENT);
StandardQueryParser qp = new StandardQueryParser();
qp.setAnalyzer(a);
qp.setDefaultOperator(Operator.AND);
@@ -314,7 +312,7 @@
}
public void testConstantScoreAutoRewrite() throws Exception {
- StandardQueryParser qp = new StandardQueryParser(new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ StandardQueryParser qp = new StandardQueryParser(new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
Query q = qp.parse("foo*bar", "field");
assertTrue(q instanceof WildcardQuery);
assertEquals(MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, ((MultiTermQuery) q).getRewriteMethod());
@@ -339,9 +337,9 @@
public void testSimple() throws Exception {
assertQueryEquals("\"term germ\"~2", null, "\"term germ\"~2");
assertQueryEquals("term term term", null, "term term term");
- assertQueryEquals("t�rm term term", new WhitespaceAnalyzer(Version.LUCENE_CURRENT),
+ assertQueryEquals("t�rm term term", new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
"t�rm term term");
- assertQueryEquals("�mlaut", new WhitespaceAnalyzer(Version.LUCENE_CURRENT), "�mlaut");
+ assertQueryEquals("�mlaut", new WhitespaceAnalyzer(TEST_VERSION_CURRENT), "�mlaut");
assertQueryEquals("\"\"", new KeywordAnalyzer(), "");
assertQueryEquals("foo:\"\"", new KeywordAnalyzer(), "foo:");
@@ -398,7 +396,7 @@
}
public void testPunct() throws Exception {
- Analyzer a = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer a = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
assertQueryEquals("a&b", a, "a&b");
assertQueryEquals("a&&b", a, "a&&b");
assertQueryEquals(".NET", a, ".NET");
@@ -419,7 +417,7 @@
assertQueryEquals("term 1.0 1 2", null, "term");
assertQueryEquals("term term1 term2", null, "term term term");
- Analyzer a = new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT);
+ Analyzer a = new StandardAnalyzer(TEST_VERSION_CURRENT);
assertQueryEquals("3", a, "3");
assertQueryEquals("term 1.0 1 2", a, "term 1.0 1 2");
assertQueryEquals("term term1 term2", a, "term term1 term2");
@@ -573,7 +571,7 @@
public void testFarsiRangeCollating() throws Exception {
RAMDirectory ramDir = new RAMDirectory();
- IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true,
+ IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("content", "\u0633\u0627\u0628", Field.Store.YES,
@@ -583,7 +581,7 @@
IndexSearcher is = new IndexSearcher(ramDir, true);
StandardQueryParser qp = new StandardQueryParser();
- qp.setAnalyzer(new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ qp.setAnalyzer(new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
// Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
// RuleBasedCollator. However, the Arabic Locale seems to order the
@@ -737,7 +735,7 @@
}
public void testEscaped() throws Exception {
- Analyzer a = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer a = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
/*
* assertQueryEquals("\\[brackets", a, "\\[brackets");
@@ -836,7 +834,7 @@
}
public void testQueryStringEscaping() throws Exception {
- Analyzer a = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer a = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
assertEscapedQueryEquals("a-b:c", a, "a\\-b\\:c");
assertEscapedQueryEquals("a+b:c", a, "a\\+b\\:c");
@@ -905,7 +903,7 @@
}
public void testBoost() throws Exception {
- StandardAnalyzer oneStopAnalyzer = new StandardAnalyzer(Version.LUCENE_CURRENT, Collections.singleton("on"));
+ StandardAnalyzer oneStopAnalyzer = new StandardAnalyzer(TEST_VERSION_CURRENT, Collections.singleton("on"));
StandardQueryParser qp = new StandardQueryParser();
qp.setAnalyzer(oneStopAnalyzer);
@@ -921,7 +919,7 @@
assertNotNull(q);
StandardQueryParser qp2 = new StandardQueryParser();
- qp2.setAnalyzer(new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ qp2.setAnalyzer(new StandardAnalyzer(TEST_VERSION_CURRENT));
q = qp2.parse("the^3", "field");
// "the" is a stop word so the result is an empty query:
@@ -951,7 +949,7 @@
public void testCustomQueryParserWildcard() {
try {
- new QPTestParser(new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("a?t", "contents");
+ new QPTestParser(new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("a?t", "contents");
fail("Wildcard queries should not be allowed");
} catch (QueryNodeException expected) {
// expected exception
@@ -960,7 +958,7 @@
public void testCustomQueryParserFuzzy() throws Exception {
try {
- new QPTestParser(new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("xunit~", "contents");
+ new QPTestParser(new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("xunit~", "contents");
fail("Fuzzy queries should not be allowed");
} catch (QueryNodeException expected) {
// expected exception
@@ -971,7 +969,7 @@
BooleanQuery.setMaxClauseCount(2);
try {
StandardQueryParser qp = new StandardQueryParser();
- qp.setAnalyzer(new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ qp.setAnalyzer(new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
qp.parse("one two three", "field");
fail("ParseException expected due to too many boolean clauses");
@@ -985,7 +983,7 @@
*/
public void testPrecedence() throws Exception {
StandardQueryParser qp = new StandardQueryParser();
- qp.setAnalyzer(new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ qp.setAnalyzer(new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
Query query1 = qp.parse("A AND B OR C AND D", "field");
Query query2 = qp.parse("+A +B +C +D", "field");
@@ -996,7 +994,7 @@
public void testLocalDateFormat() throws IOException, QueryNodeException {
RAMDirectory ramDir = new RAMDirectory();
- IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true,
+ IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
addDateDoc("b", 2005, 12, 4, 22, 15, 00, iw);
@@ -1077,7 +1075,7 @@
public void testStopwords() throws Exception {
StandardQueryParser qp = new StandardQueryParser();
qp.setAnalyzer(
- new StopAnalyzer(Version.LUCENE_CURRENT, StopFilter.makeStopSet(Version.LUCENE_CURRENT, "the", "foo" )));
+ new StopAnalyzer(TEST_VERSION_CURRENT, StopFilter.makeStopSet(TEST_VERSION_CURRENT, "the", "foo" )));
Query result = qp.parse("a:the OR a:foo", "a");
assertNotNull("result is null and it shouldn't be", result);
@@ -1100,7 +1098,7 @@
public void testPositionIncrement() throws Exception {
StandardQueryParser qp = new StandardQueryParser();
qp.setAnalyzer(
- new StopAnalyzer(Version.LUCENE_CURRENT, StopFilter.makeStopSet(Version.LUCENE_CURRENT, "the", "in", "are", "this" )));
+ new StopAnalyzer(TEST_VERSION_CURRENT, StopFilter.makeStopSet(TEST_VERSION_CURRENT, "the", "in", "are", "this" )));
qp.setEnablePositionIncrements(true);
@@ -1121,7 +1119,7 @@
public void testMatchAllDocs() throws Exception {
StandardQueryParser qp = new StandardQueryParser();
- qp.setAnalyzer(new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ qp.setAnalyzer(new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
assertEquals(new MatchAllDocsQuery(), qp.parse("*:*", "field"));
assertEquals(new MatchAllDocsQuery(), qp.parse("(*:*)", "field"));
@@ -1133,7 +1131,7 @@
private void assertHits(int expected, String query, IndexSearcher is)
throws IOException, QueryNodeException {
StandardQueryParser qp = new StandardQueryParser();
- qp.setAnalyzer(new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ qp.setAnalyzer(new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
qp.setLocale(Locale.ENGLISH);
Query q = qp.parse(query, "date");
@@ -1153,9 +1151,9 @@
}
@Override
- public void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
BooleanQuery.setMaxClauseCount(originalMaxClauses);
+ super.tearDown();
}
private class CannedTokenStream extends TokenStream {
Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java Sat Feb 27 19:14:01 2010
@@ -36,7 +36,6 @@
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.analysis.StopAnalyzer;
import org.apache.lucene.analysis.StopFilter;
-import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
@@ -73,7 +72,6 @@
import org.apache.lucene.search.WildcardQuery;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.LocalizedTestCase;
-import org.apache.lucene.util.Version;
/**
* This test case is a copy of the core Lucene query parser test, it was adapted
@@ -139,7 +137,7 @@
/** Filters LowerCaseTokenizer with StopFilter. */
@Override
public final TokenStream tokenStream(String fieldName, Reader reader) {
- return new QPTestFilter(new LowerCaseTokenizer(Version.LUCENE_CURRENT, reader));
+ return new QPTestFilter(new LowerCaseTokenizer(TEST_VERSION_CURRENT, reader));
}
}
@@ -210,14 +208,14 @@
private int originalMaxClauses;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
originalMaxClauses = BooleanQuery.getMaxClauseCount();
}
public QueryParserWrapper getParser(Analyzer a) throws Exception {
if (a == null)
- a = new SimpleAnalyzer(Version.LUCENE_CURRENT);
+ a = new SimpleAnalyzer(TEST_VERSION_CURRENT);
QueryParserWrapper qp = new QueryParserWrapper("field", a);
qp.setDefaultOperator(QueryParserWrapper.OR_OPERATOR);
return qp;
@@ -302,7 +300,7 @@
public Query getQueryDOA(String query, Analyzer a) throws Exception {
if (a == null)
- a = new SimpleAnalyzer(Version.LUCENE_CURRENT);
+ a = new SimpleAnalyzer(TEST_VERSION_CURRENT);
QueryParserWrapper qp = new QueryParserWrapper("field", a);
qp.setDefaultOperator(QueryParserWrapper.AND_OPERATOR);
return qp.parse(query);
@@ -329,9 +327,9 @@
public void testSimple() throws Exception {
assertQueryEquals("\"term germ\"~2", null, "\"term germ\"~2");
assertQueryEquals("term term term", null, "term term term");
- assertQueryEquals("t�rm term term", new WhitespaceAnalyzer(Version.LUCENE_CURRENT),
+ assertQueryEquals("t�rm term term", new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
"t�rm term term");
- assertQueryEquals("�mlaut", new WhitespaceAnalyzer(Version.LUCENE_CURRENT), "�mlaut");
+ assertQueryEquals("�mlaut", new WhitespaceAnalyzer(TEST_VERSION_CURRENT), "�mlaut");
assertQueryEquals("\"\"", new KeywordAnalyzer(), "");
assertQueryEquals("foo:\"\"", new KeywordAnalyzer(), "foo:");
@@ -386,7 +384,7 @@
"+(title:dog title:cat) -author:\"bob dole\"");
QueryParserWrapper qp = new QueryParserWrapper("field",
- new StandardAnalyzer(Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
// make sure OR is the default:
assertEquals(QueryParserWrapper.OR_OPERATOR, qp.getDefaultOperator());
qp.setDefaultOperator(QueryParserWrapper.AND_OPERATOR);
@@ -396,7 +394,7 @@
}
public void testPunct() throws Exception {
- Analyzer a = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer a = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
assertQueryEquals("a&b", a, "a&b");
assertQueryEquals("a&&b", a, "a&&b");
assertQueryEquals(".NET", a, ".NET");
@@ -417,7 +415,7 @@
assertQueryEquals("term 1.0 1 2", null, "term");
assertQueryEquals("term term1 term2", null, "term term term");
- Analyzer a = new StandardAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer a = new StandardAnalyzer(TEST_VERSION_CURRENT);
assertQueryEquals("3", a, "3");
assertQueryEquals("term 1.0 1 2", a, "term 1.0 1 2");
assertQueryEquals("term term1 term2", a, "term term1 term2");
@@ -552,7 +550,7 @@
assertEquals(MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, ((TermRangeQuery)getQuery("[ a TO z]", null)).getRewriteMethod());
QueryParserWrapper qp = new QueryParserWrapper("field",
- new SimpleAnalyzer(Version.LUCENE_CURRENT));
+ new SimpleAnalyzer(TEST_VERSION_CURRENT));
qp.setMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
assertEquals(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE,((TermRangeQuery)qp.parse("[ a TO z]")).getRewriteMethod());
@@ -571,7 +569,7 @@
public void testFarsiRangeCollating() throws Exception {
RAMDirectory ramDir = new RAMDirectory();
- IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true,
+ IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("content", "\u0633\u0627\u0628", Field.Store.YES,
@@ -581,7 +579,7 @@
IndexSearcher is = new IndexSearcher(ramDir, true);
QueryParserWrapper qp = new QueryParserWrapper("content",
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
// Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
// RuleBasedCollator. However, the Arabic Locale seems to order the Farsi
@@ -683,7 +681,7 @@
final String monthField = "month";
final String hourField = "hour";
QueryParserWrapper qp = new QueryParserWrapper("field",
- new SimpleAnalyzer(Version.LUCENE_CURRENT));
+ new SimpleAnalyzer(TEST_VERSION_CURRENT));
// Don't set any date resolution and verify if DateField is used
assertDateRangeQueryEquals(qp, defaultField, startDate, endDate,
@@ -727,7 +725,7 @@
}
public void testEscaped() throws Exception {
- Analyzer a = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer a = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
/*
* assertQueryEquals("\\[brackets", a, "\\[brackets");
@@ -824,7 +822,7 @@
}
public void testQueryStringEscaping() throws Exception {
- Analyzer a = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer a = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
assertEscapedQueryEquals("a-b:c", a, "a\\-b\\:c");
assertEscapedQueryEquals("a+b:c", a, "a\\+b\\:c");
@@ -893,7 +891,7 @@
}
public void testBoost() throws Exception {
- StandardAnalyzer oneStopAnalyzer = new StandardAnalyzer(Version.LUCENE_CURRENT, Collections.singleton("on"));
+ StandardAnalyzer oneStopAnalyzer = new StandardAnalyzer(TEST_VERSION_CURRENT, Collections.singleton("on"));
QueryParserWrapper qp = new QueryParserWrapper("field", oneStopAnalyzer);
Query q = qp.parse("on^1.0");
assertNotNull(q);
@@ -907,7 +905,7 @@
assertNotNull(q);
QueryParserWrapper qp2 = new QueryParserWrapper("field",
- new StandardAnalyzer(Version.LUCENE_CURRENT));
+ new StandardAnalyzer(TEST_VERSION_CURRENT));
q = qp2.parse("the^3");
// "the" is a stop word so the result is an empty query:
assertNotNull(q);
@@ -935,7 +933,7 @@
public void testCustomQueryParserWildcard() {
try {
- new QPTestParser("contents", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("a?t");
+ new QPTestParser("contents", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("a?t");
fail("Wildcard queries should not be allowed");
} catch (ParseException expected) {
// expected exception
@@ -944,7 +942,7 @@
public void testCustomQueryParserFuzzy() throws Exception {
try {
- new QPTestParser("contents", new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("xunit~");
+ new QPTestParser("contents", new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("xunit~");
fail("Fuzzy queries should not be allowed");
} catch (ParseException expected) {
// expected exception
@@ -955,7 +953,7 @@
BooleanQuery.setMaxClauseCount(2);
try {
QueryParserWrapper qp = new QueryParserWrapper("field",
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
qp.parse("one two three");
fail("ParseException expected due to too many boolean clauses");
} catch (ParseException expected) {
@@ -968,7 +966,7 @@
*/
public void testPrecedence() throws Exception {
QueryParserWrapper qp = new QueryParserWrapper("field",
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
Query query1 = qp.parse("A AND B OR C AND D");
Query query2 = qp.parse("+A +B +C +D");
@@ -978,7 +976,7 @@
public void testLocalDateFormat() throws IOException, ParseException {
RAMDirectory ramDir = new RAMDirectory();
- IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true,
+ IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
addDateDoc("b", 2005, 12, 4, 22, 15, 00, iw);
@@ -1057,7 +1055,7 @@
}
public void testStopwords() throws Exception {
- QueryParserWrapper qp = new QueryParserWrapper("a", new StopAnalyzer(Version.LUCENE_CURRENT, StopFilter.makeStopSet(Version.LUCENE_CURRENT, "the", "foo")));
+ QueryParserWrapper qp = new QueryParserWrapper("a", new StopAnalyzer(TEST_VERSION_CURRENT, StopFilter.makeStopSet(TEST_VERSION_CURRENT, "the", "foo")));
Query result = qp.parse("a:the OR a:foo");
assertNotNull("result is null and it shouldn't be", result);
assertTrue("result is not a BooleanQuery", result instanceof BooleanQuery);
@@ -1076,7 +1074,7 @@
}
public void testPositionIncrement() throws Exception {
- QueryParserWrapper qp = new QueryParserWrapper("a", new StopAnalyzer(Version.LUCENE_CURRENT, StopFilter.makeStopSet(Version.LUCENE_CURRENT, "the", "in", "are", "this")));
+ QueryParserWrapper qp = new QueryParserWrapper("a", new StopAnalyzer(TEST_VERSION_CURRENT, StopFilter.makeStopSet(TEST_VERSION_CURRENT, "the", "in", "are", "this")));
qp.setEnablePositionIncrements(true);
String qtxt = "\"the words in poisitions pos02578 are stopped in this phrasequery\"";
// 0 2 5 7 8
@@ -1095,7 +1093,7 @@
public void testMatchAllDocs() throws Exception {
QueryParserWrapper qp = new QueryParserWrapper("field",
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
assertEquals(new MatchAllDocsQuery(), qp.parse("*:*"));
assertEquals(new MatchAllDocsQuery(), qp.parse("(*:*)"));
BooleanQuery bq = (BooleanQuery) qp.parse("+*:* -*:*");
@@ -1106,7 +1104,7 @@
private void assertHits(int expected, String query, IndexSearcher is)
throws ParseException, IOException {
QueryParserWrapper qp = new QueryParserWrapper("date",
- new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
qp.setLocale(Locale.ENGLISH);
Query q = qp.parse(query);
ScoreDoc[] hits = is.search(q, null, 1000).scoreDocs;
@@ -1125,9 +1123,9 @@
}
@Override
- public void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
BooleanQuery.setMaxClauseCount(originalMaxClauses);
+ super.tearDown();
}
}
Modified: lucene/java/trunk/contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java (original)
+++ lucene/java/trunk/contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java Sat Feb 27 19:14:01 2010
@@ -19,6 +19,7 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BooleanClause;
@@ -51,7 +52,7 @@
public Query rewrite(IndexReader reader) throws IOException {
RegexQuery orig = new RegexQuery(term);
orig.setRegexImplementation(regexImpl);
- orig.setRewriteMethod(RegexQuery.SCORING_BOOLEAN_QUERY_REWRITE);
+ orig.setRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
BooleanQuery bq = (BooleanQuery) orig.rewrite(reader);
BooleanClause[] clauses = bq.getClauses();
Modified: lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java (original)
+++ lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java Sat Feb 27 19:14:01 2010
@@ -17,7 +17,6 @@
* limitations under the License.
*/
-import junit.framework.TestCase;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
@@ -29,18 +28,19 @@
import org.apache.lucene.search.spans.SpanNearQuery;
import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
-public class TestRegexQuery extends TestCase {
+public class TestRegexQuery extends LuceneTestCase {
private IndexSearcher searcher;
private final String FN = "field";
@Override
- public void setUp() {
+ protected void setUp() throws Exception {
+ super.setUp();
RAMDirectory directory = new RAMDirectory();
try {
- IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(Version.LUCENE_CURRENT), true,
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field(FN, "the quick brown fox jumps over the lazy dog", Field.Store.NO, Field.Index.ANALYZED));
@@ -54,12 +54,9 @@
}
@Override
- public void tearDown() {
- try {
- searcher.close();
- } catch (Exception e) {
- fail(e.toString());
- }
+ protected void tearDown() throws Exception {
+ searcher.close();
+ super.tearDown();
}
private Term newTerm(String value) { return new Term(FN, value); }
Modified: lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java (original)
+++ lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java Sat Feb 27 19:14:01 2010
@@ -19,8 +19,6 @@
import java.io.IOException;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
@@ -36,16 +34,17 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
-public class TestSpanRegexQuery extends TestCase {
+public class TestSpanRegexQuery extends LuceneTestCase {
+
Directory indexStoreA = new RAMDirectory();
Directory indexStoreB = new RAMDirectory();
public void testSpanRegex() throws Exception {
RAMDirectory directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
Document doc = new Document();
// doc.add(new Field("field", "the quick brown fox jumps over the lazy dog",
// Field.Store.NO, Field.Index.ANALYZED));
@@ -110,14 +109,14 @@
Field.Index.ANALYZED_NO_NORMS));
// creating first index writer
- IndexWriter writerA = new IndexWriter(indexStoreA, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT),
+ IndexWriter writerA = new IndexWriter(indexStoreA, new StandardAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
writerA.addDocument(lDoc);
writerA.optimize();
writerA.close();
// creating second index writer
- IndexWriter writerB = new IndexWriter(indexStoreB, new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT),
+ IndexWriter writerB = new IndexWriter(indexStoreB, new StandardAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
writerB.addDocument(lDoc2);
writerB.optimize();
Modified: lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java (original)
+++ lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java Sat Feb 27 19:14:01 2010
@@ -18,9 +18,8 @@
*/
import java.io.IOException;
-import java.util.BitSet;
-import junit.framework.TestCase;
+import junit.framework.Assert;
import org.apache.lucene.index.IndexReader;
@@ -45,11 +44,11 @@
public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
Filter cachedFilter = FilterManager.getInstance().getFilter(filter);
- TestCase.assertNotNull("Filter should not be null", cachedFilter);
+ Assert.assertNotNull("Filter should not be null", cachedFilter);
if (!shouldHaveCache) {
- TestCase.assertSame("First time filter should be the same ", filter, cachedFilter);
+ Assert.assertSame("First time filter should be the same ", filter, cachedFilter);
} else {
- TestCase.assertNotSame("We should have a cached version of the filter", filter, cachedFilter);
+ Assert.assertNotSame("We should have a cached version of the filter", filter, cachedFilter);
}
if (filter instanceof CachingWrapperFilterHelper) {
Modified: lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java (original)
+++ lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java Sat Feb 27 19:14:01 2010
@@ -21,7 +21,6 @@
import java.rmi.registry.LocateRegistry;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.Version;
import org.apache.lucene.util._TestUtil;
import org.apache.lucene.analysis.SimpleAnalyzer;
@@ -58,7 +57,7 @@
private static void startServer() throws Exception {
// construct an index
RAMDirectory indexStore = new RAMDirectory();
- IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(Version.LUCENE_CURRENT), true,
+ IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED));
Modified: lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java (original)
+++ lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java Sat Feb 27 19:14:01 2010
@@ -18,7 +18,6 @@
*/
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.Version;
import org.apache.lucene.util._TestUtil;
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.document.*;
@@ -59,7 +58,7 @@
private static void startServer() throws Exception {
// construct an index
RAMDirectory indexStore = new RAMDirectory();
- IndexWriter writer = new IndexWriter(indexStore,new SimpleAnalyzer(Version.LUCENE_CURRENT),true, IndexWriter.MaxFieldLength.LIMITED);
+ IndexWriter writer = new IndexWriter(indexStore,new SimpleAnalyzer(TEST_VERSION_CURRENT),true, IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED));
doc.add(new Field("other", "other test text", Field.Store.YES, Field.Index.ANALYZED));
@@ -86,9 +85,9 @@
assertTrue("document is null and it shouldn't be", document != null);
assertEquals("test text", document.get("test"));
assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 2, document.getFields().size() == 2);
- Set ftl = new HashSet();
+ Set<String> ftl = new HashSet<String>();
ftl.add("other");
- FieldSelector fs = new SetBasedFieldSelector(ftl, Collections.EMPTY_SET);
+ FieldSelector fs = new SetBasedFieldSelector(ftl, Collections.<String>emptySet());
document = searcher.doc(0, fs);
assertTrue("document is null and it shouldn't be", document != null);
assertTrue("document.getFields() Size: " + document.getFields().size() + " is not: " + 1, document.getFields().size() == 1);
Modified: lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java (original)
+++ lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java Sat Feb 27 19:14:01 2010
@@ -38,7 +38,6 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.Version;
import org.apache.lucene.util._TestUtil;
/**
@@ -110,7 +109,7 @@
private Searcher getIndex (boolean even, boolean odd)
throws IOException {
RAMDirectory indexStore = new RAMDirectory ();
- IndexWriter writer = new IndexWriter (indexStore, new SimpleAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
+ IndexWriter writer = new IndexWriter (indexStore, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
writer.setMaxBufferedDocs(2);
writer.setMergeFactor(1000);
for (int i=0; i<data.length; ++i) {
@@ -174,7 +173,7 @@
}
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
full = getFullIndex();
queryX = new TermQuery (new Term ("contents", "x"));
@@ -224,7 +223,7 @@
}
@Override
- public Comparable value(int slot) {
+ public Comparable<?> value(int slot) {
return Integer.valueOf(slotValues[slot]);
}
}
@@ -248,9 +247,9 @@
public void testNormalizedScores() throws Exception {
// capture relevancy scores
- HashMap scoresX = getScores (full.search (queryX, null, 1000).scoreDocs, full);
- HashMap scoresY = getScores (full.search (queryY, null, 1000).scoreDocs, full);
- HashMap scoresA = getScores (full.search (queryA, null, 1000).scoreDocs, full);
+ HashMap<String,Float> scoresX = getScores (full.search (queryX, null, 1000).scoreDocs, full);
+ HashMap<String,Float> scoresY = getScores (full.search (queryY, null, 1000).scoreDocs, full);
+ HashMap<String,Float> scoresA = getScores (full.search (queryA, null, 1000).scoreDocs, full);
// we'll test searching locally, remote and multi
MultiSearcher remote = new MultiSearcher (new Searchable[] { getRemote() });
@@ -387,9 +386,9 @@
assertEquals (expectedResult, buff.toString());
}
- private HashMap getScores (ScoreDoc[] hits, Searcher searcher)
+ private HashMap<String, Float> getScores (ScoreDoc[] hits, Searcher searcher)
throws IOException {
- HashMap scoreMap = new HashMap();
+ HashMap<String, Float> scoreMap = new HashMap<String, Float>();
int n = hits.length;
for (int i=0; i<n; ++i) {
Document doc = searcher.doc(hits[i].doc);
@@ -401,11 +400,11 @@
}
// make sure all the values in the maps match
- private void assertSameValues (HashMap m1, HashMap m2) {
+ private void assertSameValues (HashMap<?, ?> m1, HashMap<?, ?> m2) {
int n = m1.size();
int m = m2.size();
assertEquals (n, m);
- Iterator iter = m1.keySet().iterator();
+ Iterator<?> iter = m1.keySet().iterator();
while (iter.hasNext()) {
Object key = iter.next();
Object o1 = m1.get(key);
Modified: lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFieldComparatorSource.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFieldComparatorSource.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFieldComparatorSource.java (original)
+++ lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFieldComparatorSource.java Sat Feb 27 19:14:01 2010
@@ -54,20 +54,17 @@
@Override
public FieldComparator newComparator(String fieldname, int numHits,
int sortPos, boolean reversed) throws IOException {
- dsdlc = new DistanceScoreDocLookupComparator(distanceFilter, numHits);
+ dsdlc = new DistanceScoreDocLookupComparator(numHits);
return dsdlc;
}
private class DistanceScoreDocLookupComparator extends FieldComparator {
- private DistanceFilter distanceFilter;
private double[] values;
private double bottom;
private int offset =0;
- public DistanceScoreDocLookupComparator(DistanceFilter distanceFilter,
- int numHits) {
- this.distanceFilter = distanceFilter;
+ public DistanceScoreDocLookupComparator(int numHits) {
values = new double[numHits];
return;
}
Modified: lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceHandler.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceHandler.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceHandler.java (original)
+++ lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceHandler.java Sat Feb 27 19:14:01 2010
@@ -31,7 +31,7 @@
*/
public class DistanceHandler {
- public enum Precision {EXACT, TWOFEET, TWENTYFEET, TWOHUNDREDFEET};
+ public enum Precision {EXACT, TWOFEET, TWENTYFEET, TWOHUNDREDFEET}
private Map<Integer,Double> distances;
private Map<String, Double> distanceLookupCache;
Modified: lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java (original)
+++ lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java Sat Feb 27 19:14:01 2010
@@ -21,8 +21,6 @@
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -49,18 +47,11 @@
import org.apache.lucene.spatial.tier.projections.SinusoidalProjector;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.NumericUtils;
-import org.apache.lucene.util.Version;
-/**
- *
- */
-public class TestCartesian extends TestCase{
-
- /**
- * @param args
- */
-
+public class TestCartesian extends LuceneTestCase {
+
private Directory directory;
private IndexSearcher searcher;
// reston va
@@ -76,10 +67,11 @@
@Override
- protected void setUp() throws IOException {
+ protected void setUp() throws Exception {
+ super.setUp();
directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
setUpPlotter( 2, 15);
@@ -495,8 +487,8 @@
// As the radius filter has performed the distance calculations
// already, pass in the filter to reuse the results.
//
- DistanceFieldComparatorSource dsort = new DistanceFieldComparatorSource(dq.distanceFilter);
- Sort sort = new Sort(new SortField("foo", dsort));
+ //DistanceFieldComparatorSource dsort = new DistanceFieldComparatorSource(dq.distanceFilter);
+ //Sort sort = new Sort(new SortField("foo", dsort));
// Perform the search, using the term query, the serial chain filter, and the
// distance sort
Modified: lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java (original)
+++ lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java Sat Feb 27 19:14:01 2010
@@ -18,8 +18,6 @@
import java.io.IOException;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -28,16 +26,11 @@
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.QueryWrapperFilter;
import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.NumericUtils;
-import org.apache.lucene.util.Version;
import org.apache.lucene.store.RAMDirectory;
-
-/**
- *
- */
-public class TestDistance extends TestCase{
-
+public class TestDistance extends LuceneTestCase {
private RAMDirectory directory;
// reston va
@@ -48,16 +41,18 @@
private IndexWriter writer;
@Override
- protected void setUp() throws IOException {
+ protected void setUp() throws Exception {
+ super.setUp();
directory = new RAMDirectory();
- writer = new IndexWriter(directory, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ writer = new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
addData(writer);
}
@Override
- protected void tearDown() throws IOException {
+ protected void tearDown() throws Exception {
writer.close();
+ super.tearDown();
}
private void addPoint(IndexWriter writer, String name, double lat, double lng) throws IOException{
Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/JaroWinklerDistance.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/JaroWinklerDistance.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/JaroWinklerDistance.java (original)
+++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/JaroWinklerDistance.java Sat Feb 27 19:14:01 2010
@@ -82,7 +82,7 @@
public float getDistance(String s1, String s2) {
int[] mtp = matches(s1, s2);
- float m = (float) mtp[0];
+ float m = mtp[0];
if (m == 0) {
return 0f;
}
Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/NGramDistance.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/NGramDistance.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/NGramDistance.java (original)
+++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/NGramDistance.java Sat Feb 27 19:14:01 2010
@@ -138,7 +138,7 @@
// our last action in the above loop was to switch d and p, so p now
// actually has the most recent cost counts
- return 1.0f - ((float) p[sl] / Math.max(tl, sl));
+ return 1.0f - (p[sl] / Math.max(tl, sl));
}
}
Modified: lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java?rev=917019&r1=917018&r2=917019&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java (original)
+++ lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java Sat Feb 27 19:14:01 2010
@@ -20,8 +20,6 @@
import java.io.IOException;
import java.util.Iterator;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -29,27 +27,26 @@
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
/**
* Test case for LuceneDictionary.
* It first creates a simple index and then a couple of instances of LuceneDictionary
* on different fields and checks if all the right text comes back.
- *
*/
-public class TestLuceneDictionary extends TestCase {
+public class TestLuceneDictionary extends LuceneTestCase {
private Directory store = new RAMDirectory();
private IndexReader indexReader = null;
private LuceneDictionary ld;
- private Iterator it;
+ private Iterator<String> it;
@Override
- public void setUp() throws Exception {
-
- IndexWriter writer = new IndexWriter(store, new WhitespaceAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+ protected void setUp() throws Exception {
+ super.setUp();
+ IndexWriter writer = new IndexWriter(store, new WhitespaceAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
Document doc;