Examples of FSDirectory

Unfortunately, because of system peculiarities, there is no single overall best implementation. Therefore, we've added the {@link #open} method, to allow Lucene to choosethe best FSDirectory implementation given your environment, and the known limitations of each implementation. For users who have no reason to prefer a specific implementation, it's best to simply use {@link #open}. For all others, you should instantiate the desired implementation directly.

The locking implementation is by default {@link NativeFSLockFactory}, but can be changed by passing in a custom {@link LockFactory} instance. @see Directory

  • org.apache.nutch.indexer.FsDirectory
    Reads a Lucene index stored in DFS.
  • org.jnode.fs.FSDirectory
    FSDirectory interface provide methods related to directory operations in a file system. @author epr

  • Examples of org.apache.lucene.store.FSDirectory

        ChannelIndexFactory channelIndexFactory1 = (ChannelIndexFactory)context.getBean("fsDirectory1");
        assertNotNull(channelIndexFactory1);
        assertSame(indexFactory1, channelIndexFactory1.getTargetIndexFactory());*/

        FSDirectory directory2 = (FSDirectory)context.getBean("fsDirectory-fsDirectory2");
        assertNotNull(directory2);
        assertNotNull(directory2.getFile());
       
        SimpleIndexFactory indexFactory2 = (SimpleIndexFactory)context.getBean("target-fsDirectory2");
        assertNotNull(indexFactory2);
        assertSame(directory2, indexFactory2.getDirectory());
        assertSame(analyzer, indexFactory2.getAnalyzer());

        LockIndexFactory channelIndexFactory2 = (LockIndexFactory)context.getBean("fsDirectory2");
        assertNotNull(channelIndexFactory2);
        assertSame(indexFactory2, channelIndexFactory2.getTargetIndexFactory());

        //Directories 3 & 4
        /*FSDirectory directory3 = (FSDirectory)context.getBean("fsDirectory-fsDirectory3");
        assertNotNull(directory3);
        assertNotNull(directory3.getFile());

        SimpleIndexFactory indexFactory3 = (SimpleIndexFactory)context.getBean("target-fsDirectory3");
        assertNotNull(indexFactory3);
        assertNotNull(indexFactory3.getDirectory());
        assertSame(directory3, indexFactory3.getDirectory());
        assertNotNull(indexFactory3.getAnalyzer());
        assertNotSame(analyzer, indexFactory3.getAnalyzer());

        ChannelIndexFactory channelIndexFactory3 = (ChannelIndexFactory)context.getBean("fsDirectory3");
        assertNotNull(channelIndexFactory3);
        assertSame(indexFactory3, channelIndexFactory3.getTargetIndexFactory());*/

        FSDirectory directory4 = (FSDirectory)context.getBean("fsDirectory-fsDirectory4");
        assertNotNull(directory4);
        assertNotNull(directory4.getFile());

        SimpleIndexFactory indexFactory4 = (SimpleIndexFactory)context.getBean("target-fsDirectory4");
        assertNotNull(indexFactory4);
        assertNotNull(indexFactory4.getDirectory());
        assertSame(directory4, indexFactory4.getDirectory());
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

            }

            File cachedir = null;
            if(dir instanceof FSDirectory)
            {
              FSDirectory d=(FSDirectory)dir;
              cachedir=new File(d.getDirectory(), "cacheField");
            }else{
              cachedir=new File(f, "cacheField");
            }
           
           
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

      }

      private void initSourceReader() {
        if (sourceLocation != null) {
          try {
            FSDirectory luceneIndexDir = FSDirectory.open(new File(sourceLocation));
            this.reader = IndexReader.open(luceneIndexDir);
          } catch (IOException e) {
            throw new RuntimeException(e);
          }
        }
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

          // make sure that all index files have been read or are kept open
          // so that if an index update removes them we'll still have them
          String filename=IndexFileNames.segmentFileName(segment, IndexFileNames.FREQ_EXTENSION);
          if(cfsDir instanceof FSDirectory)
          {
            FSDirectory dddir=(FSDirectory)cfsDir;
            freqStream = new BlockBufferInput.KeyInput(cfsDir.openInput(filename, readBufferSize), cfsDir,filename,cfsDir.getP());
            if (fieldInfos.hasProx()) {
          String fname=IndexFileNames.segmentFileName(segment, IndexFileNames.PROX_EXTENSION);
              proxStream = BlockBufferInput.MaybeInstance(cfsDir.openInput(fname, readBufferSize), cfsDir,fname,cfsDir.getP());
            } else {
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

            m1.d.deleteFile(s);
          }
        }
        if(m1.d instanceof FSDirectory)
        {
          FSDirectory fd=(FSDirectory)m1.d;
                FileUtils.forceDelete(fd.getDirectory());
        }
       
        if(m1.d instanceof FileSystemDirectory)
        {
          FileSystemDirectory fd=(FileSystemDirectory)m1.d;
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

            m1.d.deleteFile(s);
          }
        }
        if(m1.d instanceof FSDirectory)
        {
          FSDirectory fd=(FSDirectory)m1.d;
                FileUtils.forceDelete(fd.getDirectory());
        }
       
        if(m1.d instanceof FileSystemDirectory)
        {
          FileSystemDirectory fd=(FileSystemDirectory)m1.d;
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

            if (s1.trim().length() > 0) {
              File f = new File(s1);
              if (!f.exists()) {
                continue;
              }
              FSDirectory d = LinkFSDirectory.open(f,true);
              DirectoryInfo info = new DirectoryInfo();
              info.d = d;
              info.tp = DirectoryInfo.DirTpe.file;
              this.diskDirector.put(s1, info);
              SolrCore.log.info(">>>>> add links "+ s1);
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

                File f=new File(s1);
                if(!f.exists())
                {
                  continue;
                }
                FSDirectory d=LinkFSDirectory.open(f);
                DirectoryInfo info=new DirectoryInfo();
                info.d=d;
                info.tp=DirectoryInfo.DirTpe.file;
                diskDirector.put(s1, info);
                SolrCore.log.info(">>>>>LinkFSDirectory readOnlyOpen add links "+s1);
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

            if (s1.trim().length() > 0) {
              File f = new File(s1);
              if (!f.exists()) {
                continue;
              }
              FSDirectory d = LinkFSDirectory.open(f,true);
              DirectoryInfo info = new DirectoryInfo();
              info.d = d;
              info.tp = DirectoryInfo.DirTpe.file;
              this.diskDirector.put(s1, info);
              SolrCore.log.info(">>>>> add links "+ s1);
    View Full Code Here

    Examples of org.apache.lucene.store.FSDirectory

                File f=new File(s1);
                if(!f.exists())
                {
                  continue;
                }
                FSDirectory d=LinkFSDirectory.open(f);
                DirectoryInfo info=new DirectoryInfo();
                info.d=d;
                info.tp=DirectoryInfo.DirTpe.file;
                diskDirector.put(s1, info);
                SolrCore.log.info(">>>>>LinkFSDirectory readOnlyOpen add links "+s1);
    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.