Package com.browseengine.bobo.facets.impl

Examples of com.browseengine.bobo.facets.impl.RangeFacetHandler$RangeBoboDocScorer


    facetHandlers.add(colorHandler);

    SimpleFacetHandler shapeHandler = new SimpleFacetHandler("shape");
    shapeHandler.setTermCountSize(TermCountSize.medium);
    facetHandlers.add(new SimpleFacetHandler("shape"));
    facetHandlers.add(new RangeFacetHandler("size", Arrays.asList(new String[]{"[* TO 4]", "[5 TO 8]", "[9 TO *]"})));
    String[] ranges = new String[]{"[000000 TO 000005]", "[000006 TO 000010]", "[000011 TO 000020]"};
    facetHandlers.add(new RangeFacetHandler("numendorsers", new PredefinedTermListFactory(Integer.class, "000000"), Arrays.asList(ranges)));
   
    PredefinedTermListFactory numTermFactory = new PredefinedTermListFactory(Integer.class, "0000");

    facetHandlers.add(new PathFacetHandler("location"));
   
    PathFacetHandler pathHandler = new PathFacetHandler("path");
    pathHandler.setSeparator("-");
    facetHandlers.add(pathHandler);
   

    PathFacetHandler multipathHandler = new PathFacetHandler("multipath",true);
    multipathHandler.setSeparator("-");
    facetHandlers.add(multipathHandler);
   
    facetHandlers.add(new SimpleFacetHandler("number", numTermFactory));
    facetHandlers.add(new SimpleFacetHandler("testStored"));
   
   

    facetHandlers.add(new SimpleFacetHandler("name"));
    facetHandlers.add(new RangeFacetHandler("date", new PredefinedTermListFactory(Date.class, "yyyy/MM/dd"), Arrays.asList(new String[]{"[2000/01/01 TO 2003/05/05]", "[2003/05/06 TO 2005/04/04]"})));
    facetHandlers.add(new SimpleFacetHandler("char", (TermListFactory)null));
    facetHandlers.add(new MultiValueFacetHandler("tag", (String)null, (TermListFactory)null, tagSizePayloadTerm));
    facetHandlers.add(new MultiValueFacetHandler("multinum", new PredefinedTermListFactory(Integer.class, "000")));
    facetHandlers.add(new CompactMultiValueFacetHandler("compactnum", new PredefinedTermListFactory(Integer.class, "000")));
    facetHandlers.add(new SimpleFacetHandler("storenum", new PredefinedTermListFactory(Long.class, null)));
    /* New FacetHandler for geographic locations. Depends on two RangeFacetHandlers on latitude and longitude */
    facetHandlers.add(new RangeFacetHandler("latitude", Arrays.asList(new String[]{"[* TO 30]", "[35 TO 60]", "[70 TO 120]"})));
    facetHandlers.add(new RangeFacetHandler("longitude", Arrays.asList(new String[]{"[* TO 30]", "[35 TO 60]", "[70 TO 120]"})));
    facetHandlers.add(new GeoSimpleFacetHandler("distance", "latitude", "longitude"));
    facetHandlers.add(new GeoFacetHandler("correctDistance", "latitude", "longitude"));
    /* Underlying time facet for DynamicTimeRangeFacetHandler */
    facetHandlers.add(new RangeFacetHandler("timeinmillis", new PredefinedTermListFactory(Long.class, DynamicTimeRangeFacetHandler.NUMBER_FORMAT),null));
   
    String[] predefinedSalaryRanges = new String[4];
    predefinedSalaryRanges[0] = new String("[04000 TO 05999]");
    predefinedSalaryRanges[1] = new String("[06000 TO 07999]");
    predefinedSalaryRanges[2] = new String("[08000 TO 09999]");
    predefinedSalaryRanges[3] = new String("[10000 TO *]");
    RangeFacetHandler dependedRangeFacet = new RangeFacetHandler("salary", Arrays.asList(predefinedSalaryRanges));
        facetHandlers.add(dependedRangeFacet);
   
    String[][] predefinedBuckets = new String[4][];
        predefinedBuckets[0] new String[]{"ken","igor","abe"};
        predefinedBuckets[1] new String[]{"ken","john","mike"};
View Full Code Here


  }
  public void testTime() throws Exception
  {
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    /* Underlying time facet for DynamicTimeRangeFacetHandler */
    facetHandlers.add(new RangeFacetHandler("timeinmillis", new PredefinedTermListFactory(Long.class, DynamicTimeRangeFacetHandler.NUMBER_FORMAT),null));
    Directory idxDir = new RAMDirectory();
    IndexWriter writer = new IndexWriter(idxDir,new StandardAnalyzer(Version.LUCENE_29),MaxFieldLength.UNLIMITED);
   
    long now = System.currentTimeMillis();
    DecimalFormat df = new DecimalFormat(DynamicTimeRangeFacetHandler.NUMBER_FORMAT);
View Full Code Here

 
  public static List<FacetHandler<?>> createFacetHandlers(){
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    facetHandlers.add(new SimpleFacetHandler("id"));
    facetHandlers.add(new SimpleFacetHandler("color"));
    FacetHandler<?> rangeFacetHandler = new RangeFacetHandler("idRange", "id", null); //, Arrays.asList(_idRanges));
    facetHandlers.add(rangeFacetHandler);
   
    return facetHandlers;
  }
View Full Code Here

    facetHandlers.add(colorHandler);

    SimpleFacetHandler shapeHandler = new SimpleFacetHandler("shape");
    shapeHandler.setTermCountSize(TermCountSize.medium);
    facetHandlers.add(new SimpleFacetHandler("shape"));
    facetHandlers.add(new RangeFacetHandler("size", Arrays.asList(new String[] { "[* TO 4]",
        "[5 TO 8]", "[9 TO *]" })));
    String[] ranges = new String[] { "[000000 TO 000005]", "[000006 TO 000010]",
        "[000011 TO 000020]" };
    facetHandlers.add(new RangeFacetHandler("numendorsers", new PredefinedTermListFactory(
        Integer.class, "000000"), Arrays.asList(ranges)));

    PredefinedTermListFactory numTermFactory = new PredefinedTermListFactory(Integer.class, "0000");

    facetHandlers.add(new PathFacetHandler("location"));

    PathFacetHandler pathHandler = new PathFacetHandler("path");
    pathHandler.setSeparator("-");
    facetHandlers.add(pathHandler);

    PathFacetHandler multipathHandler = new PathFacetHandler("multipath", true);
    multipathHandler.setSeparator("-");
    facetHandlers.add(multipathHandler);

    facetHandlers.add(new SimpleFacetHandler("number", numTermFactory));
    facetHandlers.add(new VirtualSimpleFacetHandler("virtual", numTermFactory,
        new FacetDataFetcher() {
          @Override
          public Object fetch(BoboSegmentReader reader, int doc) {
            FacetDataCache sourceCache = (FacetDataCache) reader.getFacetData("number");
            if (sourceCache == null) return null;
            return sourceCache.valArray.getRawValue(sourceCache.orderArray.get(doc));
          }

          @Override
          public void cleanup(BoboSegmentReader reader) {
            // do nothing here.
          }
        }, new HashSet<String>(Arrays.asList(new String[] { "number" }))));
    facetHandlers.add(new SimpleFacetHandler("testStored"));

    facetHandlers.add(new SimpleFacetHandler("name"));
    facetHandlers.add(new RangeFacetHandler("date", new PredefinedTermListFactory(Date.class,
        "yyyy/MM/dd"), Arrays.asList(new String[] { "[2000/01/01 TO 2003/05/05]",
        "[2003/05/06 TO 2005/04/04]" })));
    facetHandlers.add(new SimpleFacetHandler("char", (TermListFactory) null));
    facetHandlers.add(new MultiValueFacetHandler("tag", (String) null, (TermListFactory) null,
        tagSizePayloadTerm));
    facetHandlers.add(new MultiValueFacetHandler("multinum", new PredefinedTermListFactory(
        Integer.class, "000")));
    facetHandlers.add(new MultiValueFacetHandler("diffname", "multinum",
        new PredefinedTermListFactory(Integer.class, "000")));
    facetHandlers.add(new MultiValueWithWeightFacetHandler("multiwithweight"));
    facetHandlers.add(new CompactMultiValueFacetHandler("compactnum",
        new PredefinedTermListFactory(Integer.class, "000")));
    facetHandlers.add(new SimpleFacetHandler("storenum", new PredefinedTermListFactory(Long.class,
        null)));
    /*
     * New FacetHandler for geographic locations. Depends on two RangeFacetHandlers on latitude and
     * longitude
     */
    facetHandlers.add(new RangeFacetHandler("latitude", Arrays.asList(new String[] { "[* TO 30]",
        "[35 TO 60]", "[70 TO 120]" })));
    facetHandlers.add(new RangeFacetHandler("longitude", Arrays.asList(new String[] { "[* TO 30]",
        "[35 TO 60]", "[70 TO 120]" })));
    facetHandlers.add(new GeoSimpleFacetHandler("distance", "latitude", "longitude"));
    facetHandlers.add(new GeoFacetHandler("correctDistance", "latitude", "longitude"));
    /* Underlying time facet for DynamicTimeRangeFacetHandler */
    facetHandlers.add(new RangeFacetHandler("timeinmillis", new PredefinedTermListFactory(
        Long.class, DynamicTimeRangeFacetHandler.NUMBER_FORMAT), null));

    String[] predefinedSalaryRanges = new String[4];
    predefinedSalaryRanges[0] = new String("[04000 TO 05999]");
    predefinedSalaryRanges[1] = new String("[06000 TO 07999]");
    predefinedSalaryRanges[2] = new String("[08000 TO 09999]");
    predefinedSalaryRanges[3] = new String("[10000 TO *]");
    RangeFacetHandler dependedRangeFacet = new RangeFacetHandler("salary",
        Arrays.asList(predefinedSalaryRanges));
    facetHandlers.add(dependedRangeFacet);

    String[][] predefinedBuckets = new String[4][];
    predefinedBuckets[0] = new String[] { "ken", "igor", "abe" };
View Full Code Here

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public void testTime() throws Exception {
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    /* Underlying time facet for DynamicTimeRangeFacetHandler */
    facetHandlers.add(new RangeFacetHandler("timeinmillis", new PredefinedTermListFactory(
        Long.class, DynamicTimeRangeFacetHandler.NUMBER_FORMAT), null));
    Directory idxDir = new RAMDirectory();
    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_43);
    IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_43, analyzer);
    IndexWriter idxWriter = new IndexWriter(idxDir, config);
View Full Code Here

  public static List<FacetHandler<?>> createFacetHandlers() {
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    facetHandlers.add(new SimpleFacetHandler("id"));
    facetHandlers.add(new SimpleFacetHandler("color"));
    FacetHandler<?> rangeFacetHandler = new RangeFacetHandler("idRange", "id", null);
    facetHandlers.add(rangeFacetHandler);

    return facetHandlers;
  }
View Full Code Here

        return handler;
    }

    static RangeFacetHandler buildRangeHandler(String name, String fieldName, TermListFactory<?> termListFactory, Map<String, List<String>> paramMap) {
        LinkedList<String> predefinedRanges = buildPredefinedRanges(paramMap);
        return new RangeFacetHandler(name, fieldName, termListFactory, predefinedRanges);
    }
View Full Code Here

                    runtimeFacets.add(runtimeFacetFactory);
                    facetInfo.setRunTime(true);
                } else if (type.equals("dynamicTimeRange")) {
                    if (dependSet.isEmpty()) {
                        Assert.isTrue(fieldName != null && fieldName.length() > 0, "Facet handler " + name + " requires either depends or column attributes");
                        RangeFacetHandler internalFacet = new RangeFacetHandler(name + "_internal", fieldName, new PredefinedTermListFactory(Long.class, DynamicTimeRangeFacetHandler.NUMBER_FORMAT), null);
                        facets.add(internalFacet);
                        dependSet.add(internalFacet.getName());
                    }
                    RuntimeFacetHandlerFactory<?, ?> runtimeFacetFactory = getDynamicTimeFacetHandlerFactory(name, fieldName, dependSet, paramMap);
                    runtimeFacets.add(runtimeFacetFactory);
                    facetInfo.setRunTime(true);
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.facets.impl.RangeFacetHandler$RangeBoboDocScorer

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.