Exemplo n.º 1
0
        TEST( FTSQuery, Neg1 ) {
            FTSQuery q;
            ASSERT( q.parse( "this is -really fun", "english" ).isOK() );

            ASSERT_EQUALS( 1U, q.getTerms().size() );
            ASSERT_EQUALS( "fun", q.getTerms()[0] );
            ASSERT_EQUALS( 1U, q.getNegatedTerms().size() );
            ASSERT_EQUALS( "realli", *q.getNegatedTerms().begin() );
        }
Exemplo n.º 2
0
// Test textIndexVersion:1 query with language "english".  This invokes the standard English
// stemmer and stopword list.
TEST(FTSQuery, TextIndexVersion1LanguageEnglish) {
    FTSQuery q;
    ASSERT(q.parse("the running", "english", TEXT_INDEX_VERSION_1).isOK());
    ASSERT_EQUALS(1U, q.getTerms().size());
    ASSERT_EQUALS("run", q.getTerms()[0]);
    ASSERT_EQUALS(0U, q.getNegatedTerms().size());
    ASSERT_EQUALS(0U, q.getPhr().size());
    ASSERT_EQUALS(0U, q.getNegatedPhr().size());
}
Exemplo n.º 3
0
        TEST( FTSQuery, Basic1 ) {
            FTSQuery q;
            ASSERT( q.parse( "this is fun", "english" ).isOK() );

            ASSERT_EQUALS( 1U, q.getTerms().size() );
            ASSERT_EQUALS( "fun", q.getTerms()[0] );
            ASSERT_EQUALS( 0U, q.getNegatedTerms().size() );
            ASSERT_EQUALS( 0U, q.getPhr().size() );
            ASSERT_EQUALS( 0U, q.getNegatedPhr().size() );
        }
Exemplo n.º 4
0
// Test textIndexVersion:1 query with language "invalid".  No stemming will be performed,
// and no stopword list will be used.
TEST(FTSQuery, TextIndexVersion1LanguageInvalid) {
    FTSQuery q;
    ASSERT(q.parse("the running", "invalid", TEXT_INDEX_VERSION_1).isOK());
    ASSERT_EQUALS(2U, q.getTerms().size());
    ASSERT_EQUALS(1, std::count(q.getTerms().begin(), q.getTerms().end(), "the"));
    ASSERT_EQUALS(1, std::count(q.getTerms().begin(), q.getTerms().end(), "running"));
    ASSERT_EQUALS(0U, q.getNegatedTerms().size());
    ASSERT_EQUALS(0U, q.getPhr().size());
    ASSERT_EQUALS(0U, q.getNegatedPhr().size());
}
Exemplo n.º 5
0
        TEST( FTSQuery, Phrase1 ) {
            FTSQuery q;
            ASSERT( q.parse( "doing a \"phrase test\" for fun", "english" ).isOK() );

            ASSERT_EQUALS( 3U, q.getTerms().size() );
            ASSERT_EQUALS( 0U, q.getNegatedTerms().size() );
            ASSERT_EQUALS( 1U, q.getPhr().size() );
            ASSERT_EQUALS( 0U, q.getNegatedPhr().size() );

            ASSERT_EQUALS( "phrase test", q.getPhr()[0] );
            ASSERT_EQUALS( "fun|phrase|test||||phrase test||", q.debugString() );
        }