Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.BrowseFacet


    br.addSortField(new SortField("date", SortField.Type.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


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

    doTest(br, 7, answer, null);

    Comparator<BrowseFacet> valComp = new FacetValueComparatorFactory().newComparator();

    int v = valComp.compare(new BrowseFacet("red", 3), new BrowseFacet("blue", 2));
    assertTrue(v > 0);

    valComp = new FacetHitcountComparatorFactory().newComparator();
    v = valComp.compare(new BrowseFacet("red", 3), new BrowseFacet("blue", 2));
    assertTrue(v < 0);

    v = valComp.compare(new BrowseFacet("red", 3), new BrowseFacet("blue", 3));
    assertTrue(v > 0);
  }
View Full Code Here

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

    doTest(br, 3, null, new String[0]);
  }
View Full Code Here

    br.setSort(new SortField[] { new SortField("number", SortField.Type.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

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

    doTest(br, 3, answer, null);
  }
View Full Code Here

    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

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

      br.clearSelections();
      answer.put(
        "color",
        Arrays.asList(new BrowseFacet[] { new BrowseFacet("blue", 2), new BrowseFacet("green", 1),
            new BrowseFacet("red", 2) }));
      doTest(br, 5, answer, new String[] { "7", "1", "3", "4", "5" });

    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
View Full Code Here

    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) }));
    doTest(br, 2, answer, new String[] { "1", "7" });

    doTest(br, 2, answer, new String[] { "1", "7" });
  }
View Full Code Here

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

    answer.put("multiwithweight",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("cool", 3), new BrowseFacet("good", 2) }));

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

    br.setSort(new SortField[] { new SortField("multinum", SortField.Type.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) }));
    doTest(br, 2, answer, new String[] { "1", "7" });

  }
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.