Examples of IndexWriter


Examples of org.apache.archiva.webdav.util.IndexWriter

                IOUtils.closeQuietly( is );
            }
        }
        else if ( outputContext.hasStream() )
        {
            IndexWriter writer = new IndexWriter( this, localResource, logicalResource );
            writer.write( outputContext );
        }
    }
View Full Code Here

Examples of org.apache.continuum.webdav.util.IndexWriter

                IOUtils.closeQuietly( is );
            }
        }
        else if ( outputContext.hasStream() )
        {
            IndexWriter writer = new IndexWriter( this, getLocalResource(), getLogicalResource() );
            writer.write( outputContext );
        }
    }
View Full Code Here

Examples of org.apache.hbase.index.write.IndexWriter

        log = env.getRegionServerServices().getWAL();
        // add a synchronizer so we don't archive a WAL that we need
        log.registerWALActionsListener(new IndexLogRollSynchronizer(INDEX_READ_WRITE_LOCK.writeLock()));
   
        // setup the actual index writer
        this.writer = new IndexWriter(env, serverName + "-index-writer");
   
        // setup the recovery writer that does retries on the failed edits
        TrackingParallelWriterIndexCommitter recoveryCommmiter =
            new TrackingParallelWriterIndexCommitter();
   
        try {
          // get the specified failure policy. We only ever override it in tests, but we need to do it
          // here
          Class<? extends IndexFailurePolicy> policyClass =
              env.getConfiguration().getClass(INDEX_RECOVERY_FAILURE_POLICY_KEY,
                StoreFailuresInCachePolicy.class, IndexFailurePolicy.class);
          IndexFailurePolicy policy =
              policyClass.getConstructor(PerRegionIndexWriteCache.class).newInstance(failedIndexEdits);
          LOG.debug("Setting up recovery writter with committer: " + recoveryCommmiter.getClass()
              + " and failure policy: " + policy.getClass());
          recoveryWriter =
              new IndexWriter(recoveryCommmiter, policy, env, serverName + "-recovery-writer");
        } catch (Exception ex) {
          throw new IOException("Could not instantiate recovery failure policy!", ex);
        }
      } catch (NoSuchMethodError ex) {
          disabled = true;
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter

    Document doc = new Document();
    doc.add(new Field("id", "1", Field.Store.YES, Field.Index.UN_TOKENIZED));
    doc.add(new Field("author", "����IBM OSIһһ����", Field.Store.YES, Field.Index.TOKENIZED));
    doc.add(new Field("time", Long.toString(System.currentTimeMillis()), Field.Store.YES, Field.Index.UN_TOKENIZED));
    doc.add(new Field("content", "��֪����ʲôʱ��ʼ����ʲô�������涼�и����ڣ��ﵶ�����ڣ����ͷ����ڣ�������ֽ������ڣ��ҿ�ʼ���ɣ�����������ϣ�����ʲô�����Dz�����ڵģ�", Field.Store.NO, Field.Index.TOKENIZED));
    IndexWriter writer = getWriter();
    try {
        writer.addDocument(doc);
        writer.optimize();
    }finally {
        writer.close();
    }
    System.out.println("doc count = " + writer.docCount());
        return 1;
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter

      }
      wc++;
        }
        File segments = new File(lucenePath + File.separator + SEGMENTS);
        boolean bCreate = !segments.exists();
        return new IndexWriter(lucenePath,new StandardAnalyzer(),bCreate);
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter

    for(int i=0;indexFields!=null && i<indexFields.length;i++){
      String propertyValue = getField(doc, indexFields[i]);
      lucene_doc.add(UnStored(indexFields[i], propertyValue));
    }
    //Write document
    IndexWriter writer = getWriter(doc.name());
    try {
        writer.addDocument(lucene_doc);
        writer.optimize();
    }finally {
      try{
        writer.close();
      }catch(Exception e){
        log.error("Error occur when closing IndexWriter", e);
      }finally{
        writer = null;
      }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter

        path.append(File.separator);
        path.append(SEGMENTS);
        File segments = new File(path.toString());
        try{
          boolean bCreate = !segments.exists();
          return new IndexWriter(index_path,new StandardAnalyzer(),bCreate);
        }finally{
          path = null;
          segments = null;
          rp = null;
        }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter

    try {
      indexName = indexFile.getCanonicalPath();
      directory = FSDirectory.getDirectory(indexName);
      if (create) {
        log.debug("Initialize index: '" + indexFile + "'");
        IndexWriter iw = new IndexWriter(directory,
            new StandardAnalyzer(), create);
        iw.close();
      }
    } catch (IOException e) {
      throw new HibernateException("Unable to initialize index: "
          + indexFile, e);
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter

                    //## LUCENE3 begin ##
                    File f = new File(path);
                    Directory indexDir = FSDirectory.open(f);
                    boolean recreate = !IndexReader.indexExists(indexDir);
                    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
                    IndexWriter writer = new IndexWriter(indexDir, analyzer,
                            recreate, IndexWriter.MaxFieldLength.UNLIMITED);
                    //see http://wiki.apache.org/lucene-java/NearRealtimeSearch
                    IndexReader reader = writer.getReader();
                    access = new IndexAccess();
                    access.writer = writer;
                    access.reader = reader;
                    access.searcher = new IndexSearcher(reader);
                    //## LUCENE3 end ##
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter

                String       botname = resultSet.getString("botname").toLowerCase();
                String       channel = resultSet.getString("channel").substring(1).toLowerCase();
                String       key = getIndexName(botname, servername, channel);
                Document     doc = new Document();
                Timestamp     moment = resultSet.getTimestamp("moment");
                IndexWriter   writer = (IndexWriter)index_writer_cache.get(key);

                if (writer == null)
                {
                  writer = getIndexWriter(key, true);

                  index_writer_cache.put(key, writer);
                }

                beginningOfDay.setTime(moment);
                beginningOfDay.setTimeZone(TimeZone.getTimeZone(DroneConfig.getTimezone()));
                beginningOfDay.set(Calendar.HOUR, 0);
                beginningOfDay.set(Calendar.MINUTE, 0);
                beginningOfDay.set(Calendar.SECOND, 0);
                beginningOfDay.set(Calendar.MILLISECOND, 0);

                long dayInMillis = beginningOfDay.getTimeInMillis();
                long timeInMillis = moment.getTime() - dayInMillis;

                // need to store channel without the '#'
                doc.add(new Field("moment", DateField.dateToString(resultSet.getTimestamp("moment")), true, true, true));
                doc.add(new Field("momentDateSort", String.valueOf(dayInMillis), false, true, false));
                doc.add(new Field("momentTimeSort", String.valueOf(timeInMillis), false, true, false));
                doc.add(new Field("botname", botname, true, true, true));
                doc.add(new Field("channel", channel, true, true, true));
                doc.add(new Field("servername", servername, true, true, true));
                doc.add(new Field("nickname", resultSet.getString("nickname"), true, true, true));
                doc.add(new Field("username", resultSet.getString("username"), true, true, true));
                doc.add(new Field("hostname", resultSet.getString("hostname"), true, true, true));
                doc.add(new Field("message", resultSet.getString("message"), true, true, true));

                try
                {
                  writer.addDocument(doc, getAnalyzer());
                }
                catch (IOException e)
                {
                  Logger
                    .getLogger("com.uwyn.drone.tools")
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.