Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.FacetAccessible


    Set<Entry<String,FacetAccessible>> entries = facetMap.entrySet();
    for (Entry<String,FacetAccessible> entry : entries){
     
      NamedList facetList = new NamedList();
      facetFieldList.add(entry.getKey(), facetList);
      FacetAccessible facetAccessbile = entry.getValue();
      List<BrowseFacet> facets = facetAccessbile.getFacets();
      for (BrowseFacet facet : facets){
        facetList.add(facet.getValue(),facet.getFacetValueHitCount());
      }
    }
   
View Full Code Here


   
    writer.addAttribute("count", String.valueOf(facetAccessors.size()));
   
    for (Entry<String,FacetAccessible> entry : facetAccessors){
      String choiceName=entry.getKey();
      FacetAccessible facetAccessor = entry.getValue();
     
      List<BrowseFacet> facetList = facetAccessor.getFacets();
     
      writer.startNode("facet");
      writer.addAttribute("name", choiceName);
     
      writer.addAttribute("facetcount", String.valueOf(facetList.size()));
View Full Code Here

    fs.setMinHitCount(1);
    req.setFacetSpec(PathHandlerName, fs);
   
    BrowseResult res = browser.browse(req);
    assertEquals(res.getNumHits(),1);
    FacetAccessible fa = res.getFacetAccessor(PathHandlerName);
    List<BrowseFacet> facets = fa.getFacets();
    System.out.println(facets);
    assertEquals(1,facets.size());
    BrowseFacet facet = facets.get(0);
    assertEquals(1,facet.getFacetValueHitCount());
  }
View Full Code Here

      long tf1=0;
      BrowseResult bres = browser.browse(req);
      for(Entry<String, FacetAccessible> entry: bres.getFacetMap().entrySet())
      {
//        System.out.println(entry.getKey());
        FacetAccessible fa = entry.getValue();
        tf0 = System.currentTimeMillis();
        List<BrowseFacet> facets = fa.getFacets();
        tf1=System.currentTimeMillis();
        System.out.println(tf1 - tf0 + "\tfacet "+entry.getKey()+" get time\tsize: " + facets.size());
//        System.out.println(Arrays.toString(facets.toArray()));
        fa.close();
      }
      browser.close();
//      System.out.println(t2 - t0 +"\ttotal time\t\t\t hits: "+ bres.getNumHits());
      hitscount += bres.getNumHits();
      long t2 = System.currentTimeMillis();
View Full Code Here

        if (choiceMap!=null){
          Set<Entry<String,FacetAccessible>> entries=res.getFacetMap().entrySet();
          if (entries.size() == choiceMap.size()){
            for (Entry<String,FacetAccessible> entry : entries){
              String name = entry.getKey();
              FacetAccessible c1 = entry.getValue();
              List<BrowseFacet> l1 = c1.getFacets();
              List<BrowseFacet> l2 =choiceMap.get(name);
             
              if (l1.size() == l2.size())
              {
                Iterator<BrowseFacet> iter1 = l1.iterator();
View Full Code Here

        if (choiceMap!=null){
          Set<Entry<String,FacetAccessible>> entries=res.getFacetMap().entrySet();
         
          if (res.getFacetMap().containsKey(facetName))
          {
            FacetAccessible c1 = res.getFacetMap().get(facetName);
            List<BrowseFacet> l1 = c1.getFacets();
            List<BrowseFacet> l2 =choiceMap.get(facetName);

            if (l1.size() == l2.size())
            {
              Iterator<BrowseFacet> iter1 = l1.iterator();
View Full Code Here

          buffer.append("{");
          for (Entry<String,FacetAccessible> entry : entries)
          {
            String name = entry.getKey();
            FacetAccessible facetAccessor = entry.getValue();
            buffer.append("name=").append(name).append(",");
            buffer.append("facets=").append(facetAccessor.getFacets()).append(";");
          }
          buffer.append("}").append('\n');

          BrowseHit[] hits=result.getHits();
          for (int i=0;i<hits.length;++i){
View Full Code Here

   
    buffer.append("{");
    for (Entry<String,FacetAccessible> entry : entries)
    {
      String name = entry.getKey();
      FacetAccessible facetAccessor = entry.getValue();
      buffer.append("name=").append(name).append(",");
      buffer.append("facets=").append(facetAccessor.getFacets()).append(";");
    }
    buffer.append("}").append('\n');
    return buffer.toString();
  }
View Full Code Here

      br.setFacetSpec("number",new FacetSpec());
     
      BoboBrowser browser = newBrowser();
     
      BrowseResult res=browser.browse(br);
      FacetAccessible facetAccessor = res.getFacetAccessor("number");
      BrowseFacet facet = facetAccessor.getFacet("5");
     
      assertEquals(facet.getValue(), "0005");
      assertEquals(facet.getFacetValueHitCount(), 1);
      res.close();
  }
View Full Code Here

    BrowseRequest req = new BrowseRequest();
    BrowseFacet facet = null;
    FacetSpec facetSpec = new FacetSpec();
    req.setFacetSpec("timerange", facetSpec);
    BrowseResult result = browser.browse(req);
    FacetAccessible facetholder = result.getFacetAccessor("timerange");
    List<BrowseFacet> facets = facetholder.getFacets();
    facet = facets.get(0);
    assertEquals("order by value", "000000001", facet.getValue());
    assertEquals("order by value", 1 , facet.getFacetValueHitCount());
    facet = facets.get(1);
    assertEquals("order by value", "000010000", facet.getValue());
    assertEquals("order by value", 1 , facet.getFacetValueHitCount());
    facet = facets.get(5);
    assertEquals("order by value", "001000000", facet.getValue());
    assertEquals("order by value", 20 , facet.getFacetValueHitCount());
    facet = facets.get(7);
    assertEquals("order by value", "003000000", facet.getValue());
    assertEquals("order by value", 3 , facet.getFacetValueHitCount());
// 
    req = new BrowseRequest();
    facetSpec = new FacetSpec();
    facetSpec.setMinHitCount(0);
    facetSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
    req.setFacetSpec("timerange", facetSpec);
    result = browser.browse(req);
    facetholder = result.getFacetAccessor("timerange");
    facets = facetholder.getFacets();
    facet = facets.get(0);
    assertEquals("", "002000000", facet.getValue());
    assertEquals("", 25 , facet.getFacetValueHitCount());
    facet = facets.get(1);
    assertEquals("", "001000000", facet.getValue());
    assertEquals("", 20 , facet.getFacetValueHitCount());
    facet = facets.get(2);
    assertEquals("", "003000000", facet.getValue());
    assertEquals("", 3 , facet.getFacetValueHitCount());
    facet = facets.get(8);
    assertEquals("minCount=0", "004000000", facet.getValue());
    assertEquals("minCount=0", 0 , facet.getFacetValueHitCount());
// 
    req = new BrowseRequest();
    facetSpec = new FacetSpec();
    BrowseSelection sel = new BrowseSelection("timerange");
    sel.addValue("001000000");
    req.addSelection(sel);
    facetSpec.setExpandSelection(true);
    req.setFacetSpec("timerange", facetSpec);
    result = browser.browse(req);
    facetholder = result.getFacetAccessor("timerange");
    facets = facetholder.getFacets();
    facet = facets.get(0);
    assertEquals("", "000000001", facet.getValue());
    assertEquals("", 1 , facet.getFacetValueHitCount());
    facet = facets.get(6);
    assertEquals("", "002000000", facet.getValue());
    assertEquals("", 25 , facet.getFacetValueHitCount());
    facet = facets.get(7);
    assertEquals("", "003000000", facet.getValue());
    assertEquals("", 3 , facet.getFacetValueHitCount());
// 
    req = new BrowseRequest();
    facetSpec = new FacetSpec();
    sel = new BrowseSelection("timerange");
    sel.addValue("001000000");
    sel.addValue("003000000");
    sel.addValue("004000000");
    req.addSelection(sel );
    facetSpec.setExpandSelection(false);
    req.setFacetSpec("timerange", facetSpec);
    result = browser.browse(req);
    facetholder = result.getFacetAccessor("timerange");
    facet = facetholder.getFacet("001000000");
    assertEquals("001000000", 20, facet.getFacetValueHitCount());
    facet = facetholder.getFacet("003000000");
    assertEquals("003000000", 3, facet.getFacetValueHitCount());
    facet = facetholder.getFacet("004000000");
    assertEquals("004000000", 0, facet.getFacetValueHitCount());
    assertEquals("",23,result.getNumHits());
  }
View Full Code Here

TOP

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

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.