Examples of NIOFSDirectory


Examples of org.apache.lucene.store.NIOFSDirectory

  public synchronized void startup() {
    String name = "sb_disk_store";
    try {
      File dir = new File(dataDir + "/" + name);
      NIOFSDirectory directory = new NIOFSDirectory(dir);

      IndexWriter writer;
      IndexWriterConfig writerConfig = new IndexWriterConfig(Version.LUCENE_40, analyzer);
      LogByteSizeMergePolicy mergePolicy = new LogByteSizeMergePolicy();
      mergePolicy.setMaxMergeMB(50.0);
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

        File[] files = { this.input };
        if (this.input.isDirectory()) {
            files = this.input.listFiles();
        }

        final IndexWriter writer = new IndexWriter(new NIOFSDirectory(this.store), Configuration.WRITER_CFG);

        for (final File file : files) {
            if (this.lastModification != null) {
                final Date date = new Date();
                final Long limit = date.getTime() - (86400000 * this.lastModification);
 
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

    @Option(required = true, name = "-q", aliases = { "--query" }, usage = "query")
    private String query;

    public void remove() throws IOException {
        final IndexWriter writer = new IndexWriter(new NIOFSDirectory(this.store), Configuration.WRITER_CFG);

        final QueryParser queryParser = new QueryParser(Configuration.VERSION, "", Configuration.ANALYZER);
        try {
            final Query validQuery = queryParser.parse(this.query);
            writer.deleteDocuments(validQuery);
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

    private IndexSearcher indexSearcher;
    private ScoreDoc[] hits;

    public void open(File indexDirectory, Analyzer analyzer) throws IOException {
        if (indexDirectory != null) {
            indexSearcher = new IndexSearcher(IndexReader.open(new NIOFSDirectory(indexDirectory)));
        } else {
            indexSearcher = new IndexSearcher(IndexReader.open(new NIOFSDirectory(new File("./indexDirectory"))));
        }
        this.analyzer = analyzer;
    }
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

    public LuceneIndexer(File sourceDirectory, File indexDirectory, Analyzer analyzerthrows Exception {
        if (indexDirectory != null) {
            if (!indexDirectory.exists()) {
                indexDirectory.mkdir();
            }  
            this.setNiofsDirectory(new NIOFSDirectory(indexDirectory));
        } else {
            this.setNiofsDirectory(new NIOFSDirectory(new File("./indexDirectory")));
        }
       
        this.setAnalyzer(analyzer);
       
        if ((sourceDirectory != null) && (!sourceDirectoryIndexed)) {
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

    public LuceneIndexer(File sourceDirectory, File indexDirectory, Analyzer analyzerthrows Exception {
        if (indexDirectory != null) {
            if (!indexDirectory.exists()) {
                indexDirectory.mkdir();
            }  
            this.setNiofsDirectory(new NIOFSDirectory(indexDirectory));
        } else {
            this.setNiofsDirectory(new NIOFSDirectory(new File("./indexDirectory")));
        }
       
        this.setAnalyzer(analyzer);
       
        if ((sourceDirectory != null) && (!sourceDirectoryIndexed)) {
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

    String index = CmsPropertyHandler.getContextDiskPath() + File.separator + "lucene" + File.separator + "index";

    index = index.replaceAll("//", "/");
    //System.out.println("index:" + index);
      File INDEX_DIR = new File(index);
    directory = new NIOFSDirectory(INDEX_DIR);
    directory.setLockFactory(new SingleInstanceLockFactory());
    boolean indexExists = IndexReader.indexExists(directory);
    if(!indexExists)
    {
      createIndex(directory);
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

    private static final int            MAX_RESULTS = 5000; // does this need to be configurable?

    public LogSearch(File file) throws Exception
    {
        this.file = file;
        directory = new NIOFSDirectory(file, new NativeFSLockFactory());
        reader = IndexReader.open(directory);
        searcher = new IndexSearcher(reader);
    }
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

            throw new IOException("Could not make: " + directory);
        }

        IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_35, new KeywordAnalyzer()).setOpenMode(IndexWriterConfig.OpenMode.CREATE);

        niofsDirectory = new NIOFSDirectory(directory, new SingleInstanceLockFactory());
        writer = new IndexWriter(niofsDirectory, conf);
    }
View Full Code Here

Examples of org.apache.lucene.store.NIOFSDirectory

    public LuceneIndexer(File sourceDirectory, File indexDirectory, Analyzer analyzerthrows Exception {
        if (indexDirectory != null) {
            if (!indexDirectory.exists()) {
                indexDirectory.mkdir();
            }  
            this.setNiofsDirectory(new NIOFSDirectory(indexDirectory));
        } else {
            this.setNiofsDirectory(new NIOFSDirectory(new File("./indexDirectory")));
        }
       
        this.setAnalyzer(analyzer);
       
        if ((sourceDirectory != null) && (!sourceDirectoryIndexed)) {
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.