Package com.browseengine.bobo.facets.impl

Examples of com.browseengine.bobo.facets.impl.SimpleFacetHandler


  {
   
    IndexReader srcReader=IndexReader.open(_indexDir,true);
      try{
        List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
        facetHandlers.add(new SimpleFacetHandler("id"));
       
        BoboIndexReader reader= BoboIndexReader.getInstance(srcReader,facetHandlers, null);       // not facet handlers to help
        BoboBrowser browser = new BoboBrowser(reader);
       
        BrowseRequest browseRequest = new BrowseRequest();
View Full Code Here


    System.out.println("load the words " + words.length);

    final Collection<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    facetHandlers.add(new MultiValueFacetHandler("ccid", new PredefinedTermListFactory<Integer>(Integer.class,"0000000000")));
//    facetHandlers.add(new MultiValueFacetHandler("pcid", new PredefinedTermListFactory<Integer>(Integer.class,"0000000000")));
    facetHandlers.add(new SimpleFacetHandler("industry", new PredefinedTermListFactory<Integer>(Integer.class,"0000000000")));
    facetHandlers.add(new SimpleFacetHandler("geo_region"));
    facetHandlers.add(new MultiValueFacetHandler("education_id", new PredefinedTermListFactory<Integer>(Integer.class,"0000000000")));
    long tgetinstance = System.currentTimeMillis();
    final BoboIndexReader boboReader = BoboIndexReader.getInstance(reader, facetHandlers , null);
    System.out.println("getInstanceTime: " + (System.currentTimeMillis() - tgetinstance));
//warming
View Full Code Here

   
  }
 
  public static List<FacetHandler<?>> buildFieldConf(){
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    facetHandlers.add(new SimpleFacetHandler("id"));
    SimpleFacetHandler colorHandler = new SimpleFacetHandler("color");
    colorHandler.setTermCountSize(TermCountSize.small);
    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"));
View Full Code Here

    return dir;
  }
 
  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

    return dir;
  }
 
  public static List<FacetHandler<?>> createFacetHandlers(){
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    facetHandlers.add(new SimpleFacetHandler("id"));
    facetHandlers.add(new SimpleFacetHandler("make"));
    facetHandlers.add(new SimpleFacetHandler("mycolor", "color"));
   
    return facetHandlers;
  }
View Full Code Here

  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public static List<FacetHandler<?>> buildFieldConf() {
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    facetHandlers.add(new SimpleFacetHandler("id"));
    SimpleFacetHandler colorHandler = new SimpleFacetHandler("color");
    colorHandler.setTermCountSize(TermCountSize.small);
    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
     */
 
View Full Code Here

  public void testLuceneSort() throws IOException {

    DirectoryReader srcReader = DirectoryReader.open(_indexDir);
    try {
      List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
      facetHandlers.add(new SimpleFacetHandler("id"));

      BoboMultiReader reader = BoboMultiReader.getInstance(srcReader, facetHandlers);
      BoboBrowser browser = new BoboBrowser(reader);

      BrowseRequest browseRequest = new BrowseRequest();
View Full Code Here

    doc3.add(new TextField(text, "Foo3", Store.YES));
    doc3.add(new StringField(color, BLUE, Store.YES));
    m_indexWriter.addDocument(doc3);
    m_indexWriter.commit();

    SimpleFacetHandler colorHandler = new SimpleFacetHandler(color);

    List<FacetHandler<?>> handlerList = Arrays.asList(new FacetHandler<?>[] { colorHandler });

    DirectoryReader reader = DirectoryReader.open(m_indexWriter, true);
View Full Code Here

    return dir;
  }

  public static List<FacetHandler<?>> createFacetHandlers() {
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    facetHandlers.add(new SimpleFacetHandler("id"));
    facetHandlers.add(new SimpleFacetHandler("make"));
    facetHandlers.add(new SimpleFacetHandler("mycolor", "color"));

    return facetHandlers;
  }
View Full Code Here

    return dir;
  }

  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

TOP

Related Classes of com.browseengine.bobo.facets.impl.SimpleFacetHandler

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.