Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.BrowseRequest


      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("blue",2),new BrowseFacet("green",1),new BrowseFacet("red",1)}));
      doTest(br,4,answer,new String[]{"4","2","5","3"});
  }
 
  public void testDate2(){
      BrowseRequest br=new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);
     
      BrowseSelection sel=new BrowseSelection("date");
      sel.addValue("[2005/01/01 TO *]");
      br.addSelection(sel);
     
      FacetSpec ospec=new FacetSpec();
      ospec.setExpandSelection(false);
      br.setFacetSpec("color", ospec);
    
      br.addSortField(new SortField("date",SortField.CUSTOM,true));
     
      HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("green",1),new BrowseFacet("red",1)}));
      doTest(br,2,answer,new String[]{"6","7"});
    }
View Full Code Here


      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("green",1),new BrowseFacet("red",1)}));
      doTest(br,2,answer,new String[]{"6","7"});
    }
 
  public void testDate3(){
      BrowseRequest br=new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);
     
      BrowseSelection sel=new BrowseSelection("date");
      sel.addValue("[* TO 2002/01/01]");
      br.addSelection(sel);
     
      FacetSpec ospec=new FacetSpec();
      ospec.setExpandSelection(false);
      br.setFacetSpec("color", ospec);
    
      br.addSortField(new SortField("date",SortField.CUSTOM,true));
     
      HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("green",1),new BrowseFacet("red",1)}));
      doTest(br,2,answer,new String[]{"3","1"});
    }
View Full Code Here

        facetHandlers.add(new SimpleFacetHandler("id"));
       
        BoboIndexReader reader= BoboIndexReader.getInstance(srcReader,facetHandlers, null);       // not facet handlers to help
        BoboBrowser browser = new BoboBrowser(reader);
       
        BrowseRequest browseRequest = new BrowseRequest();
        browseRequest.setCount(10);
        browseRequest.setOffset(0);
        browseRequest.addSortField(new SortField("date",SortField.STRING));
       

        doTest(browser,browseRequest,7,null,new String[]{"1","3","5","2","4","7","6"});
       
      }
View Full Code Here

  }
 
  public void testFacetSort()
  {

      BrowseRequest br=new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);
     
      FacetSpec colorSpec = new FacetSpec();
      colorSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
      br.setFacetSpec("color", colorSpec);
     

      FacetSpec shapeSpec = new FacetSpec();
      shapeSpec.setOrderBy(FacetSortSpec.OrderValueAsc);
      br.setFacetSpec("shape", shapeSpec);
     
      HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("red",3),new BrowseFacet("blue",2),new BrowseFacet("green",2)}));
      answer.put("shape", Arrays.asList(new BrowseFacet[]{new BrowseFacet("circle",2),new BrowseFacet("rectangle",2),new BrowseFacet("square",3)}));
     
View Full Code Here

      assertTrue(v>0);
  }
 
  public void testMultiDate()
  {
    BrowseRequest br=new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);
     
      BrowseSelection sel=new BrowseSelection("date");
      sel.addValue("[2000/01/01 TO 2002/07/07]");
      sel.addValue("[2003/01/01 TO 2005/01/01]");
      br.addSelection(sel);

      br.addSortField(new SortField("date",SortField.CUSTOM,false));

      doTest(br,5,null,new String[]{"1","3","5","2","4"});
  }
View Full Code Here

      doTest(br,5,null,new String[]{"1","3","5","2","4"});
  }
 
  public void testNoCount(){
    BrowseRequest br=new BrowseRequest();
      br.setCount(0);
      br.setOffset(0);
       
      BrowseSelection sel=new BrowseSelection("color");
      sel.addValue("red");
      br.addSelection(sel);
       
      FacetSpec ospec=new FacetSpec();
      ospec.setExpandSelection(false);
      br.setFacetSpec("color", ospec);
      

      HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("red",3)}));
      
View Full Code Here

      
      doTest(br,3,null,new String[0]);
  }

    public void testDate4(){
      BrowseRequest br=new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);
     
      BrowseSelection sel=new BrowseSelection("date");
      sel.addValue("[* TO *]");
      br.addSelection(sel);
     
      FacetSpec ospec=new FacetSpec();
      ospec.setExpandSelection(false);
      br.setFacetSpec("color", ospec);
    
      br.addSortField(new SortField("date",SortField.CUSTOM,false));
     
      doTest(br,7,null,new String[]{"1","3","5","2","4","7","6"});
    }
View Full Code Here

      doTest(br,7,null,new String[]{"1","3","5","2","4","7","6"});
    }
 
  public void testSort(){
    // no sel
    BrowseRequest br=new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);
     
      br.setSort(new SortField[]{new SortField("number",SortField.CUSTOM,true)});
      doTest(br,7,null,new String[]{"6","5","4","3","2","1","7"});
      br.setSort(new SortField[]{new SortField("name",SortField.STRING,false)});
      doTest(br,7,null,new String[]{"7","4","6","2","3","1","5"});
     
      BrowseSelection sel=new BrowseSelection("color");
      sel.addValue("red");
      br.addSelection(sel);
      br.setSort(new SortField[]{new SortField("number",SortField.CUSTOM,true)});
      doTest(br,3,null,new String[]{"2","1","7"});
      br.setSort(new SortField[]{new SortField("name",SortField.STRING,false)});
      doTest(br,3,null,new String[]{"7","2","1"});
     
      sel.addValue("blue");
      br.setQuery(new TermQuery(new Term("shape","square")));
      br.setSort(new SortField[]{new SortField("number",SortField.CUSTOM,true)});
      doTest(br,3,null,new String[]{"5","1","7"});
      br.setSort(new SortField[]{new SortField("name",SortField.STRING,false)});
      doTest(br,3,null,new String[]{"7","1","5"});
  }
View Full Code Here

      }
     
    }
    // no sel
    BrowseRequest br=new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);
       
      br.setSort(new SortField[]{new BoboCustomSortField("custom",false,new CustomSortComparatorSource())});
      doTest(br,7,null,new String[]{"5","4","6","3","7","2","1"});
     
     
  }
View Full Code Here

     
     
  }

  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)});
     
      HashMap<String,List<BrowseFacet>> answer=new HashMap<String,List<BrowseFacet>>();
      answer.put("color", Arrays.asList(new BrowseFacet[]{new BrowseFacet("red",3),new BrowseFacet("blue",2)}));
     
      doTest(br,7,answer,new String[]{"7","1","2"});
View Full Code Here

TOP

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

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.