Examples of LuceneIndexWriter


Examples of org.springmodules.lucene.index.factory.LuceneIndexWriter

  public void addDocuments(List documents) {
    addDocuments(documents, null);
  }

  public void addDocuments(List documents, Analyzer analyzer) {
    LuceneIndexWriter writer = IndexWriterFactoryUtils.getIndexWriter(indexFactory);
    try {
      for(Iterator i=documents.iterator();i.hasNext();) {
        Document document=(Document)i.next();
        doAddDocument(writer, document, analyzer);
      }
View Full Code Here

Examples of org.springmodules.lucene.index.factory.LuceneIndexWriter

  public void addIndex(Directory directory) {
    addIndexes(new Directory[] { directory });
  }

  public void addIndexes(Directory[] directories) {
    LuceneIndexWriter writer = IndexWriterFactoryUtils.getIndexWriter(indexFactory);
    try {
      writer.addIndexes(directories);
    } catch(IOException ex) {
      throw new LuceneIndexAccessException("Error during adding indexes.", ex);
    } finally {
      IndexWriterFactoryUtils.releaseIndexWriter(indexFactory, writer);
    }
View Full Code Here

Examples of org.springmodules.lucene.index.factory.LuceneIndexWriter

  //-------------------------------------------------------------------------
  // Methods dealing with index optimization
  //-------------------------------------------------------------------------

  public void optimize() {
    LuceneIndexWriter writer = IndexWriterFactoryUtils.getIndexWriter(indexFactory);
    try {
      writer.optimize();
    } catch(IOException ex) {
      throw new LuceneIndexAccessException("Error during optimize the index.", ex);
    } finally {
      IndexWriterFactoryUtils.releaseIndexWriter(indexFactory, writer);
    }
View Full Code Here

Examples of org.springmodules.lucene.index.factory.LuceneIndexWriter

      IndexReaderFactoryUtils.releaseIndexReader(indexFactory, reader);
    }
  }

  public Object write(WriterCallback callback) {
    LuceneIndexWriter writer = IndexWriterFactoryUtils.getIndexWriter(indexFactory);
    try {
      return callback.doWithWriter(writer);
    } catch(Exception ex) {
      throw new LuceneIndexAccessException("Error during using the IndexWriter.", ex);
    } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.