Example #1
0
  public ZoieSystem(
      File idxDir,
      IndexableInterpreter<V> interpreter,
      IndexReaderDecorator<R> indexReaderDecorator,
      Analyzer analyzer,
      Similarity similarity,
      int batchSize,
      long batchDelay,
      boolean rtIndexing) {
    if (idxDir == null) throw new IllegalArgumentException("null idxDir");
    _idxDir = idxDir;

    _searchIdxMgr = new SearchIndexManager<R>(_idxDir, indexReaderDecorator);
    _realtimeIndexing = rtIndexing;
    _interpreter = interpreter;

    _analyzer = analyzer == null ? new StandardAnalyzer() : analyzer;
    _similarity = similarity == null ? new DefaultSimilarity() : similarity;

    // build event call back for batch

    _diskLoader = new DiskLuceneIndexDataLoader<R>(_analyzer, _similarity, _searchIdxMgr);

    _diskLoader.setOptimizeScheduler(new DefaultOptimizeScheduler(getAdminMBean()));

    _lsnrList = Collections.synchronizedList(new LinkedList<IndexingEventListener>());

    if (_realtimeIndexing) {
      _ramLoader = new RAMLuceneIndexDataLoader<R>(_analyzer, _similarity, _searchIdxMgr);
      _batchedDiskLoader =
          new CopyingIndexDataLoader<R, ZoieIndexable>(
              _diskLoader, Math.max(1, batchSize), 100000, batchDelay, _searchIdxMgr, _lsnrList);
      // _batchedDiskLoader=new
      // BatchedIndexDataLoader<R,ZoieIndexable>(_diskLoader,Math.max(1,batchSize),100000,batchDelay,_searchIdxMgr,_lsnrList);
    } else {
      _ramLoader = null;
      _batchedDiskLoader =
          new BatchedIndexDataLoader<R, ZoieIndexable>(
              _diskLoader, Math.max(1, batchSize), 100000, batchDelay, _searchIdxMgr, _lsnrList);
    }

    _delegateConsumer =
        new DelegateIndexDataConsumer<V>(_batchedDiskLoader, _ramLoader, _interpreter);
    super.setBatchSize(100); // realtime memory batch size
    super.setDataConsumer(_delegateConsumer);
  }
Example #2
0
 public void setOptimizeScheduler(OptimizeScheduler scheduler) {
   if (scheduler != null) {
     _diskLoader.setOptimizeScheduler(scheduler);
   }
 }
Example #3
0
 public OptimizeScheduler getOptimizeScheduler() {
   return _diskLoader.getOptimizeScheduler();
 }