Class IndexingService

java.lang.Object
org.ctan.site.services.search.base.IndexingBase
org.ctan.site.services.search.base.IndexingService

public class IndexingService extends IndexingBase
The class SearchService implements a service to perform a full-text search.
  • Constructor Details

    • IndexingService

      public IndexingService(File base)
      This is the constructor for IndexingService.
      Parameters:
      base - the base directory for the search index
    • IndexingService

      public IndexingService(CtanConfiguration.IndexConfig config) throws FileNotFoundException
      This is the constructor for the class IndexingService.
      Parameters:
      config - the index configuration
      Throws:
      FileNotFoundException - in case that one of the index directories does not exist
  • Method Details

    • clearIndexDir

      public boolean clearIndexDir(IndexType type)
      Remove all files in the index directory.
      Parameters:
      type - the index type
      Returns:
      true iff the directory and the files contained could be deleted
    • createWriter

      protected org.apache.lucene.index.IndexWriter createWriter(IndexType type, String locale) throws org.apache.lucene.index.CorruptIndexException, IOException
      Create an index writer.
      Parameters:
      type - the index type
      locale - the language code
      Returns:
      the new index writer
      Throws:
      org.apache.lucene.index.CorruptIndexException - in case of a problem with the index
      IOException - in case of an I/O error
    • indexingSession

      public IndexingSession indexingSession() throws FileNotFoundException
      The method indexingSession provides means to open a new indexing session.
      Returns:
      the new indexing session
      Throws:
      FileNotFoundException - if the file is not found
    • initializeIndices

      public void initializeIndices(IndexingStore... stores) throws org.apache.lucene.index.CorruptIndexException, IOException
      This method iterates through all index types and creates the associated index.
      Parameters:
      stores - the array of stores to use for indexing
      Throws:
      IOException - in case of an I/O error
      org.apache.lucene.index.CorruptIndexException - in case of an error