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 [5/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/misc/src/test/org/apache/lucene/queryParser/analyzing/TestAnalyzingQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/analyzing/TestAnalyzingQueryParser.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/analyzing/TestAnalyzingQueryParser.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/analyzing/TestAnalyzingQueryParser.java Sat Feb 27 22:51:44 2010
@@ -19,8 +19,6 @@
import java.io.Reader;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.ASCIIFoldingFilter;
import org.apache.lucene.analysis.LowerCaseFilter;
@@ -28,12 +26,12 @@
import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
/**
* @version $Revision$, $Date$
*/
-public class TestAnalyzingQueryParser extends TestCase {
+public class TestAnalyzingQueryParser extends LuceneTestCase {
private Analyzer a;
@@ -47,7 +45,8 @@
private String[] fuzzyExpected;
@Override
- public void setUp() {
+ protected void setUp() throws Exception {
+ super.setUp();
wildcardInput = new String[] { "übersetzung über*ung",
"Mötley Cr\u00fce Mötl?* Crü?", "Renée Zellweger Ren?? Zellw?ger" };
wildcardExpected = new String[] { "ubersetzung uber*ung", "motley crue motl?* cru?",
@@ -99,7 +98,7 @@
}
private String parseWithAnalyzingQueryParser(String s, Analyzer a) throws ParseException {
- AnalyzingQueryParser qp = new AnalyzingQueryParser(Version.LUCENE_CURRENT, "field", a);
+ AnalyzingQueryParser qp = new AnalyzingQueryParser(TEST_VERSION_CURRENT, "field", a);
org.apache.lucene.search.Query q = qp.parse(s);
return q.toString("field");
}
@@ -112,10 +111,10 @@
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
- TokenStream result = new StandardTokenizer(Version.LUCENE_CURRENT, reader);
+ TokenStream result = new StandardTokenizer(LuceneTestCase.TEST_VERSION_CURRENT, reader);
result = new StandardFilter(result);
result = new ASCIIFoldingFilter(result);
- result = new LowerCaseFilter(result);
+ result = new LowerCaseFilter(LuceneTestCase.TEST_VERSION_CURRENT, result);
return result;
}
}
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java Sat Feb 27 22:51:44 2010
@@ -19,8 +19,6 @@
import java.util.HashSet;
-import junit.framework.TestCase;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
@@ -33,11 +31,11 @@
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
-public class TestComplexPhraseQuery extends TestCase {
+public class TestComplexPhraseQuery extends LuceneTestCase {
- Analyzer analyzer = new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT);
+ Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
DocData docsContent[] = { new DocData("john smith", "1"),
new DocData("johathon smith", "2"),
@@ -72,7 +70,7 @@
}
private void checkBadQuery(String qString) {
- QueryParser qp = new ComplexPhraseQueryParser(Version.LUCENE_CURRENT, defaultFieldName, analyzer);
+ QueryParser qp = new ComplexPhraseQueryParser(TEST_VERSION_CURRENT, defaultFieldName, analyzer);
Throwable expected = null;
try {
qp.parse(qString);
@@ -85,7 +83,7 @@
private void checkMatches(String qString, String expectedVals)
throws Exception {
- QueryParser qp = new ComplexPhraseQueryParser(Version.LUCENE_CURRENT, defaultFieldName, analyzer);
+ QueryParser qp = new ComplexPhraseQueryParser(TEST_VERSION_CURRENT, defaultFieldName, analyzer);
qp.setFuzzyPrefixLength(1); // usually a good idea
Query q = qp.parse(qString);
@@ -113,6 +111,7 @@
@Override
protected void setUp() throws Exception {
+ super.setUp();
RAMDirectory rd = new RAMDirectory();
IndexWriter w = new IndexWriter(rd, analyzer, MaxFieldLength.UNLIMITED);
for (int i = 0; i < docsContent.length; i++) {
@@ -130,6 +129,7 @@
@Override
protected void tearDown() throws Exception {
searcher.close();
+ super.tearDown();
}
static class DocData {
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/ext/TestExtendableQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/ext/TestExtendableQueryParser.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/ext/TestExtendableQueryParser.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/ext/TestExtendableQueryParser.java Sat Feb 27 22:51:44 2010
@@ -26,7 +26,6 @@
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.util.Version;
/**
* Testcase for the class {@link ExtendableQueryParser}
@@ -47,10 +46,10 @@
public QueryParser getParser(Analyzer a, Extensions extensions)
throws Exception {
if (a == null)
- a = new SimpleAnalyzer(Version.LUCENE_CURRENT);
+ a = new SimpleAnalyzer(TEST_VERSION_CURRENT);
QueryParser qp = extensions == null ? new ExtendableQueryParser(
- Version.LUCENE_CURRENT, "field", a) : new ExtendableQueryParser(
- Version.LUCENE_CURRENT, "field", a, extensions);
+ TEST_VERSION_CURRENT, "field", a) : new ExtendableQueryParser(
+ TEST_VERSION_CURRENT, "field", a, extensions);
qp.setDefaultOperator(QueryParser.OR_OPERATOR);
return qp;
}
Modified: lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java Sat Feb 27 22:51:44 2010
@@ -36,7 +36,6 @@
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.WildcardQuery;
import org.apache.lucene.util.LocalizedTestCase;
-import org.apache.lucene.util.Version;
import java.io.IOException;
import java.io.Reader;
@@ -100,7 +99,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));
}
}
@@ -123,14 +122,14 @@
private int originalMaxClauses;
@Override
- public void setUp() throws Exception {
+ protected void setUp() throws Exception {
super.setUp();
originalMaxClauses = BooleanQuery.getMaxClauseCount();
}
public PrecedenceQueryParser getParser(Analyzer a) throws Exception {
if (a == null)
- a = new SimpleAnalyzer(Version.LUCENE_CURRENT);
+ a = new SimpleAnalyzer(TEST_VERSION_CURRENT);
PrecedenceQueryParser qp = new PrecedenceQueryParser("field", a);
qp.setDefaultOperator(PrecedenceQueryParser.OR_OPERATOR);
return qp;
@@ -175,7 +174,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);
PrecedenceQueryParser qp = new PrecedenceQueryParser("field", a);
qp.setDefaultOperator(PrecedenceQueryParser.AND_OPERATOR);
return qp.parse(query);
@@ -241,7 +240,7 @@
assertQueryEquals("+title:(dog OR cat) -author:\"bob dole\"", null,
"+(title:dog title:cat) -author:\"bob dole\"");
- PrecedenceQueryParser qp = new PrecedenceQueryParser("field", new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT));
+ PrecedenceQueryParser qp = new PrecedenceQueryParser("field", new StandardAnalyzer(TEST_VERSION_CURRENT));
// make sure OR is the default:
assertEquals(PrecedenceQueryParser.OR_OPERATOR, qp.getDefaultOperator());
qp.setDefaultOperator(PrecedenceQueryParser.AND_OPERATOR);
@@ -255,7 +254,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");
@@ -275,7 +274,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");
@@ -413,7 +412,7 @@
}
public void testEscaped() throws Exception {
- Analyzer a = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
+ Analyzer a = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
/*assertQueryEquals("\\[brackets", a, "\\[brackets");
assertQueryEquals("\\[brackets", null, "brackets");
@@ -518,7 +517,7 @@
public void testBoost()
throws Exception {
- StandardAnalyzer oneStopAnalyzer = new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT, Collections.singleton("on"));
+ StandardAnalyzer oneStopAnalyzer = new StandardAnalyzer(TEST_VERSION_CURRENT, Collections.singleton("on"));
PrecedenceQueryParser qp = new PrecedenceQueryParser("field", oneStopAnalyzer);
Query q = qp.parse("on^1.0");
assertNotNull(q);
@@ -531,7 +530,7 @@
q = qp.parse("\"on\"^1.0");
assertNotNull(q);
- q = getParser(new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_CURRENT)).parse("the^3");
+ q = getParser(new StandardAnalyzer(TEST_VERSION_CURRENT)).parse("the^3");
assertNotNull(q);
}
@@ -545,7 +544,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");
} catch (ParseException expected) {
return;
}
@@ -554,7 +553,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~");
} catch (ParseException expected) {
return;
}
@@ -564,7 +563,7 @@
public void testBooleanQuery() throws Exception {
BooleanQuery.setMaxClauseCount(2);
try {
- getParser(new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).parse("one two three");
+ getParser(new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).parse("one two three");
fail("ParseException expected due to too many boolean clauses");
} catch (ParseException expected) {
// too many boolean clauses, so ParseException is expected
@@ -578,7 +577,7 @@
// failing tests disabled since PrecedenceQueryParser
// is currently unmaintained
public void _testPrecedence() throws Exception {
- PrecedenceQueryParser parser = getParser(new WhitespaceAnalyzer(Version.LUCENE_CURRENT));
+ PrecedenceQueryParser parser = getParser(new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
Query query1 = parser.parse("A AND B OR C AND D");
Query query2 = parser.parse("(A AND B) OR (C AND D)");
assertEquals(query1, query2);
@@ -606,8 +605,9 @@
@Override
- public void tearDown() {
+ protected void tearDown() throws Exception {
BooleanQuery.setMaxClauseCount(originalMaxClauses);
+ super.tearDown();
}
}
Modified: lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.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.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/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java (original)
+++ lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java (original)
+++ lucene/java/branches/flex_1458/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/BoostAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/BoostAttributeImpl.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/BoostAttributeImpl.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/BoostAttributeImpl.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/DefaultPhraseSlopAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/DefaultPhraseSlopAttributeImpl.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/DefaultPhraseSlopAttributeImpl.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/DefaultPhraseSlopAttributeImpl.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldDateResolutionMapAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldDateResolutionMapAttributeImpl.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldDateResolutionMapAttributeImpl.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldDateResolutionMapAttributeImpl.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttributeImpl.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttributeImpl.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FuzzyAttributeImpl.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/PositionIncrementsAttributeImpl.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerQPHelper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerQPHelper.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerQPHelper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerWrapper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerWrapper.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiAnalyzerWrapper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java (original)
+++ lucene/java/branches/flex_1458/contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java (original)
+++ lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java (original)
+++ lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.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.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/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java (original)
+++ lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java Sat Feb 27 22:51:44 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/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java?rev=917067&r1=917066&r2=917067&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java (original)
+++ lucene/java/branches/flex_1458/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java Sat Feb 27 22:51:44 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));