*/
public void testMultiBrowser() throws Exception {
BrowseRequest browseRequest = new BrowseRequest();
browseRequest.setCount(10);
browseRequest.setOffset(0);
browseRequest.addSortField(new SortField("date", SortField.Type.CUSTOM));
BrowseSelection colorSel = new BrowseSelection("color");
colorSel.addValue("red");
browseRequest.addSelection(colorSel);
BrowseSelection tageSel = new BrowseSelection("tag");
tageSel.addValue("rabbit");
browseRequest.addSelection(tageSel);
FacetSpec colorFacetSpec = new FacetSpec();
colorFacetSpec.setExpandSelection(true);
colorFacetSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
FacetSpec tagFacetSpec = new FacetSpec();
browseRequest.setFacetSpec("color", colorFacetSpec);
browseRequest.setFacetSpec("tag", tagFacetSpec);
FacetSpec shapeSpec = new FacetSpec();
shapeSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
browseRequest.setFacetSpec("shape", shapeSpec);
FacetSpec dateSpec = new FacetSpec();
dateSpec.setExpandSelection(true);
browseRequest.setFacetSpec("date", dateSpec);
BoboBrowser boboBrowser = newBrowser();
browseRequest
.setSort(new SortField[] { new SortField("compactnum", SortField.Type.CUSTOM, true) });
MultiBoboBrowser multiBoboBrowser = new MultiBoboBrowser(new Browsable[] { boboBrowser,
boboBrowser });
BrowseResult mergedResult = multiBoboBrowser.browse(browseRequest);
HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
answer.put("color",
Arrays.asList(new BrowseFacet[] { new BrowseFacet("red", 4), new BrowseFacet("green", 2) }));
answer.put(
"tag",
Arrays.asList(new BrowseFacet[] { new BrowseFacet("animal", 2), new BrowseFacet("dog", 2),
new BrowseFacet("humane", 2), new BrowseFacet("pet", 2), new BrowseFacet("rabbit", 4) }));
answer.put("shape", Arrays.asList(new BrowseFacet[] { new BrowseFacet("square", 4) }));
answer.put("date",
Arrays.asList(new BrowseFacet[] { new BrowseFacet("[2000/01/01 TO 2003/05/05]", 2) }));
doTest(mergedResult, browseRequest, 4, answer, new String[] { "7", "7", "1", "1" });
browseRequest
.setSort(new SortField[] { new SortField("multinum", SortField.Type.CUSTOM, true) });
mergedResult = multiBoboBrowser.browse(browseRequest);
doTest(mergedResult, browseRequest, 4, answer, new String[] { "7", "7", "1", "1" });
mergedResult.close();
multiBoboBrowser.close();
}