Package org.sindice.siren.demo

Examples of org.sindice.siren.demo.SimpleIndexer


    logger.info("Creating index directory {}", indexDir);
    indexDir.mkdirs();
  }

  public void index() throws IOException {
    final SimpleIndexer indexer = new SimpleIndexer(indexDir);
    try {
      int counter = 0;
      final LineIterator it = FileUtils.lineIterator(BNB_PATH);
      while (it.hasNext()) {
        final String id = Integer.toString(counter++);
        final String content = (String) it.next();
        logger.info("Indexing document {}", id);
        indexer.addDocument(id, content);
      }
      LineIterator.closeQuietly(it);
      logger.info("Commiting all pending documents");
      indexer.commit();
    }
    finally {
      logger.info("Closing index");
      indexer.close();
    }
  }
View Full Code Here


    logger.info("Creating index directory {}", indexDir);
    indexDir.mkdirs();
  }

  public void index() throws IOException {
    final SimpleIndexer indexer = new SimpleIndexer(indexDir);
    try {
      final Iterator<File> it = FileUtils.iterateFiles(MOVIE_PATH, null, false);
      while (it.hasNext()) {
        final File file = it.next();
        final String id = file.getName().toString();
        final String content = FileUtils.readFileToString(file);
        logger.info("Indexing document {}", id);
        indexer.addDocument(id, content);
      }
      logger.info("Commiting all pending documents");
      indexer.commit();
    }
    finally {
      logger.info("Closing index");
      indexer.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.sindice.siren.demo.SimpleIndexer

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.