Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.BrowseFacet


    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) }));

    doTest(br, 4, answer, new String[] { "3", "4", "5", "6" });

    sel.addNotValue("green");

    answer.put("shape", Arrays.asList(new BrowseFacet[] { new BrowseFacet("circle", 1),
        new BrowseFacet("square", 1) }));

    doTest(br, 2, answer, new String[] { "4", "5" });

    br = new BrowseRequest();
    br.setCount(10);
View Full Code Here


    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

    br.addSelection(sel1);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
      "date",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("[2000/01/01 TO 2003/02/14]", 4),
          new BrowseFacet("[2003/05/06 TO 2005/04/04]", 1) }));
    doTest(br, 3, null, null);

    br.clearSelections();
    br.addSelection(sel2);
    doTest(br, 2, null, null);
View Full Code Here

    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

    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) }));
    answer.put(
      "size",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("[* TO 4]", 1),
          new BrowseFacet("[5 TO 8]", 1) }));
    answer.put("shape", Arrays.asList(new BrowseFacet[] { new BrowseFacet("square", 2) }));
    answer.put(
      "location",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("toy/lego/", 1),
          new BrowseFacet("toy/lego/block", 1) }));
    answer.put(
      "tag",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("rabbit", 2), new BrowseFacet("animal", 1),
          new BrowseFacet("dog", 1), new BrowseFacet("humane", 1), new BrowseFacet("pet", 1) }));
    doTest(br, 2, answer, null);

  }
View Full Code Here

        boboBrowser });
    BrowseResult mergedResult = multiBoboBrowser.browse(browseRequest);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put("color",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("red", 4), new BrowseFacet("green", 2) }));
    answer.put(
      "tag",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("animal", 2), new BrowseFacet("dog", 2),
          new BrowseFacet("humane", 2), new BrowseFacet("pet", 2), new BrowseFacet("rabbit", 4) }));
    answer.put("shape", Arrays.asList(new BrowseFacet[] { new BrowseFacet("square", 4) }));
    answer.put("date",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("[2000/01/01 TO 2003/05/05]", 2) }));

    doTest(mergedResult, browseRequest, 4, answer, new String[] { "7", "7", "1", "1" });

    browseRequest
        .setSort(new SortField[] { new SortField("multinum", SortField.Type.CUSTOM, true) });
View Full Code Here

    BrowseRequest req = new BrowseRequest();
    req.setFacetSpec("filtered_date", new FacetSpec());
    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
      "filtered_date",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("[2001/01/01 TO 2001/12/30]", 1),
          new BrowseFacet("[2007/01/01 TO 2007/12/30]", 1) }));

    doTest(browser, req, 7, answer, null);
  }
View Full Code Here

    req.setFacetSpec("number", numberSpec);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
      "number",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("2130", 1), new BrowseFacet("1013", 1),
          new BrowseFacet("0913", 1) }));

    doTest(req, 7, answer, null);

    numberSpec.setOrderBy(FacetSortSpec.OrderValueAsc);
    answer.put(
      "number",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("0005", 1), new BrowseFacet("0010", 1),
          new BrowseFacet("0011", 1) }));

    doTest(req, 7, answer, null);
  }
View Full Code Here

    req.setFacetSpec("groupby", fspec);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
      "groupby",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("red,rectangle,0011", 1),
          new BrowseFacet("red,square,0005", 1), new BrowseFacet("red,square,0010", 1) }));

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

    doTest(req, 3, answer, null);

    sel.setValues(new String[] { "red,square" });
    answer.put(
      "groupby",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("red,square,0005", 1),
          new BrowseFacet("red,square,0010", 1) }));

    doTest(req, 2, answer, null);

    sel.setValues(new String[] { "red,square,0005" });
    answer.put("groupby",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("red,square,0005", 1) }));

    doTest(req, 1, answer, null);

    req.removeSelection("groupby");
    fspec.setMaxCount(2);
    answer.put(
      "groupby",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("blue,circle,0913", 1),
          new BrowseFacet("blue,square,1013", 1) }));

    doTest(req, 7, answer, null);

  }
View Full Code Here

    FacetHandler<?> facetHandler = new DynamicTimeRangeFacetHandler("timerange", "timeinmillis",
        now, ranges);
    browser.setFacetHandler(facetHandler);
    //
    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.BrowseFacet

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.