Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.FacetSpec


    propMap.put(PathFacetHandler.SEL_PROP_NAME_STRICT, "false");
    sel.setSelectionProperties(propMap);

    req.addSelection(sel);

    FacetSpec fs = new FacetSpec();
    fs.setMinHitCount(1);
    req.setFacetSpec(PathHandlerName, fs);

    BrowseResult res = browser.browse(req);
    assertEquals(res.getNumHits(), 1);
    FacetAccessible fa = res.getFacetAccessor(PathHandlerName);
View Full Code Here


  public static void main(String[] args) throws Exception {
    int nThreads = 2;
    final int numIters = 200;

    String fname1 = "facet1";
    final FacetSpec fspec = new FacetSpec();
    fspec.setExpandSelection(true);
    fspec.setMaxCount(50);
    fspec.setMinHitCount(1);
    fspec.setOrderBy(FacetSortSpec.OrderHitsDesc);

    final List<FacetAccessible> list1 = new ArrayList<FacetAccessible>(numSegs);
    for (int i = 0; i < numSegs; ++i) {
      list1.add(buildSubAccessible(fname1, i, fspec));
    }
View Full Code Here

    BrowseSelection makeSel = new BrowseSelection("make");
    makeSel.addValue("rav4");
    br.addSelection(makeSel);

    FacetSpec spec = new FacetSpec();
    spec.setExpandSelection(true);
    spec.setOrderBy(FacetSortSpec.OrderHitsDesc);
    spec.setMaxCount(15);

    br.setFacetSpec("mycolor", spec);
    br.setFacetSpec("id", spec);
    br.setFacetSpec("make", spec);
View Full Code Here

    BrowseSelection sel = new BrowseSelection("color");
    sel.addValue("red");
    br.addSelection(sel);

    FacetSpec output = new FacetSpec();
    output.setExpandSelection(true);
    br.setFacetSpec("color", output);
    br.setFacetSpec("shape", output);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
View Full Code Here

    sel.addValue("a");
    Properties prop = sel.getSelectionProperties();
    PathFacetHandler.setDepth(prop, 1);
    br.addSelection(sel);

    FacetSpec pathSpec = new FacetSpec();
    pathSpec.setOrderBy(FacetSortSpec.OrderValueAsc);
    br.setFacetSpec("path", pathSpec);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
      "path",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("a-b", 1), new BrowseFacet("a-c", 4),
          new BrowseFacet("a-e", 2) }));
    doTest(br, 7, answer, null);

    pathSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
    answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
      "path",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("a-c", 4), new BrowseFacet("a-e", 2),
          new BrowseFacet("a-b", 1) }));
    doTest(br, 7, answer, null);

    pathSpec.setMaxCount(2);
    answer = new HashMap<String, List<BrowseFacet>>();
    answer.put("path",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("a-c", 4), new BrowseFacet("a-e", 2) }));
    doTest(br, 7, answer, null);
  }
View Full Code Here

    BrowseSelection sel = new BrowseSelection("distance");
    sel.addValue("30,70:5");
    sel.addValue("60,120:1");
    br.addSelection(sel);

    FacetSpec geoSpec = new FacetSpec();
    geoSpec.setOrderBy(FacetSortSpec.OrderValueAsc);
    br.setFacetSpec("distance", geoSpec);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
      "distance",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("30,70:5", 2),
          new BrowseFacet("60,120:1", 2) }));
    doTest(br, 4, answer, new String[] { "1", "3", "4", "5" });
    // testing for selection of facet <60,120,1> and verifying that 2 documents match this facet.
    BrowseRequest br2 = new BrowseRequest();
    br2.setCount(10);
    br2.setOffset(0);

    BrowseSelection sel2 = new BrowseSelection("distance");
    sel2.addValue("60,120:1");
    HashMap<String, Float> map = new HashMap<String, Float>();
    map.put("0,120:1", 3.0f);
    FacetTermQuery geoQ = new FacetTermQuery(sel2, map);

    br2.setQuery(geoQ);
    doTest(br2, 2, null, new String[] { "1", "5" });

    // facet query for color "red" and getting facet counts for the distance facet.
    BrowseRequest br3 = new BrowseRequest();
    br3.setCount(10);
    br3.setOffset(0);

    BrowseSelection sel3 = new BrowseSelection("color");
    sel3.addValue("red");
    HashMap<String, Float> map3 = new HashMap<String, Float>();
    map3.put("red", 3.0f);
    FacetTermQuery colorQ = new FacetTermQuery(sel3, map3);

    br3.setFacetSpec("distance", geoSpec);
    geoSpec.setMinHitCount(0);
    br3.setQuery(colorQ); // query is color=red
    br3.addSelection(sel); // count facets <30,70,5> and <60,120,1>
    answer.clear();
    answer.put(
      "distance",
View Full Code Here

    BrowseSelection sel = new BrowseSelection("correctDistance");
    sel.addValue("30,75:100");
    sel.addValue("60,120:1");
    br.addSelection(sel);

    FacetSpec geoSpec = new FacetSpec();
    geoSpec.setMinHitCount(0);
    geoSpec.setOrderBy(FacetSortSpec.OrderValueAsc);
    br.setFacetSpec("correctDistance", geoSpec);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
      "correctDistance",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("30,75:100", 1),
          new BrowseFacet("60,120:1", 2) }));
    doTest(br, 3, answer, null);

    // testing for selection of facet <60,120,1> and verifying that 2 documents match this facet.
    BrowseRequest br2 = new BrowseRequest();
    br2.setCount(10);
    br2.setOffset(0);

    BrowseSelection sel2 = new BrowseSelection("correctDistance");
    sel2.addValue("60,120:1");
    HashMap<String, Float> map = new HashMap<String, Float>();
    map.put("60,120:1", 3.0f);
    FacetTermQuery geoQ = new FacetTermQuery(sel2, map);

    br2.setQuery(geoQ);
    doTest(br2, 2, null, new String[] { "1", "5" });

    // facet query for color "red" and getting facet counts for the distance facet.
    BrowseRequest br3 = new BrowseRequest();
    br3.setCount(10);
    br3.setOffset(0);

    BrowseSelection sel3 = new BrowseSelection("color");
    sel3.addValue("red");
    HashMap<String, Float> map3 = new HashMap<String, Float>();
    map3.put("red", 3.0f);
    FacetTermQuery colorQ = new FacetTermQuery(sel3, map3);

    br3.setFacetSpec("correctDistance", geoSpec);
    geoSpec.setMinHitCount(1);
    br3.setQuery(colorQ); // query is color=red
    br3.addSelection(sel); // count facets <30,70,5> and <60,120,1>
    answer.clear();
    answer.put("correctDistance",
      Arrays.asList(new BrowseFacet[] { new BrowseFacet("60,120:1", 1) }));
View Full Code Here

    sel.addValue("a");
    Properties prop = sel.getSelectionProperties();
    PathFacetHandler.setDepth(prop, 1);
    br.addSelection(sel);

    FacetSpec pathSpec = new FacetSpec();
    pathSpec.setMaxCount(3);

    pathSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
    br.setFacetSpec("multipath", pathSpec);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer = new HashMap<String, List<BrowseFacet>>();
    answer.put(
View Full Code Here

    Properties prop = sel.getSelectionProperties();
    PathFacetHandler.setDepth(prop, 1);
    PathFacetHandler.setStrict(prop, true);
    br.addSelection(sel);

    FacetSpec pathSpec = new FacetSpec();
    pathSpec.setMaxCount(3);

    pathSpec.setOrderBy(FacetSortSpec.OrderHitsDesc);
    br.setFacetSpec("path", pathSpec);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer = new HashMap<String, List<BrowseFacet>>();
    answer
        .put(
          "path",
          Arrays.asList(new BrowseFacet[] { new BrowseFacet("a-c-d", 2),
              new BrowseFacet("a-e-f", 1) }));
    doTest(br, 3, answer, null);

    pathSpec.setOrderBy(FacetSortSpec.OrderByCustom);
    pathSpec.setCustomComparatorFactory(new ComparatorFactory() {

      @Override
      public IntComparator newComparator(FieldValueAccessor fieldValueAccessor,
          final BigSegmentedArray counts) {
        return new IntComparator() {
View Full Code Here

    PathFacetHandler.setDepth(prop, 1);
    PathFacetHandler.setStrict(prop, true);
    sel.addValue("toy/lego");
    br.addSelection(sel);

    FacetSpec locationOutput = new FacetSpec();

    br.setFacetSpec("location", locationOutput);

    FacetSpec tagOutput = new FacetSpec();
    tagOutput.setMaxCount(50);
    tagOutput.setOrderBy(FacetSortSpec.OrderHitsDesc);

    br.setFacetSpec("tag", tagOutput);

    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();
    answer.put("location",
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.