org.apache.lucene.queryParser
Class QueryParserTestBase

java.lang.Object
  extended by org.junit.Assert
      extended by org.apache.lucene.util.LuceneTestCase
          extended by org.apache.lucene.queryParser.QueryParserTestBase

public abstract class QueryParserTestBase
extends LuceneTestCase

Base Test class for QueryParser subclasses


Nested Class Summary
static class QueryParserTestBase.QPTestAnalyzer
          Filters LowerCaseTokenizer with QPTestFilter.
static class QueryParserTestBase.QPTestFilter
          Filter which discards the token 'stop' and which expands the token 'phrase' into 'phrase1 phrase2'
static class QueryParserTestBase.QPTestParser
          Test QueryParser that does not allow fuzzy or wildcard queries.
 
Nested classes/interfaces inherited from class org.apache.lucene.util.LuceneTestCase
LuceneTestCase.Nightly
 
Field Summary
static Analyzer qpAnalyzer
           
 
Fields inherited from class org.apache.lucene.util.LuceneTestCase
classRules, random, RANDOM_MULTIPLIER, ruleChain, stores, TEMP_DIR, TEST_CLEAN_THREADS, TEST_DIRECTORY, TEST_ITER, TEST_ITER_MIN, TEST_LINE_DOCS_FILE, TEST_LOCALE, TEST_NIGHTLY, TEST_SEED, TEST_TIMEZONE, TEST_VERSION_CURRENT, testsFailed, VERBOSE
 
Constructor Summary
QueryParserTestBase()
           
 
Method Summary
 void assertDateRangeQueryEquals(QueryParser qp, String field, String startDate, String endDate, Date endDateInclusive, DateTools.Resolution resolution)
           
 void assertEscapedQueryEquals(String query, Analyzer a, String result)
           
 void assertParseException(String queryString)
           
 void assertQueryEquals(QueryParser qp, String field, String query, String result)
           
 void assertQueryEquals(String query, Analyzer a, String result)
           
 void assertQueryEqualsDOA(String query, Analyzer a, String result)
           
 void assertWildcardQueryEquals(String query, boolean lowercase, String result)
           
 void assertWildcardQueryEquals(String query, boolean lowercase, String result, boolean allowLeadingWildcard)
           
 void assertWildcardQueryEquals(String query, String result)
           
abstract  QueryParser getParser(Analyzer a)
           
 Query getQuery(String query, Analyzer a)
           
 Query getQueryDOA(String query, Analyzer a)
           
 void setUp()
          For subclassing only.
 void tearDown()
          For subclassing only.
 void testAutoGeneratePhraseQueriesOn()
           
 void testBooleanQuery()
           
 void testBoost()
           
 void testCJK()
           
 void testCJKBoostedPhrase()
           
 void testCJKBoostedTerm()
           
 void testCJKPhrase()
           
 void testCJKSloppyPhrase()
           
 void testCJKTerm()
           
 void testCustomQueryParserFuzzy()
           
 void testCustomQueryParserWildcard()
           
 void testDateRange()
           
 void testEscaped()
           
 void testException()
           
 void testFarsiRangeCollating()
           
 void testLeadingWildcardType()
           
 void testLegacyDateRange()
          for testing legacy DateField support
 void testLocalDateFormat()
           
 void testMatchAllDocs()
           
 void testNumber()
           
 void testPositionIncrement()
           
 void testPositionIncrements()
           
 void testPrecedence()
          This test differs from TestPrecedenceQueryParser
 void testProtectedCtors()
           
 void testPunct()
           
 void testQPA()
           
 void testQueryStringEscaping()
           
 void testRange()
           
 void testSimple()
           
 void testSimpleDAO()
           
 void testSlop()
           
 void testStarParsing()
           
 void testStopwords()
           
 void testTabNewlineCarriageReturn()
           
 void testWildcard()
           
 
Methods inherited from class org.apache.lucene.util.LuceneTestCase
afterClassLuceneTestCaseJ4, alwaysIgnoredTestMethod, assertEquals, assertEquals, assertEquals, assertEquals, assertSaneFieldCaches, asSet, assumeFalse, assumeNoException, assumeTrue, atLeast, atLeast, beforeClassLuceneTestCaseJ4, dumpArray, dumpIterator, getDataFile, getName, getTestClass, getTestLabel, isTestThread, localeForName, newDirectory, newDirectory, newDirectory, newDirectory, newField, newField, newField, newField, newField, newField, newFSDirectory, newFSDirectory, newIndexWriterConfig, newIndexWriterConfig, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newSearcher, newSearcher, newTieredMergePolicy, newTieredMergePolicy, purgeFieldCache, randomDirectory, randomLocale, randomTimeZone, rarely, rarely, reportAdditionalFailureInfo, reportPartialFailureInfo, setMergeFactor, setUseCompoundFile, usually, usually
 
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

qpAnalyzer

public static Analyzer qpAnalyzer
Constructor Detail

QueryParserTestBase

public QueryParserTestBase()
Method Detail

setUp

public void setUp()
           throws Exception
Description copied from class: LuceneTestCase
For subclassing only. Overrides must call super.setUp().

Overrides:
setUp in class LuceneTestCase
Throws:
Exception

getParser

public abstract QueryParser getParser(Analyzer a)
                               throws Exception
Throws:
Exception

getQuery

public Query getQuery(String query,
                      Analyzer a)
               throws Exception
Throws:
Exception

assertQueryEquals

public void assertQueryEquals(String query,
                              Analyzer a,
                              String result)
                       throws Exception
Throws:
Exception

assertQueryEquals

public void assertQueryEquals(QueryParser qp,
                              String field,
                              String query,
                              String result)
                       throws Exception
Throws:
Exception

assertEscapedQueryEquals

public void assertEscapedQueryEquals(String query,
                                     Analyzer a,
                                     String result)
                              throws Exception
Throws:
Exception

assertWildcardQueryEquals

public void assertWildcardQueryEquals(String query,
                                      boolean lowercase,
                                      String result,
                                      boolean allowLeadingWildcard)
                               throws Exception
Throws:
Exception

assertWildcardQueryEquals

public void assertWildcardQueryEquals(String query,
                                      boolean lowercase,
                                      String result)
                               throws Exception
Throws:
Exception

assertWildcardQueryEquals

public void assertWildcardQueryEquals(String query,
                                      String result)
                               throws Exception
Throws:
Exception

getQueryDOA

public Query getQueryDOA(String query,
                         Analyzer a)
                  throws Exception
Throws:
Exception

assertQueryEqualsDOA

public void assertQueryEqualsDOA(String query,
                                 Analyzer a,
                                 String result)
                          throws Exception
Throws:
Exception

testCJK

public void testCJK()
             throws Exception
Throws:
Exception

testCJKTerm

public void testCJKTerm()
                 throws Exception
Throws:
Exception

testCJKBoostedTerm

public void testCJKBoostedTerm()
                        throws Exception
Throws:
Exception

testCJKPhrase

public void testCJKPhrase()
                   throws Exception
Throws:
Exception

testCJKBoostedPhrase

public void testCJKBoostedPhrase()
                          throws Exception
Throws:
Exception

testCJKSloppyPhrase

public void testCJKSloppyPhrase()
                         throws Exception
Throws:
Exception

testAutoGeneratePhraseQueriesOn

public void testAutoGeneratePhraseQueriesOn()
                                     throws Exception
Throws:
Exception

testSimple

public void testSimple()
                throws Exception
Throws:
Exception

testPunct

public void testPunct()
               throws Exception
Throws:
Exception

testSlop

public void testSlop()
              throws Exception
Throws:
Exception

testNumber

public void testNumber()
                throws Exception
Throws:
Exception

testWildcard

public void testWildcard()
                  throws Exception
Throws:
Exception

testLeadingWildcardType

public void testLeadingWildcardType()
                             throws Exception
Throws:
Exception

testQPA

public void testQPA()
             throws Exception
Throws:
Exception

testRange

public void testRange()
               throws Exception
Throws:
Exception

testFarsiRangeCollating

public void testFarsiRangeCollating()
                             throws Exception
Throws:
Exception

testLegacyDateRange

public void testLegacyDateRange()
                         throws Exception
for testing legacy DateField support

Throws:
Exception

testDateRange

public void testDateRange()
                   throws Exception
Throws:
Exception

assertDateRangeQueryEquals

public void assertDateRangeQueryEquals(QueryParser qp,
                                       String field,
                                       String startDate,
                                       String endDate,
                                       Date endDateInclusive,
                                       DateTools.Resolution resolution)
                                throws Exception
Throws:
Exception

testEscaped

public void testEscaped()
                 throws Exception
Throws:
Exception

testQueryStringEscaping

public void testQueryStringEscaping()
                             throws Exception
Throws:
Exception

testTabNewlineCarriageReturn

public void testTabNewlineCarriageReturn()
                                  throws Exception
Throws:
Exception

testSimpleDAO

public void testSimpleDAO()
                   throws Exception
Throws:
Exception

testBoost

public void testBoost()
               throws Exception
Throws:
Exception

assertParseException

public void assertParseException(String queryString)
                          throws Exception
Throws:
Exception

testException

public void testException()
                   throws Exception
Throws:
Exception

testCustomQueryParserWildcard

public void testCustomQueryParserWildcard()

testCustomQueryParserFuzzy

public void testCustomQueryParserFuzzy()
                                throws Exception
Throws:
Exception

testBooleanQuery

public void testBooleanQuery()
                      throws Exception
Throws:
Exception

testPrecedence

public void testPrecedence()
                    throws Exception
This test differs from TestPrecedenceQueryParser

Throws:
Exception

testLocalDateFormat

public void testLocalDateFormat()
                         throws IOException,
                                ParseException
Throws:
IOException
ParseException

testStarParsing

public void testStarParsing()
                     throws Exception
Throws:
Exception

testStopwords

public void testStopwords()
                   throws Exception
Throws:
Exception

testPositionIncrement

public void testPositionIncrement()
                           throws Exception
Throws:
Exception

testMatchAllDocs

public void testMatchAllDocs()
                      throws Exception
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
Description copied from class: LuceneTestCase
For subclassing only. Overrides must call super.tearDown().

Overrides:
tearDown in class LuceneTestCase
Throws:
Exception

testPositionIncrements

public void testPositionIncrements()
                            throws Exception
Throws:
Exception

testProtectedCtors

public void testProtectedCtors()
                        throws Exception
Throws:
Exception