Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ISearchCondition


      /* All Fields */
      ISearchField field = fFactory.createSearchField(IEntity.ALL_FIELDS, fNewsEntityName);

      /* Contains Any - Single Condition */
      {
        ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Johnny Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Jo?nny D*");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny arnold michael schwarzenegger roberts hasselhoff");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny ar?old mic?ael schw?rzenegger rob?rts hasselh?ff");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh* arn*d mi*el sch* *rts *elh?ff");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains Any - Multi Condition (require all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts schwarzenegger");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny ar?old");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mic?ael");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "rob?rts schw?rzenegger");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh* sch*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*rts mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains Any - Multi Condition (require all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts schwarzenegger");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny ar?old");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mic?ael");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "rob?rts schw?rzenegger");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh* sch*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*rts mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4), true);
        assertTrue(result.isEmpty());
      }

      /* Contains All - Single Condition */
      {
        ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Johnny Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jo?nny D*");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "johnny arnold michael schwarzenegger roberts hasselhoff");
        result = fModelSearch.searchNews(list(condition), false);
        assertTrue(result.isEmpty());

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "jo?nny ar?old mic?ael schw?rzenegger rob?rts hasselh?ff");
        result = fModelSearch.searchNews(list(condition), false);
        assertTrue(result.isEmpty());

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "joh* arn*d mi*el sch* *rts *elh?ff");
        result = fModelSearch.searchNews(list(condition), false);
        assertTrue(result.isEmpty());

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael Jackson");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news2);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "M?ch?el *ckson");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news2);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a longer name like Michael Jackson");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news2);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a lo?ger name like Mic*el Jack*");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news2);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Arnold Schwarzenegger");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news3);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old Schwarz*");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news3);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news4);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "r?ber*ts");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news4);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Hasselhoff");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "h?ssel*ff");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news5);
      }

      /* Contains All - Multi Condition (required all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*elh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "M?ch?el");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*ckson");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        ISearchCondition condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        ISearchCondition condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8), false);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");

        result = fModelSearch.searchNews(list(condition1, condition4, condition5, condition6, condition7, condition8), false);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael Jackson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition6, condition7), false);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "n?me");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Mich*");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "J?ckson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8), false);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Th?s is a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "lo?ger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "l*ke");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jac?son");

        result = fModelSearch.searchNews(list(condition1, condition4, condition5, condition6, condition7, condition8), false);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "lo?ger n*me");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Mich* *son");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition6, condition7), false);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Schwarzenegger");

        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Schwarz*");

        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news4");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");

        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news4);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news5");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news5");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "h?ssel*ff");

        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news5);
      }

      /* Contains All - Multi Condition (required all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*elh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "M?ch?el");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*ckson");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        ISearchCondition condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        ISearchCondition condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");

        result = fModelSearch.searchNews(list(condition1, condition4, condition5, condition6, condition7, condition8), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael Jackson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition6, condition7), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "n?me");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Mich*");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "J?ckson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "lo?ger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "l*ke");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jac?son");

        result = fModelSearch.searchNews(list(condition1, condition4, condition5, condition6, condition7, condition8), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "lo?ger n*me");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Mich* *son");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition6, condition7), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Schwarzenegger");

        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Schwarz*");

        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news4");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");

        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news4);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news5");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news5");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "h?ssel*ff");

        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news5);
      }

      /* Contains Not - Single Condition */
      {
        ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Johnny Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news2, news3, news4, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny D*");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news2, news3, news4, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Michael Jackson");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news3, news4, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Mich?el Jack*");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news3, news4, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arnold Schwarzenegger");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news4, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arn* Sch?arzen?gger");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news4, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Roberts");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news3, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "r*b?rts");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news3, news5);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Hasselhoff");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news3, news4);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "has?elh*");
        result = fModelSearch.searchNews(list(condition), false);
        assertSame(result, news1, news2, news3, news4);

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "johnny arnold michael schwarzenegger roberts hasselhoff");
        result = fModelSearch.searchNews(list(condition), false);
        assertTrue(result.isEmpty());

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jo?nny ar?old mic?ael schw?rzenegger rob?rts hasselh?ff");
        result = fModelSearch.searchNews(list(condition), false);
        assertTrue(result.isEmpty());

        condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "joh* arn*d mi*el sch* *rts *elh?ff");
        result = fModelSearch.searchNews(list(condition), false);
        assertTrue(result.isEmpty());
      }

      /* Contains Not - Multi Condition (required all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jack*");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Michael");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jackson");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Mich?el");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jack*");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Schwarzenegger");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1, news2, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arn*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Sch?arzen?gger");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1, news2, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Roberts");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "R?be*s");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Ha?se*");
        result = fModelSearch.searchNews(list(condition1, condition2), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arnold");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains Not - Multi Condition (required all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jack*");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3), true);
        assertSame(result, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Michael");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jackson");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Mich?el");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jack*");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Schwarzenegger");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1, news2, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arn*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Sch?arzen?gger");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1, news2, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Roberts");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1, news2, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "R?be*s");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Ha?se*");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1, news2, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arnold");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "ar?old");
View Full Code Here


      waitForIndexer();

      /* All Fields */
      ISearchField field = fFactory.createSearchField(IEntity.ALL_FIELDS, fNewsEntityName);
      ISearchField stateField = fFactory.createSearchField(INews.STATE, fNewsEntityName);
      ISearchCondition stateCondition = fFactory.createSearchCondition(stateField, SearchSpecifier.IS, EnumSet.of(INews.State.NEW));

      /* Contains Any - Multi Condition (require all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains Any - Multi Condition (require all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts schwarzenegger");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny ar?old");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mic?ael");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "rob?rts schw?rzenegger");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh* sch*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*rts mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, stateCondition), true);
        assertTrue(result.isEmpty());
      }

      /* Contains All - Multi Condition (required all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains All - Multi Condition (required all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2), true);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*elh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "M?ch?el");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*ckson");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        ISearchCondition condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        ISearchCondition condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8, stateCondition), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");

        result = fModelSearch.searchNews(list(condition1, condition4, condition5, condition6, condition7, condition8, stateCondition), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael Jackson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition6, condition7, stateCondition), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "n?me");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Mich*");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "J?ckson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8, stateCondition), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "lo?ger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "l*ke");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jac?son");

        result = fModelSearch.searchNews(list(condition1, condition4, condition5, condition6, condition7, condition8, stateCondition), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "lo?ger n*me");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Mich* *son");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition6, condition7, stateCondition), true);
        assertSame(result, news2);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Schwarzenegger");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Schwarz*");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news4");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news4);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news5");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news5");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "h?ssel*ff");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news5);
      }

      /* Contains Not - Multi Condition (required all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jack*");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arnold");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains Not - Multi Condition (required all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jack*");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, stateCondition), true);
        assertSame(result, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Michael");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jackson");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Mich?el");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jack*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Schwarzenegger");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1, news2, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arn*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Sch?arzen?gger");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1, news2, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Roberts");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1, news2, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "R?be*s");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Ha?se*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertSame(result, news1, news2, news3);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arnold");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "ar?old");
View Full Code Here

      waitForIndexer();

      /* All Fields */
      ISearchField field = fFactory.createSearchField(IEntity.ALL_FIELDS, fNewsEntityName);
      ISearchField stateField = fFactory.createSearchField(INews.STATE, fNewsEntityName);
      ISearchCondition stateCondition = fFactory.createSearchCondition(stateField, SearchSpecifier.IS_NOT, EnumSet.of(INews.State.NEW));

      /* Contains Any - Multi Condition (require all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains Any - Multi Condition (require all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "johnny arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "michael");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "roberts schwarzenegger");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "jo?nny ar?old");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mic?ael");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "rob?rts schw?rzenegger");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "joh* sch*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*rts mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, stateCondition), true);
        assertTrue(result.isEmpty());
      }

      /* Contains All - Multi Condition (required all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news1);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains All - Multi Condition (required all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arnold");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "hasselh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*elh?ff");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "M?ch?el");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "*ckson");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        ISearchCondition condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        ISearchCondition condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jackson");

        result = fModelSearch.searchNews(list(condition1, condition4, condition5, condition6, condition7, condition8, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael Jackson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition6, condition7, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "longer");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "n?me");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Mich*");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "J?ckson");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This is a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "lo?ger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "name");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "l*ke");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Michael");
        condition8 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Jac?son");

        result = fModelSearch.searchNews(list(condition1, condition4, condition5, condition6, condition7, condition8, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "This");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "is");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "a");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "lo?ger n*me");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "like");
        condition7 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Mich* *son");

        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition6, condition7, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Schwarzenegger");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "ar?old");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Schwarz*");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news4");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "roberts");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news5");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "Hasselhoff");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "news5");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "h?ssel*ff");

        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());
      }

      /* Contains Not - Multi Condition (required all: false) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), false);
        assertSame(result, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jack*");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arnold");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "ar?old");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "mic?ael");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schw?rzenegger");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "rob?rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "joh*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arn*d");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "mi*el");
        condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "sch*");
        condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "*rts");
        condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "*elh?ff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), false);
        assertSame(result, news1, news2, news3, news4, news5);
      }

      /* Contains Not - Multi Condition (required all: true) */
      {
        ISearchCondition condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Johnny");
        ISearchCondition condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Depp");
        List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "D*");
        ISearchCondition condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jack*");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Michael");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jackson");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Mich?el");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Jack*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arnold");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Schwarzenegger");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Arn*");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Sch?arzen?gger");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Roberts");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "R?be*s");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "Ha?se*");
        result = fModelSearch.searchNews(list(condition1, condition2, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "johnny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "arnold");
        condition3 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "michael");
        ISearchCondition condition4 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "schwarzenegger");
        ISearchCondition condition5 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "roberts");
        ISearchCondition condition6 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "hasselhoff");
        result = fModelSearch.searchNews(list(condition1, condition2, condition3, condition4, condition5, condition6, stateCondition), true);
        assertTrue(result.isEmpty());

        condition1 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "jo?nny");
        condition2 = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS_NOT, "ar?old");
View Full Code Here

  private ISearch createStickySearch(boolean sticky) {
    ISearch search = fFactory.createSearch(null);
    ISearchField field = fFactory.createSearchField(INews.IS_FLAGGED, INews.class.getName());

    ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.IS, sticky);
    search.addSearchCondition(condition);

    return search;
  }
View Full Code Here

  private ISearch createScopeSearch(IFolderChild scope) {
    ISearch search = fFactory.createSearch(null);
    ISearchField field = fFactory.createSearchField(INews.LOCATION, INews.class.getName());

    ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.SCOPE, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { scope })));
    search.addSearchCondition(condition);

    return search;
  }
View Full Code Here

  private ISearch createTitleSearch(String title) {
    ISearch search = fFactory.createSearch(null);
    ISearchField field = fFactory.createSearchField(INews.TITLE, INews.class.getName());

    ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.IS, title);
    search.addSearchCondition(condition);

    return search;
  }
View Full Code Here

  private ISearch createDescriptionSearch(String description) {
    ISearch search = fFactory.createSearch(null);
    ISearchField field = fFactory.createSearchField(INews.DESCRIPTION, INews.class.getName());

    ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, description);
    search.addSearchCondition(condition);

    return search;
  }
View Full Code Here

    ISearchMark searchMark = factory.createSearchMark(null, folder, name, fPosition, fPosition != null ? true : null);
    searchMark.setMatchAllConditions(fPage.fMatchAllRadio.getSelection());

    fPage.fSearchConditionList.createConditions(searchMark);
    ISearchCondition locationCondition = fPage.getScopeCondition();
    if (locationCondition != null)
      searchMark.addSearchCondition(locationCondition);

    /* Copy all Properties from Parent or as Specified into this Mark */
    Map<String, Serializable> properties = folder.getProperties();
View Full Code Here

      setControl(control);
    }

    void onGenerateName() {
      List<ISearchCondition> conditions = fSearchConditionList.createConditions();
      ISearchCondition locationCondition = fLocationControl.toScopeCondition();
      if (locationCondition != null)
        conditions.add(locationCondition);

      String name = CoreUtils.getName(conditions, fMatchAllRadio.getSelection());
      if (name.length() > 0) {
View Full Code Here

    private List<ISearchCondition> getDefaultConditions() {
      List<ISearchCondition> conditions = new ArrayList<ISearchCondition>(1);
      IModelFactory factory = Owl.getModelFactory();

      ISearchField field = factory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
      ISearchCondition condition = factory.createSearchCondition(field, SearchSpecifier.CONTAINS, ""); //$NON-NLS-1$

      conditions.add(condition);

      return conditions;
    }
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.ISearchCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.