Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.FacetSpec


              BrowseRequest req = new BrowseRequest();
              BrowseSelection sel = new BrowseSelection("color");
              sel.addValue("red");
              req.addSelection(sel);

              FacetSpec fspec = new FacetSpec();
              fspec.setExpandSelection(true);
              fspec.setMaxCount(10);
              fspec.setOrderBy(FacetSortSpec.OrderHitsDesc);

              req.setFacetSpec("color", fspec);
              req.setFacetSpec("category", fspec);
              req.setFacetSpec("makemodel", fspec);
              req.setFacetSpec("city", fspec);
View Full Code Here


            sel.setValues(parts2);
            BrowseRequest req = new BrowseRequest();
            req.addSelection(sel);
            for (String facet : facets)
            {
              FacetSpec fspec = new FacetSpec();
              fspec.setOrderBy(FacetSortSpec.OrderHitsDesc);
              fspec.setMaxCount(10);
              req.setFacetSpec(facet, fspec);
            }
            reqList.add(req);
          }
        }
View Full Code Here

         
          BrowseSelection sel2 = new BrowseSelection("industry");
          sel2.addValue("4");
          req.addSelection(sel2);
         
          FacetSpec fspec = new FacetSpec();
          fspec.setExpandSelection(true);
          fspec.setMaxCount(10);
          fspec.setOrderBy(FacetSortSpec.OrderHitsDesc);
         
           req.setFacetSpec("ccid", fspec);
           req.setFacetSpec("pcid", fspec);
           req.setFacetSpec("education_id", fspec);
           req.setFacetSpec("geo_region", fspec);
View Full Code Here

    propMap.put(PathFacetHandler.SEL_PROP_NAME_STRICT,"false");
    sel.setSelectionProperties(propMap);
   
    req.addSelection(sel);
   
    FacetSpec fs = new FacetSpec();
    fs.setMinHitCount(1);
    req.setFacetSpec(PathHandlerName, fs);
   
    BrowseResult res = browser.browse(req);
    assertEquals(res.getNumHits(),1);
    FacetAccessible fa = res.getFacetAccessor(PathHandlerName);
View Full Code Here

        industrySel.addValue("1");
   
        //br.addSelection(geoSel);
        br.addSelection(industrySel);
   
    FacetSpec regionSpec=new FacetSpec();
    regionSpec.setExpandSelection(true);
    regionSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
    regionSpec.setMaxCount(5);
   
        FacetSpec industrySpec=new FacetSpec();
        industrySpec.setExpandSelection(true);
        industrySpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
        industrySpec.setMaxCount(5);
       

        FacetSpec numEndorserSpec=new FacetSpec();
        numEndorserSpec.setExpandSelection(true);
   
    br.setFacetSpec("industry_norm", industrySpec);
        br.setFacetSpec("geo_region", regionSpec);
        br.setFacetSpec("num_endorsers_norm", numEndorserSpec);
View Full Code Here

    {
      long t0 = System.currentTimeMillis();
      BoboBrowser browser = new BoboBrowser(boboReader);
      BrowseRequest req = new BrowseRequest();
      req.setCount(500);
      FacetSpec spec = new FacetSpec();
      spec.setMaxCount(50);
      spec.setOrderBy(FacetSortSpec.OrderHitsDesc);
//      req.setFacetSpec("ccid", spec);
//      req.setFacetSpec("pcid", spec);
//      req.setFacetSpec("education_id", spec);
      req.setFacetSpec("geo_region", spec);
//      req.setFacetSpec("industry", spec);
View Full Code Here

        BrowseSelection sel=new BrowseSelection("color");
        sel.addValue("red");
        br.addSelection(sel);

    FacetSpec output=new FacetSpec();
    output.setExpandSelection(true);
    br.setFacetSpec("color", output);
    br.setFacetSpec("shape", output);
   
    HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
        answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("blue",2),new BrowseFacet("green",2),new BrowseFacet("red",3)}));
View Full Code Here

        sel.addValue("a");
        Properties prop = sel.getSelectionProperties();
        PathFacetHandler.setDepth(prop, 1);
        br.addSelection(sel);
   
    FacetSpec pathSpec=new FacetSpec();
    pathSpec.setOrderBy(FacetSortSpec.OrderValueAsc);
    br.setFacetSpec("path", pathSpec);
   
    HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("path", Arrays.asList(new BrowseFacet[]{new BrowseFacet("a-b",1),new BrowseFacet("a-c",4),new BrowseFacet("a-e",2)}));
    doTest(br,7,answer,null);
   
    pathSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
    answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("path", Arrays.asList(new BrowseFacet[]{new BrowseFacet("a-c",4),new BrowseFacet("a-e",2),new BrowseFacet("a-b",1)}));
    doTest(br,7,answer,null);
   
    pathSpec.setMaxCount(2);
    answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("path", Arrays.asList(new BrowseFacet[]{new BrowseFacet("a-c",4),new BrowseFacet("a-e",2)}));
    doTest(br,7,answer,null);
  }
View Full Code Here

        BrowseSelection sel=new BrowseSelection("distance");
        sel.addValue("30,70:5");
        sel.addValue("60,120:1");
        br.addSelection(sel);
   
    FacetSpec geoSpec=new FacetSpec();
    geoSpec.setOrderBy(FacetSortSpec.OrderValueAsc);
    br.setFacetSpec("distance", geoSpec);
   
    HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("distance", Arrays.asList(new BrowseFacet[]{new BrowseFacet("30,70:5",2),new BrowseFacet("60,120:1",2)}));
    doTest(br,4,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("distance");
    sel2.addValue("60,120:1");
    HashMap<String, Float> map = new HashMap<String, Float>();
    map.put("0,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("distance", geoSpec);
    geoSpec.setMinHitCount(0);
    br3.setQuery(colorQ);             // query is color=red
    br3.addSelection(sel);        // count facets <30,70,5> and <60,120,1>
    answer.clear();
    answer.put("distance", Arrays.asList(new BrowseFacet[]{new BrowseFacet("30,70:5", 0), new BrowseFacet("60,120:1",1)}));   
    doTest(br3, 1 , answer, null);
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.api.FacetSpec

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.