Package org.apache.lucene.store

Examples of org.apache.lucene.store.LockFactory


   * @return the created {@code FSDirectory} instance
   *
   * @throws IOException if an error
   */
  public static FSDirectory createFSIndex(File indexDir, Properties properties) throws IOException {
    LockFactory lockFactory = createLockFactory( indexDir, properties );
    FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
    FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, null );

    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
View Full Code Here


   * @return the created {@code FSDirectory} instance
   *
   * @throws IOException if an error
   */
  public static FSDirectory createFSIndex(File indexDir, Properties properties) throws IOException {
    LockFactory lockFactory = createLockFactory( indexDir, properties );
    FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
    FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, null );

    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
View Full Code Here

            if (!dir.mkdirs()) {
                if (!dir.isDirectory()) {
                    throw new IOException("Unable to create directory: '" + dir + "'");
                }
            }
            LockFactory lockFactory = new NativeFSLockFactory(dir);
            if (simpleFS) {
                directory = new SimpleFSDirectory(dir, lockFactory);
            } else {
                directory = FSDirectory.open(dir, lockFactory);
            }
View Full Code Here

   * @param properties the configuration properties
   * @return the created {@code FSDirectory} instance
   * @throws java.io.IOException if an error
   */
  public static FSDirectory createFSIndex(File indexDir, Properties properties, ServiceManager serviceManager) throws IOException {
    LockFactory lockFactory = createLockFactory( indexDir, properties, serviceManager );
    FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
    FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, null );

    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
View Full Code Here

    private final boolean suggestUseCompoundFile;

    @Inject public MmapFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore, ByteBufferCache byteBufferCache) throws IOException {
        super(shardId, indexSettings, indexStore);
        LockFactory lockFactory = buildLockFactory();
        File location = ((FsIndexStore) indexStore).shardIndexLocation(shardId);
        FileSystemUtils.mkdirs(location);
        this.fsDirectory = new MMapDirectory(location, lockFactory);

        boolean suggestUseCompoundFile;
View Full Code Here

    private final boolean suggestUseCompoundFile;

    @Inject public SimpleFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore, ByteBufferCache byteBufferCache) throws IOException {
        super(shardId, indexSettings, indexStore);
        LockFactory lockFactory = buildLockFactory();
        File location = ((FsIndexStore) indexStore).shardIndexLocation(shardId);
        FileSystemUtils.mkdirs(location);
        this.fsDirectory = new SimpleFSDirectory(location, lockFactory);

        boolean suggestUseCompoundFile;
View Full Code Here

    public abstract FSDirectory fsDirectory();

    protected LockFactory buildLockFactory() throws IOException {
        String fsLock = componentSettings.get("fs_lock", "native");
        LockFactory lockFactory = new NoLockFactory();
        if (fsLock.equals("native")) {
            // TODO LUCENE MONITOR: this is not needed in next Lucene version
            lockFactory = new NativeFSLockFactory();
        } else if (fsLock.equals("simple")) {
            lockFactory = new SimpleFSLockFactory();
View Full Code Here

    private final boolean suggestUseCompoundFile;

    @Inject public NioFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore, ByteBufferCache byteBufferCache) throws IOException {
        super(shardId, indexSettings, indexStore);
        LockFactory lockFactory = buildLockFactory();
        File location = ((FsIndexStore) indexStore).shardIndexLocation(shardId);
        FileSystemUtils.mkdirs(location);
        this.fsDirectory = new NIOFSDirectory(location, lockFactory);

        boolean suggestUseCompoundFile;
View Full Code Here

            if (!dir.mkdirs()) {
                if (!dir.isDirectory()) {
                    throw new IOException("Unable to create directory: '" + dir + "'");
                }
            }
            LockFactory lockFactory = new NativeFSLockFactory(dir);
            if (simpleFS) {
                directory = new SimpleFSDirectory(dir, lockFactory);
            } else {
                directory = FSDirectory.open(dir, lockFactory);
            }
View Full Code Here

   * @param indexDir The directory where to write a new index
   * @return the created FSDirectory
   * @throws IOException
   */
  public static FSDirectory createFSIndex(File indexDir, Properties dirConfiguration) throws IOException {
    LockFactory lockFactory = createLockFactory(indexDir, dirConfiguration);
    FSDirectory fsDirectory = FSDirectory.open( indexDir, null );
    // must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
    // throw an exception if it's different than a previous setting.
    fsDirectory.setLockFactory( lockFactory );
    if ( ! IndexReader.indexExists( fsDirectory ) ) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.store.LockFactory

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.