andFilter = new BooleanFilter(BooleanFilter.Type.AND);
for (String categoriesParam : categoriesParams) {
String[] oredCategories = categoriesParam.split(",");
BooleanFilter orFilter = new BooleanFilter(BooleanFilter.Type.OR);
for (String oredCategory : oredCategories) {
orFilter.addFilter(new ValueFilter("categories", oredCategory));
}
andFilter.addFilter(orFilter);
}
}
// Site (uni-valued)
String siteParam = getParameter(params,"site");
if (siteParam != null) {
if (andFilter == null) {
andFilter = new BooleanFilter(BooleanFilter.Type.AND);
}
andFilter.addFilter(new ValueFilter("site", siteParam));
}
// Crawl (multi-valued)
String[] crawlParams = params.get("crawl");
if (crawlParams != null) {
if (andFilter == null) {
andFilter = new BooleanFilter(BooleanFilter.Type.AND);
}
for (String crawlParam : crawlParams) {
String[] oredCrawls = crawlParam.split(",");
BooleanFilter orFilter = new BooleanFilter(BooleanFilter.Type.OR);
for (String oredCrawl : oredCrawls) {
orFilter.addFilter(new ValueFilter("crawl", oredCrawl));
}
andFilter.addFilter(orFilter);
}
}