* This tests GeoFacetHandler
* @throws Exception
*/
public void testGeo() throws Exception{
// testing facet counts for two distance facets - <30,70,5>, <60,120,1>
BrowseRequest br=new BrowseRequest();
br.setCount(10);
br.setOffset(0);
BrowseSelection sel=new BrowseSelection("correctDistance");
sel.addValue("30,75:100");
sel.addValue("60,120:1");
br.addSelection(sel);
FacetSpec geoSpec=new FacetSpec();
geoSpec.setMinHitCount(0);
geoSpec.setOrderBy(FacetSortSpec.OrderValueAsc);
br.setFacetSpec("correctDistance", geoSpec);
HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
answer.put("correctDistance", Arrays.asList(new BrowseFacet[]{new BrowseFacet("30,75:100",1),new BrowseFacet("60,120:1",2)}));
doTest(br,3,answer,null);
// testing for selection of facet <60,120,1> and verifying that 2 documents match this facet.
BrowseRequest br2 = new BrowseRequest();
br2.setCount(10);
br2.setOffset(0);
BrowseSelection sel2 = new BrowseSelection("correctDistance");
sel2.addValue("60,120:1");
HashMap<String, Float> map = new HashMap<String, Float>();
map.put("60,120:1", 3.0f);
FacetTermQuery geoQ = new FacetTermQuery(sel2,map);
BoboBrowser b = newBrowser();
Explanation expl = b.explain(geoQ, 0);
br2.setQuery(geoQ);
doTest(br2,2,null,new String[]{"1","5"});
expl = b.explain(geoQ, 1);
// facet query for color "red" and getting facet counts for the distance facet.
BrowseRequest br3 = new BrowseRequest();
br3.setCount(10);
br3.setOffset(0);
BrowseSelection sel3 = new BrowseSelection("color");
sel3.addValue("red");
HashMap<String, Float> map3 = new HashMap<String, Float>();
map3.put("red", 3.0f);
FacetTermQuery colorQ = new FacetTermQuery(sel3,map3);
BoboBrowser b2 = newBrowser();
Explanation expl2 = b.explain(colorQ, 0);
br3.setFacetSpec("correctDistance", geoSpec);
geoSpec.setMinHitCount(1);
br3.setQuery(colorQ); // query is color=red
br3.addSelection(sel); // count facets <30,70,5> and <60,120,1>
answer.clear();
answer.put("correctDistance", Arrays.asList(new BrowseFacet[]{new BrowseFacet("60,120:1",1)}));
doTest(br3, 1 , answer, null);
}