mirror of https://github.com/apache/lucene.git
LUCENE-8626: Standardize Lucene Test Files (#2026)
This commit is contained in:
parent
d0ba0f38a9
commit
57729c9aca
|
@ -101,7 +101,7 @@ import org.w3c.dom.NodeList;
|
|||
* JUnit Test for Highlighter class.
|
||||
*
|
||||
*/
|
||||
public class HighlighterTest extends BaseTokenStreamTestCase implements Formatter {
|
||||
public class TestHighlighter extends BaseTokenStreamTestCase implements Formatter {
|
||||
|
||||
private IndexReader reader;
|
||||
static final String FIELD_NAME = "contents";
|
||||
|
@ -805,7 +805,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
@Override
|
||||
public void run() throws Exception {
|
||||
mode = QUERY;
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -850,7 +850,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
@Override
|
||||
public void run() throws Exception {
|
||||
mode = QUERY;
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -869,7 +869,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
@Override
|
||||
public void run() throws Exception {
|
||||
mode = QUERY;
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -885,7 +885,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
public void run() throws Exception {
|
||||
numHighlights = 0;
|
||||
doSearching(new TermQuery(new Term(FIELD_NAME, "kennedy")));
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 4);
|
||||
}
|
||||
|
@ -910,7 +910,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
doSearching(new ConstantScoreQuery(new TermQuery(new Term(FIELD_NAME,
|
||||
"kennedy"))));
|
||||
}
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 4);
|
||||
}
|
||||
|
@ -928,7 +928,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
FuzzyQuery fuzzyQuery = new FuzzyQuery(new Term(FIELD_NAME, "kinnedy"), 2);
|
||||
fuzzyQuery.setRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_REWRITE);
|
||||
doSearching(fuzzyQuery);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this, true);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this, true);
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 4);
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
WildcardQuery wildcardQuery = new WildcardQuery(new Term(FIELD_NAME, "k?nnedy"));
|
||||
wildcardQuery.setRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_REWRITE);
|
||||
doSearching(wildcardQuery);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 4);
|
||||
}
|
||||
|
@ -964,7 +964,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
WildcardQuery wildcardQuery = new WildcardQuery(new Term(FIELD_NAME, "k*dy"));
|
||||
wildcardQuery.setRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_REWRITE);
|
||||
doSearching(wildcardQuery);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 5);
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
query = rangeQuery;
|
||||
doSearching(query);
|
||||
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 5);
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
TokenStream tokenStream = getAnyTokenStream(FIELD_NAME, docId);
|
||||
int maxNumFragmentsRequired = 2;
|
||||
String fragmentSeparator = "...";
|
||||
QueryScorer scorer = new QueryScorer(query, HighlighterTest.FIELD_NAME);
|
||||
QueryScorer scorer = new QueryScorer(query, TestHighlighter.FIELD_NAME);
|
||||
|
||||
Highlighter highlighter = new Highlighter(this, scorer);
|
||||
|
||||
|
@ -1075,7 +1075,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
TokenStream tokenStream = getAnyTokenStream(FIELD_NAME, docId);
|
||||
int maxNumFragmentsRequired = 2;
|
||||
String fragmentSeparator = "...";
|
||||
QueryScorer scorer = new QueryScorer(query, "random_field", HighlighterTest.FIELD_NAME);
|
||||
QueryScorer scorer = new QueryScorer(query, "random_field", TestHighlighter.FIELD_NAME);
|
||||
|
||||
Highlighter highlighter = new Highlighter(this, scorer);
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
numHighlights = 0;
|
||||
PhraseQuery phraseQuery = new PhraseQuery(FIELD_NAME, "john", "kennedy");
|
||||
doSearching(phraseQuery);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
// Currently highlights "John" and "Kennedy" separately
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 2);
|
||||
|
@ -1118,7 +1118,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
|
||||
SpanNearQuery snq = new SpanNearQuery(clauses, 1, true);
|
||||
doSearching(snq);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
// Currently highlights "John" and "Kennedy" separately
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 2);
|
||||
|
@ -1160,7 +1160,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
bq.add(TermRangeQuery.newStringRange("contents", "john", "john", true, true), Occur.FILTER);
|
||||
|
||||
doSearching(bq.build());
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
// Currently highlights "John" and "Kennedy" separately
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 2);
|
||||
|
@ -1182,7 +1182,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
bq.add(TermRangeQuery.newStringRange("contents", "john", "john", true, true), Occur.FILTER);
|
||||
|
||||
doSearching(bq.build());
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
// Currently highlights "John" and "Kennedy" separately
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 2);
|
||||
|
@ -1205,7 +1205,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
booleanQuery.add(prefixQuery, Occur.SHOULD);
|
||||
|
||||
doSearching(booleanQuery.build());
|
||||
doStandardHighlights(analyzer, searcher, hits, query, HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query, TestHighlighter.this);
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 5);
|
||||
}
|
||||
|
@ -1226,7 +1226,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
query.add(new TermQuery(new Term(FIELD_NAME, "kennedy")), Occur.SHOULD);
|
||||
|
||||
doSearching(query.build());
|
||||
doStandardHighlights(analyzer, searcher, hits, query.build(), HighlighterTest.this);
|
||||
doStandardHighlights(analyzer, searcher, hits, query.build(), TestHighlighter.this);
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
numHighlights == 5);
|
||||
}
|
||||
|
@ -1249,7 +1249,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
TokenStream tokenStream = getAnyTokenStream(FIELD_NAME, docId);
|
||||
|
||||
Highlighter highlighter = getHighlighter(query, FIELD_NAME,
|
||||
HighlighterTest.this);
|
||||
TestHighlighter.this);
|
||||
highlighter.setTextFragmenter(new SimpleFragmenter(40));
|
||||
String result = highlighter.getBestFragment(tokenStream, text);
|
||||
if (VERBOSE) System.out.println("\t" + result);
|
||||
|
@ -1264,7 +1264,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
String text = doc.get(FIELD_NAME);
|
||||
TokenStream tokenStream = getAnyTokenStream(FIELD_NAME, docId);
|
||||
Highlighter highlighter = getHighlighter(query, FIELD_NAME,
|
||||
HighlighterTest.this);
|
||||
TestHighlighter.this);
|
||||
highlighter.getBestFragment(tokenStream, text);
|
||||
}
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
|
@ -1278,7 +1278,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
TokenStream tokenStream = getAnyTokenStream(FIELD_NAME, docId);
|
||||
|
||||
Highlighter highlighter = getHighlighter(query, FIELD_NAME,
|
||||
HighlighterTest.this);
|
||||
TestHighlighter.this);
|
||||
highlighter.getBestFragments(tokenStream, text, 10);
|
||||
}
|
||||
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
|
||||
|
@ -1326,7 +1326,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
positionSpans.add(new PositionSpan(14, 14));
|
||||
wTerms[1].addPositionSpans(positionSpans);
|
||||
|
||||
Highlighter highlighter = getHighlighter(wTerms, HighlighterTest.this);// new
|
||||
Highlighter highlighter = getHighlighter(wTerms, TestHighlighter.this);// new
|
||||
// Highlighter(new
|
||||
// QueryTermScorer(wTerms));
|
||||
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, texts[0]);
|
||||
|
@ -1339,7 +1339,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
// readjust weights
|
||||
wTerms[1].setWeight(50f);
|
||||
tokenStream = analyzer.tokenStream(FIELD_NAME, texts[0]);
|
||||
highlighter = getHighlighter(wTerms, HighlighterTest.this);
|
||||
highlighter = getHighlighter(wTerms, TestHighlighter.this);
|
||||
highlighter.setTextFragmenter(new SimpleFragmenter(2));
|
||||
|
||||
result = highlighter.getBestFragment(tokenStream, texts[0]).trim();
|
||||
|
@ -1371,7 +1371,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
query.add(new TermQuery(new Term("bookid", "soccer")), Occur.SHOULD);
|
||||
query.add(new TermQuery(new Term("bookid", "footie")), Occur.SHOULD);
|
||||
|
||||
Highlighter highlighter = getHighlighter(query.build(), null, HighlighterTest.this);
|
||||
Highlighter highlighter = getHighlighter(query.build(), null, TestHighlighter.this);
|
||||
|
||||
// Get 3 best fragments and separate with a "..."
|
||||
TokenStream tokenStream = analyzer.tokenStream(null, s);
|
||||
|
@ -1396,13 +1396,13 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
public void run() throws Exception {
|
||||
numHighlights = 0;
|
||||
doSearching(new TermQuery(new Term(FIELD_NAME, "kennedy")));
|
||||
// new Highlighter(HighlighterTest.this, new QueryTermScorer(query));
|
||||
// new Highlighter(TestHighlighter.this, new QueryTermScorer(query));
|
||||
|
||||
for (int i = 0; i < hits.totalHits.value; i++) {
|
||||
String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
|
||||
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, text);
|
||||
Highlighter highlighter = getHighlighter(query, FIELD_NAME,
|
||||
HighlighterTest.this);
|
||||
TestHighlighter.this);
|
||||
String result = highlighter.getBestFragment(tokenStream, text);
|
||||
if (VERBOSE) System.out.println("\t" + result);
|
||||
}
|
||||
|
@ -1428,7 +1428,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
TokenStream tokenStream = getAnyTokenStream(FIELD_NAME, docId);
|
||||
|
||||
Highlighter highlighter = getHighlighter(query, FIELD_NAME,
|
||||
HighlighterTest.this);// new Highlighter(this, new
|
||||
TestHighlighter.this);// new Highlighter(this, new
|
||||
// QueryTermScorer(query));
|
||||
highlighter.setTextFragmenter(new SimpleFragmenter(20));
|
||||
String stringResults[] = highlighter.getBestFragments(tokenStream, text, 10);
|
||||
|
@ -1466,7 +1466,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
doSearching(new TermQuery(new Term(FIELD_NAME, "meat")));
|
||||
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, texts[0]);
|
||||
Highlighter highlighter = getHighlighter(query, FIELD_NAME,
|
||||
HighlighterTest.this);// new Highlighter(this, new
|
||||
TestHighlighter.this);// new Highlighter(this, new
|
||||
// QueryTermScorer(query));
|
||||
highlighter.setMaxDocCharsToAnalyze(30);
|
||||
|
||||
|
@ -1615,7 +1615,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
final Document doc = searcher.doc(docId);
|
||||
String text = doc.get(FIELD_NAME);
|
||||
TokenStream tokenStream = getAnyTokenStream(FIELD_NAME, docId);
|
||||
Highlighter highlighter = getHighlighter(query.build(), FIELD_NAME, HighlighterTest.this, false);
|
||||
Highlighter highlighter = getHighlighter(query.build(), FIELD_NAME, TestHighlighter.this, false);
|
||||
|
||||
highlighter.setTextFragmenter(new SimpleFragmenter(40));
|
||||
|
||||
|
@ -1645,7 +1645,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
for (String text : texts) {
|
||||
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, text);
|
||||
Highlighter highlighter = getHighlighter(query, FIELD_NAME,
|
||||
HighlighterTest.this);
|
||||
TestHighlighter.this);
|
||||
String result = highlighter.getBestFragment(tokenStream, text);
|
||||
assertNull("The highlight result should be null for text with no query terms", result);
|
||||
}
|
||||
|
@ -1866,27 +1866,27 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
String result;
|
||||
|
||||
query = new TermQuery(new Term("text", "foo"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
|
||||
assertEquals("Hi-Speed10 <B>foo</B>", result);
|
||||
|
||||
query = new TermQuery(new Term("text", "10"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
|
||||
assertEquals("Hi-Speed<B>10</B> foo", result);
|
||||
|
||||
query = new TermQuery(new Term("text", "hi"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
|
||||
assertEquals("<B>Hi</B>-Speed10 foo", result);
|
||||
|
||||
query = new TermQuery(new Term("text", "speed"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
|
||||
assertEquals("Hi-<B>Speed</B>10 foo", result);
|
||||
|
||||
query = new TermQuery(new Term("text", "hispeed"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
|
||||
assertEquals("<B>Hi-Speed</B>10 foo", result);
|
||||
|
||||
|
@ -1895,39 +1895,39 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
|
|||
booleanQuery.add(new TermQuery(new Term("text", "speed")), Occur.SHOULD);
|
||||
|
||||
query = booleanQuery.build();
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2(), s, 3, "...");
|
||||
assertEquals("<B>Hi-Speed</B>10 foo", result);
|
||||
|
||||
// ///////////////// same tests, just put the bigger overlapping token
|
||||
// first
|
||||
query = new TermQuery(new Term("text", "foo"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
|
||||
assertEquals("Hi-Speed10 <B>foo</B>", result);
|
||||
|
||||
query = new TermQuery(new Term("text", "10"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
|
||||
assertEquals("Hi-Speed<B>10</B> foo", result);
|
||||
|
||||
query = new TermQuery(new Term("text", "hi"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
|
||||
assertEquals("<B>Hi</B>-Speed10 foo", result);
|
||||
|
||||
query = new TermQuery(new Term("text", "speed"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
|
||||
assertEquals("Hi-<B>Speed</B>10 foo", result);
|
||||
|
||||
query = new TermQuery(new Term("text", "hispeed"));
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
|
||||
assertEquals("<B>Hi-Speed</B>10 foo", result);
|
||||
|
||||
query = booleanQuery.build();
|
||||
highlighter = getHighlighter(query, "text", HighlighterTest.this);
|
||||
highlighter = getHighlighter(query, "text", TestHighlighter.this);
|
||||
result = highlighter.getBestFragments(getTS2a(), s, 3, "...");
|
||||
assertEquals("<B>Hi-Speed</B>10 foo", result);
|
||||
}
|
||||
|
@ -2295,12 +2295,12 @@ final class SynonymTokenizer extends TokenStream {
|
|||
for (int i = 0; i < hits.totalHits.value; i++) {
|
||||
final int docId = hits.scoreDocs[i].doc;
|
||||
final Document doc = searcher.doc(docId);
|
||||
String text = doc.get(HighlighterTest.FIELD_NAME);
|
||||
String text = doc.get(TestHighlighter.FIELD_NAME);
|
||||
int maxNumFragmentsRequired = 2;
|
||||
String fragmentSeparator = "...";
|
||||
Scorer scorer = null;
|
||||
TokenStream tokenStream =
|
||||
TokenSources.getTokenStream(HighlighterTest.FIELD_NAME,
|
||||
TokenSources.getTokenStream(TestHighlighter.FIELD_NAME,
|
||||
searcher.getIndexReader().getTermVectors(docId), text, analyzer, -1);
|
||||
if (mode == QUERY) {
|
||||
scorer = new QueryScorer(query);
|
|
@ -50,7 +50,7 @@ import org.apache.lucene.store.Directory;
|
|||
import org.apache.lucene.util.FixedBitSet;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class HighlighterPhraseTest extends LuceneTestCase {
|
||||
public class TestHighlighterPhrase extends LuceneTestCase {
|
||||
private static final String FIELD = "text";
|
||||
|
||||
public void testConcurrentPhrase() throws IOException, InvalidTokenOffsetsException {
|
|
@ -32,7 +32,7 @@ import org.apache.lucene.search.spans.SpanQuery;
|
|||
import org.apache.lucene.search.spans.SpanTermQuery;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class MissesTest extends LuceneTestCase {
|
||||
public class TestMisses extends LuceneTestCase {
|
||||
public void testTermQuery() throws IOException, InvalidTokenOffsetsException {
|
||||
try (Analyzer analyzer = new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)) {
|
||||
final Query query = new TermQuery(new Term("test", "foo"));
|
|
@ -20,7 +20,7 @@ import java.io.StringReader;
|
|||
|
||||
import org.apache.lucene.analysis.*;
|
||||
|
||||
public class OffsetLimitTokenFilterTest extends BaseTokenStreamTestCase {
|
||||
public class TestOffsetLimitTokenFilter extends BaseTokenStreamTestCase {
|
||||
|
||||
public void testFilter() throws Exception {
|
||||
// we disable MockTokenizer checks because we will forcefully limit the
|
|
@ -58,7 +58,7 @@ import org.apache.lucene.util.TestUtil;
|
|||
* {@link org.apache.lucene.search.highlight.TokenStreamFromTermVector}
|
||||
* indirectly from that.
|
||||
*/
|
||||
public class TokenSourcesTest extends BaseTokenStreamTestCase {
|
||||
public class TestTokenSources extends BaseTokenStreamTestCase {
|
||||
private static final String FIELD = "text";
|
||||
|
||||
private static final class OverlappingTokenStream extends TokenStream {
|
|
@ -45,7 +45,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
|||
* Tests the extensibility of {@link WeightedSpanTermExtractor} and
|
||||
* {@link QueryScorer} in a user defined package
|
||||
*/
|
||||
public class HighlightCustomQueryTest extends LuceneTestCase {
|
||||
public class TestHighlightCustomQuery extends LuceneTestCase {
|
||||
|
||||
private static final String FIELD_NAME = "contents";
|
||||
|
|
@ -27,7 +27,7 @@ import org.apache.lucene.search.Query;
|
|||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util.QueryBuilder;
|
||||
|
||||
public class LengthGoalBreakIteratorTest extends LuceneTestCase {
|
||||
public class TestLengthGoalBreakIterator extends LuceneTestCase {
|
||||
private static final String FIELD = "body";
|
||||
private static final float[] ALIGNS = {0.f, 0.5f, 1.f};
|
||||
|
|
@ -21,7 +21,7 @@ import java.util.Locale;
|
|||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class BreakIteratorBoundaryScannerTest extends LuceneTestCase {
|
||||
public class TestBreakIteratorBoundaryScanner extends LuceneTestCase {
|
||||
static final String TEXT =
|
||||
"Apache Lucene(TM) is a high-performance, full-featured text search engine library written entirely in Java." +
|
||||
"\nIt is a technology suitable for nearly any application that requires\n" +
|
|
@ -58,7 +58,7 @@ import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
|||
import org.apache.lucene.util.automaton.RegExp;
|
||||
|
||||
|
||||
public class FastVectorHighlighterTest extends LuceneTestCase {
|
||||
public class TestFastVectorHighlighter extends LuceneTestCase {
|
||||
|
||||
|
||||
public void testSimpleHighlightTest() throws IOException {
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.search.vectorhighlight.FieldPhraseList.WeightedPhraseIn
|
|||
import org.apache.lucene.search.vectorhighlight.FieldTermStack.TermInfo;
|
||||
import org.apache.lucene.util.TestUtil;
|
||||
|
||||
public class FieldPhraseListTest extends AbstractTestCase {
|
||||
public class TestFieldPhraseList extends AbstractTestCase {
|
||||
|
||||
public void test1TermIndex() throws Exception {
|
||||
make1d1fIndex( "a" );
|
|
@ -39,7 +39,7 @@ import org.apache.lucene.search.vectorhighlight.FieldQuery.QueryPhraseMap;
|
|||
import org.apache.lucene.search.vectorhighlight.FieldTermStack.TermInfo;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
||||
public class FieldQueryTest extends AbstractTestCase {
|
||||
public class TestFieldQuery extends AbstractTestCase {
|
||||
private float boost;
|
||||
|
||||
/**
|
|
@ -22,7 +22,7 @@ import org.apache.lucene.search.WildcardQuery;
|
|||
import org.apache.lucene.search.vectorhighlight.FieldTermStack.TermInfo;
|
||||
import org.apache.lucene.util.TestUtil;
|
||||
|
||||
public class FieldTermStackTest extends AbstractTestCase {
|
||||
public class TestFieldTermStack extends AbstractTestCase {
|
||||
|
||||
public void test1Term() throws Exception {
|
||||
makeIndex();
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.search.BooleanClause.Occur;
|
|||
import org.apache.lucene.search.vectorhighlight.FieldTermStack.TermInfo;
|
||||
import org.apache.lucene.util.AttributeImpl;
|
||||
|
||||
public class IndexTimeSynonymTest extends AbstractTestCase {
|
||||
public class TestIndexTimeSynonym extends AbstractTestCase {
|
||||
|
||||
public void testFieldTermStackIndex1wSearch1term() throws Exception {
|
||||
makeIndex1w();
|
|
@ -22,7 +22,7 @@ import org.apache.lucene.search.BooleanQuery;
|
|||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
|
||||
public class ScoreOrderFragmentsBuilderTest extends AbstractTestCase {
|
||||
public class TestScoreOrderFragmentsBuilder extends AbstractTestCase {
|
||||
|
||||
public void test3Frags() throws Exception {
|
||||
BooleanQuery.Builder query = new BooleanQuery.Builder();
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search.vectorhighlight;
|
|||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class SimpleBoundaryScannerTest extends LuceneTestCase {
|
||||
public class TestSimpleBoundaryScanner extends LuceneTestCase {
|
||||
static final String TEXT =
|
||||
"Apache Lucene(TM) is a high-performance, full-featured\ntext search engine library written entirely in Java.";
|
||||
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search.vectorhighlight;
|
|||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.*;
|
||||
|
||||
public class SimpleFragListBuilderTest extends AbstractTestCase {
|
||||
public class TestSimpleFragListBuilder extends AbstractTestCase {
|
||||
|
||||
public void testNullFieldFragList() throws Exception {
|
||||
SimpleFragListBuilder sflb = new SimpleFragListBuilder();
|
|
@ -43,7 +43,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class SimpleFragmentsBuilderTest extends AbstractTestCase {
|
||||
public class TestSimpleFragmentsBuilder extends AbstractTestCase {
|
||||
|
||||
public void test1TermIndex() throws Exception {
|
||||
FieldFragList ffl = ffl(new TermQuery(new Term(F, "a")), "a" );
|
|
@ -20,7 +20,7 @@ import org.apache.lucene.index.Term;
|
|||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
|
||||
public class SingleFragListBuilderTest extends AbstractTestCase {
|
||||
public class TestSingleFragListBuilder extends AbstractTestCase {
|
||||
|
||||
public void testNullFieldFragList() throws Exception {
|
||||
SingleFragListBuilder sflb = new SingleFragListBuilder();
|
|
@ -22,7 +22,7 @@ import org.apache.lucene.search.Query;
|
|||
import org.apache.lucene.search.vectorhighlight.FieldFragList.WeightedFragInfo;
|
||||
import org.apache.lucene.search.vectorhighlight.FieldFragList.WeightedFragInfo.SubInfo;
|
||||
|
||||
public class WeightedFragListBuilderTest extends AbstractTestCase {
|
||||
public class TestWeightedFragListBuilder extends AbstractTestCase {
|
||||
public void test2WeightedFragList() throws Exception {
|
||||
testCase( pqF( "the", "both" ), 100,
|
||||
"subInfos=(theboth((195,203)))/0.8679108(149,249)",
|
|
@ -35,7 +35,7 @@ import org.junit.Test;
|
|||
import org.locationtech.spatial4j.context.SpatialContext;
|
||||
import org.locationtech.spatial4j.shape.Shape;
|
||||
|
||||
public class QueryEqualsHashCodeTest extends LuceneTestCase {
|
||||
public class TestQueryEqualsHashCode extends LuceneTestCase {
|
||||
|
||||
private final SpatialContext ctx = SpatialContext.GEO;
|
||||
|
|
@ -23,7 +23,7 @@ import org.locationtech.spatial4j.context.SpatialContext;
|
|||
import org.locationtech.spatial4j.exception.InvalidShapeException;
|
||||
import org.locationtech.spatial4j.shape.Shape;
|
||||
|
||||
public class Geo3dTest extends LuceneTestCase {
|
||||
public class TestGeo3d extends LuceneTestCase {
|
||||
|
||||
@Test
|
||||
public void testWKT() throws Exception {
|
|
@ -45,7 +45,7 @@ import org.locationtech.spatial4j.shape.Shape;
|
|||
|
||||
import static org.locationtech.spatial4j.distance.DistanceUtils.DEGREES_TO_RADIANS;
|
||||
|
||||
public class Geo3dRptTest extends RandomSpatialOpStrategyTestCase {
|
||||
public class TestGeo3dRpt extends RandomSpatialOpStrategyTestCase {
|
||||
|
||||
private PlanetModel planetModel;
|
||||
private RandomGeo3dShapeGenerator shapeGenerator;
|
|
@ -34,11 +34,11 @@ import org.locationtech.spatial4j.shape.Point;
|
|||
import org.locationtech.spatial4j.shape.Rectangle;
|
||||
import org.locationtech.spatial4j.shape.SpatialRelation;
|
||||
|
||||
public class Geo3dShapeSphereModelRectRelationTest extends ShapeRectRelationTestCase {
|
||||
public class TestGeo3dShapeSphereModelRectRelation extends ShapeRectRelationTestCase {
|
||||
|
||||
PlanetModel planetModel = PlanetModel.SPHERE;
|
||||
|
||||
public Geo3dShapeSphereModelRectRelationTest() {
|
||||
public TestGeo3dShapeSphereModelRectRelation() {
|
||||
Geo3dSpatialContextFactory factory = new Geo3dSpatialContextFactory();
|
||||
factory.planetModel = planetModel;
|
||||
this.ctx = factory.newSpatialContext();
|
|
@ -31,11 +31,11 @@ import org.locationtech.spatial4j.shape.Circle;
|
|||
import org.locationtech.spatial4j.shape.Point;
|
||||
import org.locationtech.spatial4j.shape.SpatialRelation;
|
||||
|
||||
public class Geo3dShapeWGS84ModelRectRelationTest extends ShapeRectRelationTestCase {
|
||||
public class TestGeo3dShapeWGS84ModelRectRelation extends ShapeRectRelationTestCase {
|
||||
|
||||
PlanetModel planetModel = RandomPicks.randomFrom(random(), new PlanetModel[] {PlanetModel.WGS84, PlanetModel.CLARKE_1866});
|
||||
|
||||
public Geo3dShapeWGS84ModelRectRelationTest() {
|
||||
public TestGeo3dShapeWGS84ModelRectRelation() {
|
||||
Geo3dSpatialContextFactory factory = new Geo3dSpatialContextFactory();
|
||||
factory.planetModel = planetModel;
|
||||
this.ctx = factory.newSpatialContext();
|
|
@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals;
|
|||
* Check relationship between polygon and GeoShapes of composite polygons. Normally we construct
|
||||
* the composite polygon (when possible) and the complex one.
|
||||
*/
|
||||
public class CompositeGeoPolygonRelationshipsTest {
|
||||
public class TestCompositeGeoPolygonRelationships {
|
||||
|
||||
@Test
|
||||
public void testGeoCompositePolygon1() {
|
|
@ -25,7 +25,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class GeoBBoxTest {
|
||||
public class TestGeoBBox {
|
||||
|
||||
protected static final double DEGREES_TO_RADIANS = Math.PI / 180.0;
|
||||
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.spatial3d.geom;
|
|||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class GeoCircleTest extends LuceneTestCase {
|
||||
public class TestGeoCircle extends LuceneTestCase {
|
||||
|
||||
@Test
|
||||
public void testCircleDistance() {
|
|
@ -22,7 +22,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class GeoConvexPolygonTest {
|
||||
public class TestGeoConvexPolygon {
|
||||
|
||||
|
||||
@Test
|
|
@ -23,7 +23,7 @@ import org.junit.Test;
|
|||
/**
|
||||
* Tests for GeoExactCircle.
|
||||
*/
|
||||
public class GeoExactCircleTest extends RandomGeo3dShapeGenerator{
|
||||
public class TestGeoExactCircle extends RandomGeo3dShapeGenerator{
|
||||
|
||||
@Test
|
||||
public void testExactCircle() {
|
|
@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;
|
|||
/**
|
||||
* Test basic plane functionality.
|
||||
*/
|
||||
public class GeoModelTest {
|
||||
public class TestGeoModel {
|
||||
|
||||
protected final static PlanetModel scaledModel = new PlanetModel(1.2,1.5);
|
||||
|
|
@ -20,7 +20,7 @@ import org.junit.Test;
|
|||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
public class GeoPathTest extends LuceneTestCase {
|
||||
public class TestGeoPath extends LuceneTestCase {
|
||||
|
||||
@Test
|
||||
public void testPathDistance() {
|
|
@ -24,7 +24,7 @@ import static com.carrotsearch.randomizedtesting.RandomizedTest.randomFloat;
|
|||
/**
|
||||
* Test basic GeoPoint functionality.
|
||||
*/
|
||||
public class GeoPointTest extends LuceneTestCase {
|
||||
public class TestGeoPoint extends LuceneTestCase {
|
||||
static final double DEGREES_TO_RADIANS = Math.PI / 180;
|
||||
|
||||
@Test
|
|
@ -25,7 +25,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
public class GeoPolygonTest extends LuceneTestCase {
|
||||
public class TestGeoPolygon extends LuceneTestCase {
|
||||
|
||||
@Test
|
||||
public void testPolygonPointFiltering() {
|
|
@ -25,7 +25,7 @@ import static org.junit.Assert.assertEquals;
|
|||
/**
|
||||
* Test basic plane functionality.
|
||||
*/
|
||||
public class PlaneTest {
|
||||
public class TestPlane {
|
||||
|
||||
@Test
|
||||
public void testIdenticalPlanes() {
|
|
@ -27,7 +27,7 @@ import org.junit.Test;
|
|||
/**
|
||||
* Test to check Serialization
|
||||
*/
|
||||
public class RandomBinaryCodecTest extends RandomGeo3dShapeGenerator {
|
||||
public class TestRandomBinaryCodec extends RandomGeo3dShapeGenerator {
|
||||
|
||||
@Test
|
||||
@Repeat(iterations = 10)
|
|
@ -26,7 +26,7 @@ import org.junit.Test;
|
|||
/**
|
||||
* Random test for polygons.
|
||||
*/
|
||||
public class RandomGeoPolygonTest extends RandomGeo3dShapeGenerator {
|
||||
public class TestRandomGeoPolygon extends RandomGeo3dShapeGenerator {
|
||||
|
||||
@Test
|
||||
public void testRandomLUCENE8157() {
|
|
@ -22,7 +22,7 @@ import org.junit.Test;
|
|||
/**
|
||||
* Random test to check relationship between GeoAreaShapes and GeoShapes.
|
||||
*/
|
||||
public class RandomGeoShapeRelationshipTest extends RandomGeo3dShapeGenerator {
|
||||
public class TestRandomGeoShapeRelationship extends RandomGeo3dShapeGenerator {
|
||||
|
||||
/**
|
||||
* Test for WITHIN points. We build a WITHIN shape with respect the geoAreaShape
|
|
@ -26,7 +26,7 @@ import org.junit.Test;
|
|||
/**
|
||||
* Random test for planes.
|
||||
*/
|
||||
public class RandomPlaneTest extends RandomGeo3dShapeGenerator {
|
||||
public class TestRandomPlane extends RandomGeo3dShapeGenerator {
|
||||
|
||||
@Test
|
||||
@Repeat(iterations = 10)
|
|
@ -30,7 +30,7 @@ import static org.junit.Assert.assertTrue;
|
|||
* Check relationship between polygon and GeoShapes of basic polygons. Normally we construct
|
||||
* the convex, concave counterpart and the convex polygon as a complex polygon.
|
||||
*/
|
||||
public class SimpleGeoPolygonRelationshipsTest {
|
||||
public class TestSimpleGeoPolygonRelationships {
|
||||
|
||||
/**
|
||||
* Test with two shapes with no crossing edges and no points in common in convex case.
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.spatial3d.geom;
|
|||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class XYZSolidTest extends LuceneTestCase {
|
||||
public class TestXYZSolid extends LuceneTestCase {
|
||||
|
||||
@Test
|
||||
public void testNonDegenerateRelationships() {
|
Loading…
Reference in New Issue