Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.FacetSpec


  public void testDefaultBrowse(){
    BrowseRequest br=new BrowseRequest();
      br.setCount(3);
      br.setOffset(0);
     
      FacetSpec spec = new FacetSpec();
      spec.setMaxCount(2);
      spec.setOrderBy(FacetSortSpec.OrderHitsDesc);
      br.setFacetSpec("color", spec);
     

      br.setSort(new SortField[]{new SortField("number",SortField.CUSTOM,false)});
     
View Full Code Here


     
      BrowseSelection sel = new BrowseSelection("shape");
      sel.addValue("square");
      br.addSelection(sel);
       
      FacetSpec spec = new FacetSpec();
      spec.setMinHitCount(0);
      spec.setOrderBy(FacetSortSpec.OrderHitsDesc);
      br.setFacetSpec("color", spec);
               
      HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("red",2),new BrowseFacet("blue",1),new BrowseFacet("green",0)}));
       
View Full Code Here

  public void testRandomAccessFacet() throws Exception
  {
    BrowseRequest br=new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);
      br.setFacetSpec("number",new FacetSpec());
     
      BoboBrowser browser = newBrowser();
     
      BrowseResult res=browser.browse(br);
      FacetAccessible facetAccessor = res.getFacetAccessor("number");
View Full Code Here

       
        br.setSort(new SortField[]{new SortField("number",SortField.CUSTOM,false)});
        doTest(br,2,null,new String[]{"7","1"});
       

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

      sel.addValue("001");
      sel.addValue("003");
      sel.addValue("007");
      br.addSelection(sel);
     
      FacetSpec ospec=new FacetSpec();
      br.setFacetSpec("compactnum", ospec);
     
      br.setSort(new SortField[]{new SortField("compactnum",SortField.CUSTOM,true)});
     
      HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
      
      answer.put("compactnum", Arrays.asList(new BrowseFacet[]{new BrowseFacet("001",3),new BrowseFacet("002",1),new BrowseFacet("003",3),new BrowseFacet("007",2),new BrowseFacet("008",1),new BrowseFacet("012",1)}));
       
      doTest(br,6,answer,new String[]{"3","7","4","6","1","5"});
     
     
      br=new BrowseRequest();
    br.setCount(10);
      br.setOffset(0);
      sel=new BrowseSelection("compactnum");
      sel.addValue("001");
      sel.addValue("002");
      sel.addValue("003");
      br.addSelection(sel);
      sel.setSelectionOperation(ValueOperation.ValueOperationAnd);
      doTest(br,1,null,new String[]{"6"});
     
      br=new BrowseRequest();
    br.setCount(10);
      br.setOffset(0);
      sel=new BrowseSelection("compactnum");
      sel.addValue("001");
      sel.addValue("003");
      sel.addValue("008");
      sel.setSelectionOperation(ValueOperation.ValueOperationOr);
      br.addSelection(sel);
     
      sel=new BrowseSelection("color");
      sel.addValue("red");
      br.addSelection(sel);
     
      ospec=new FacetSpec();
      br.setFacetSpec("color", ospec);
     
      ospec=new FacetSpec();
      br.setFacetSpec("compactnum",ospec);
      answer=new HashMap<String,List<BrowseFacet>>();
          
          answer.put("compactnum", Arrays.asList(new BrowseFacet[]{new BrowseFacet("001",1),new BrowseFacet("003",2),new BrowseFacet("008",1)}));
          answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("red",2)}));
View Full Code Here

      sel.addValue("003");
      sel.addValue("007");
      br.addSelection(sel);
     

      FacetSpec ospec=new FacetSpec();
      br.setFacetSpec("multinum", ospec);
      br.setSort(new SortField[]{new SortField("multinum",SortField.CUSTOM,true)});
      HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();

    answer.put("multinum", Arrays.asList(new BrowseFacet[]{new BrowseFacet("001",3),new BrowseFacet("002",1),new BrowseFacet("003",3),new BrowseFacet("007",2),new BrowseFacet("008",1),new BrowseFacet("012",1)}));
     
      doTest(br,6,answer,new String[]{"3","4","7","1","6","5"});
     
     
   
    br=new BrowseRequest();
    br.setCount(10);
      br.setOffset(0);
      sel=new BrowseSelection("multinum");
      sel.addValue("001");
      sel.addValue("002");
      sel.addValue("003");
      br.addSelection(sel);
      sel.setSelectionOperation(ValueOperation.ValueOperationAnd);
      doTest(br,1,null,new String[]{"6"});
     
      br=new BrowseRequest();
    br.setCount(10);
      br.setOffset(0);
      sel=new BrowseSelection("multinum");
      sel.addValue("001");
      sel.addValue("003");
      sel.addValue("008");
      sel.setSelectionOperation(ValueOperation.ValueOperationOr);
      br.addSelection(sel);
     
      sel=new BrowseSelection("color");
      sel.addValue("red");
      br.addSelection(sel);
     
      ospec=new FacetSpec();
      br.setFacetSpec("color", ospec);
           
      ospec=new FacetSpec();
      br.setFacetSpec("multinum",ospec);
      answer=new HashMap<String,List<BrowseFacet>>();
      
      answer.put("multinum", Arrays.asList(new BrowseFacet[]{new BrowseFacet("001",1),new BrowseFacet("003",2),new BrowseFacet("008",1)}));
      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("red",2)}));
View Full Code Here

   
    BrowseSelection sel=new BrowseSelection("color");
    sel.addNotValue("red");
    br.addSelection(sel);
   
    FacetSpec simpleOutput=new FacetSpec();
    br.setFacetSpec("shape", simpleOutput);
   
    HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("shape", Arrays.asList(new BrowseFacet[]{new BrowseFacet("circle",2),new BrowseFacet("rectangle",1),new BrowseFacet("square",1)}));
View Full Code Here

  public void testDateRange() {
    BrowseRequest br=new BrowseRequest();
    br.setCount(10);
    br.setOffset(0);
   
    FacetSpec simpleOutput=new FacetSpec();
    simpleOutput.setExpandSelection(true);
    br.setFacetSpec("date", simpleOutput);
   
    HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("date",  Arrays.asList(new BrowseFacet[]{new BrowseFacet("[2000/01/01 TO 2003/05/05]", 4), new BrowseFacet("[2003/05/06 TO 2005/04/04]",1)}));
    doTest(br,7,answer,null);
View Full Code Here

  public void testNumEndorsers() {
    BrowseRequest br=new BrowseRequest();
    br.setCount(10);
    br.setOffset(0);
   
    FacetSpec simpleOutput=new FacetSpec();
    simpleOutput.setExpandSelection(true);
    br.setFacetSpec("numendorsers", simpleOutput);
   
    HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("numendorsers",  Arrays.asList(new BrowseFacet[]{new BrowseFacet("[000000 TO 000005]", 2), new BrowseFacet("[000006 TO 000010]",2), new BrowseFacet("[000011 TO 000020]",3)}));
    doTest(br,7,answer,null);
View Full Code Here

   
      sel=new BrowseSelection("tag");
    sel.addValue("rabbit");
    br.addSelection(sel);
   
    FacetSpec output=new FacetSpec();
    output.setMaxCount(5);
   
    FacetSpec simpleOutput=new FacetSpec();
    simpleOutput.setExpandSelection(true);
   
   
    br.setFacetSpec("color", simpleOutput);
    br.setFacetSpec("size", output);
    br.setFacetSpec("shape", simpleOutput);
    br.setFacetSpec("location", output);
   
    FacetSpec tagOutput=new FacetSpec();
    tagOutput.setMaxCount(5);
    tagOutput.setOrderBy(FacetSortSpec.OrderHitsDesc);
   
    br.setFacetSpec("tag", tagOutput);
   
    HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("color",  Arrays.asList(new BrowseFacet[]{new BrowseFacet("green",1),new BrowseFacet("red",2)}));
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.