view src/goodjava/lucene/logging/OpDoer.java @ 1549:41c32da4cbd1

lucene log work
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 03 Oct 2020 20:55:26 -0600
parents src/goodjava/lucene/logging/FilterGoodWriter.java@736ec76bbf42
children 9cc4cee39b8b
line wrap: on
line source

package goodjava.lucene.logging;

import java.io.IOException;
import java.util.Map;
import org.apache.lucene.search.Query;
import org.apache.lucene.index.IndexReader;
import goodjava.lucene.api.GoodIndexWriter;


public class OpDoer {
	protected final GoodIndexWriter writer;
	protected boolean isActive = true;

	protected OpDoer(GoodIndexWriter writer) {
		this.writer = writer;
	}

	public IndexReader openReader() throws IOException {
		return writer.openReader();
	}

	public void commit() throws IOException {
		if( !isActive )
			return;
		writer.commit();
	}

	public void deleteAll(long time) throws IOException {
		if( !isActive )
			return;
		writer.deleteAll();
	}

	public void deleteDocuments(long time,Query query) throws IOException {
		if( !isActive )
			return;
		writer.deleteDocuments(query);
	}

	public void addDocument(long time,Map<String,Object> storedFields) throws IOException {
		if( !isActive )
			return;
		writer.addDocument(storedFields);
	}

	public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException {
		if( !isActive )
			return;
		writer.updateDocument(keyFieldName,storedFields);
	}

	public void tag(long time,String tag) throws IOException {}

}