waitForIndexer();
/* Location IS Root Folder */
{
ISearchField field1 = fFactory.createSearchField(INews.LOCATION, fNewsEntityName);
ISearchCondition cond1 = fFactory.createSearchCondition(field1, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { rootFolder })));
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(cond1), true);
assertSame(result, news1Copy, news2Copy, news3CopyRoot, news3CopySubRoot, news4Copy, news5Copy, news6Copy);
}
/* Location IS Sub Folder */
{
ISearchField field1 = fFactory.createSearchField(INews.LOCATION, fNewsEntityName);
ISearchCondition cond1 = fFactory.createSearchCondition(field1, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { subFolder })));
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(cond1), true);
assertSame(result, news3CopySubRoot, news4Copy, news5Copy, news6Copy);
}
/* Location IS Root Bin */
{
ISearchField field1 = fFactory.createSearchField(INews.LOCATION, fNewsEntityName);
ISearchCondition cond1 = fFactory.createSearchCondition(field1, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { rootBin })));
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(cond1), true);
assertSame(result, news1Copy, news2Copy, news3CopyRoot);
}
/* Location IS Root Bin or Sub Root Bin */
{
ISearchField field1 = fFactory.createSearchField(INews.LOCATION, fNewsEntityName);
ISearchCondition cond1 = fFactory.createSearchCondition(field1, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { rootBin })));
ISearchField field2 = fFactory.createSearchField(INews.LOCATION, fNewsEntityName);
ISearchCondition cond2 = fFactory.createSearchCondition(field2, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { subRootBin })));
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(cond1, cond2), false);
assertSame(result, news1Copy, news2Copy, news3CopyRoot, news3CopySubRoot, news4Copy, news5Copy, news6Copy);
}
/* Location IS (Root Bin, Sub Root Bin) */
{
ISearchField field1 = fFactory.createSearchField(INews.LOCATION, fNewsEntityName);
ISearchCondition cond1 = fFactory.createSearchCondition(field1, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { rootBin, subRootBin })));
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(cond1), false);
assertSame(result, news1Copy, news2Copy, news3CopyRoot, news3CopySubRoot, news4Copy, news5Copy, news6Copy);
}
/* Location IS Sub Folder AND State is new */
{
ISearchField field1 = fFactory.createSearchField(INews.LOCATION, fNewsEntityName);
ISearchCondition cond1 = fFactory.createSearchCondition(field1, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { subFolder })));
ISearchField field2 = fFactory.createSearchField(INews.STATE, fNewsEntityName);
ISearchCondition cond2 = fFactory.createSearchCondition(field2, SearchSpecifier.IS, EnumSet.of(INews.State.NEW));
List<SearchHit<NewsReference>> result = fModelSearch.searchNews(list(cond1, cond2), true);
assertSame(result, news4Copy, news6Copy);
}
}