Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.BoboMultiReader$BoboSubReaderWrapper


    facetHandlers.add(pathHandler);
  }

  public void testMultiValPath() throws Exception {
    DirectoryReader reader = DirectoryReader.open(directory);
    BoboMultiReader boboReader = BoboMultiReader.getInstance(reader, facetHandlers);

    BoboBrowser browser = new BoboBrowser(boboReader);
    BrowseRequest req = new BrowseRequest();

    BrowseSelection sel = new BrowseSelection(PathHandlerName);
View Full Code Here


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

    DirectoryReader reader = BoboMultiReader.open(m_indexWriter, true);

    BoboMultiReader boboMultiReader = BoboMultiReader.getInstance(reader, handlerList);

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

    m_indexWriter.commit();

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

    DirectoryReader reader = BoboMultiReader.open(m_indexWriter, true);
    BoboMultiReader boboMultiReader = BoboMultiReader.getInstance(reader, handlerList);

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

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

    DirectoryReader reader = DirectoryReader.open(m_indexWriter, true);

    BoboMultiReader boboMultiReader = BoboMultiReader.getInstance(reader, handlerList);

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

    HashSet<String> s5 = new HashSet<String>();
    s5.add("E");
    NoopFacetHandler h5 = new NoopFacetHandler("E", s5);
    list.add(h5);

    BoboMultiReader boboReader = BoboMultiReader.getInstance(reader, list);

    BoboBrowser browser = new BoboBrowser(boboReader);
    HashSet<String> s6 = new HashSet<String>();
    s6.add("A");
    s6.add("B");
    s6.add("C");
    s6.add("D");
    browser.setFacetHandler(new NoopFacetHandler("runtime", s6));

    Set<String> expected = new HashSet<String>();
    expected.add("A");
    expected.add("B");
    expected.add("C");
    expected.add("D");
    expected.add("E");
    expected.add("runtime");

    Set<String> facetsLoaded = browser.getFacetNames();

    Iterator<String> iter = facetsLoaded.iterator();
    while (iter.hasNext()) {
      String name = iter.next();
      if (expected.contains(name)) {
        expected.remove(name);
      } else {
        fail(name + " is not in expected set.");
      }
    }

    if (expected.size() > 0) {
      fail("some facets not loaded: " + expected);
    }

    boboReader.close();
    browser.close();
  }
View Full Code Here

    HashSet<String> s5 = new HashSet<String>();
    s5.add("E");
    NoopFacetHandler h5 = new NoopFacetHandler("E", s5);
    list.add(h5);

    BoboMultiReader boboReader = BoboMultiReader.getInstance(reader, list);

    BoboBrowser browser = new BoboBrowser(boboReader);

    Set<String> expected = new HashSet<String>();
    expected.add("A");
    expected.add("B");
    expected.add("C");
    expected.add("D");
    expected.add("E");

    Set<String> facetsLoaded = browser.getFacetNames();

    Iterator<String> iter = facetsLoaded.iterator();
    while (iter.hasNext()) {
      String name = iter.next();
      if (expected.contains(name)) {
        expected.remove(name);
      } else {
        fail(name + " is not in expected set.");
      }
    }

    if (expected.size() > 0) {
      if (expected.size() == 4) {
        expected.remove("A");
        expected.remove("B");
        expected.remove("C");
        expected.remove("D");
        if (expected.size() > 0) {
          fail("some facets not loaded: " + expected);
        }
      } else {
        fail("incorrect number of left over facets: " + expected);
      }
    }

    boboReader.close();
    browser.close();
  }
View Full Code Here

  }

  private BoboMultiReader newIndexReader() throws IOException {
    DirectoryReader srcReader = DirectoryReader.open(_indexDir);
    try {
      BoboMultiReader reader = BoboMultiReader.getInstance(srcReader, _fconf);
      return reader;
    } catch (IOException ioe) {
      if (srcReader != null) {
        srcReader.close();
      }
View Full Code Here

    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();
      browseRequest.setCount(10);
      browseRequest.setOffset(0);
View Full Code Here

    br.addSelection(sel);
    HashMap<String, List<BrowseFacet>> answer = new HashMap<String, List<BrowseFacet>>();

    doTest(br, 3, answer, new String[] { "1", "2", "7" });

    BoboMultiReader reader = null;
    try {
      Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_43);
      IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_43, analyzer);
      IndexWriter idxWriter = new IndexWriter(_indexDir, config);
      idxWriter.deleteDocuments(new Term("id", "1"));
      idxWriter.deleteDocuments(new Term("id", "2"));
      idxWriter.commit();
      reader = newIndexReader();

      br = new BrowseRequest();
      br.setCount(10);
      br.setOffset(0);

      sel = new BrowseSelection("color");
      sel.addValue("red");
      br.addSelection(sel);
      answer = new HashMap<String, List<BrowseFacet>>();

      doTest(new BoboBrowser(reader), br, 1, answer, new String[] { "7" });
    } catch (IOException ioe) {
      fail(ioe.getMessage());
    } finally {
      if (reader != null) {
        try {
          reader.close();
        } catch (IOException e) {
          fail(e.getMessage());
        }
      }
    }
View Full Code Here

      idxWriter.forceMerge(1);
      idxWriter.commit();
    }
    idxWriter.close();
    DirectoryReader idxReader = DirectoryReader.open(idxDir);
    BoboMultiReader boboReader = BoboMultiReader.getInstance(idxReader, facetHandlers);
    BoboBrowser browser = new BoboBrowser(boboReader);
    List<String> ranges = new ArrayList<String>();
    ranges.add("000000001");
    ranges.add("000010000");// one hour
    ranges.add("000020000");// two hours
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.api.BoboMultiReader$BoboSubReaderWrapper

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.