Package org.apache.lucene.index

Examples of org.apache.lucene.index.DirectoryReader


    PathFacetHandler pathHandler = new PathFacetHandler("path", true);
    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();
View Full Code Here


    m_indexWriter.addDocument(doc3);
    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);
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

    Document doc3 = new Document();
    doc3.add(new TextField(text, "Foo3", Store.YES));
    m_indexWriter.addDocument(doc3);
    m_indexWriter.commit();

    DirectoryReader reader = DirectoryReader.open(m_indexWriter, true);
    IndexSearcher searcher = new IndexSearcher(reader);
    TopScoreDocCollector docCollector = TopScoreDocCollector.create(100, true);
    QueryParser queryParser = new QueryParser(Version.LUCENE_43, "text", new StandardAnalyzer(
        Version.LUCENE_43));
    Query query = queryParser.parse("Foo*");
    searcher.search(query, docCollector);
    TopDocs docs = docCollector.topDocs();
    ScoreDoc[] scoreDocs = docs.scoreDocs;

    assertEquals("should be doc 0", 0, scoreDocs[0].doc);
    assertEquals("should be doc 1", 1, scoreDocs[1].doc);
    assertEquals("should be doc 2", 2, scoreDocs[2].doc);

    reader.close();
  }
View Full Code Here

    SimpleFacetHandler colorHandler = new SimpleFacetHandler(color);

    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);
View Full Code Here

      Document[] data = createData();

      TestDataDigester testDigester = new TestDataDigester(_facetHandlers, data);
      BoboIndexer indexer = new BoboIndexer(testDigester, dir);
      indexer.index();
      DirectoryReader r = DirectoryReader.open(dir);
      r.close();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

    BrowseResult result = null;
    BoboBrowser boboBrowser = null;
    int expectedHitNum = 3;
    try {
      Directory ramIndexDir = createIndex();
      DirectoryReader srcReader = DirectoryReader.open(ramIndexDir);
      boboBrowser = new BoboBrowser(BoboMultiReader.getInstance(srcReader, _facetHandlers));
      result = boboBrowser.browse(br);

      assertEquals(expectedHitNum, result.getNumHits());
    } catch (BrowseException e) {
View Full Code Here

      fail("unable to load test");
    }
  }

  public void testFacetHandlerLoad() throws Exception {
    DirectoryReader reader = DirectoryReader.open(_ramDir);

    List<FacetHandler<?>> list = new LinkedList<FacetHandler<?>>();
    NoopFacetHandler h1 = new NoopFacetHandler("A");
    list.add(h1);
View Full Code Here

    boboReader.close();
    browser.close();
  }

  public void testNegativeLoadTest() throws Exception {
    DirectoryReader reader = DirectoryReader.open(_ramDir);

    List<FacetHandler<?>> list = new LinkedList<FacetHandler<?>>();
    HashSet<String> s1 = new HashSet<String>();
    s1.add("E");
    NoopFacetHandler h1 = new NoopFacetHandler("A", s1);
View Full Code Here

    try {
      Document[] data = createDataTwo();
      TestDataDigester testDigester = new TestDataDigester(_facetHandlers, data);
      BoboIndexer indexer = new BoboIndexer(testDigester, dir);
      indexer.index();
      DirectoryReader r = DirectoryReader.open(dir);
      r.close();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.DirectoryReader

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.