01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.core.engine;
18:
19: /**
20: * Optimizes search engine index data.
21: * <p/>
22: * Using it, one can controll the lifecycle of the optimizer using the
23: * <code>start()</code> and <code>stop()</code> methods (note that does not
24: * mean that it will start a scheduled optimizer, it depends on the
25: * configuration supplied).
26: * <p/>
27: * You can also check if the search engine required optimization using the
28: * <code>needOptimization()</code> method, and run the optimization process
29: * using the <code>optimize()</code> method.
30: *
31: * @author kimchy
32: */
33: public interface SearchEngineOptimizer {
34:
35: /**
36: * Starts the given optimizer. Will start a scheduled optimizer if
37: * configured.
38: *
39: * @throws SearchEngineException
40: */
41: void start() throws SearchEngineException;
42:
43: /**
44: * Stops the given optimizer. Will stop the scheduled optimizer if
45: * configured.
46: * <p/>
47: * Note that if the optimizer is stopped while optimizing, it might take
48: * some time till the optimizer will actually stop.
49: *
50: * @throws SearchEngineException
51: */
52: void stop() throws SearchEngineException;
53:
54: /**
55: * Returns <code>true</code> if the optimizer is running.
56: *
57: * @return <code>true</code> if the optimizer is running
58: */
59: boolean isRunning();
60:
61: /**
62: * Optimizes the search engine index if it requires optimization.
63: *
64: * @throws SearchEngineException
65: */
66: void optimize() throws SearchEngineException;
67:
68: /**
69: * Optimizes the sub index if it requires optimization.
70: *
71: * @param subIndex The sub index to optimize
72: * @throws SearchEngineException
73: */
74: void optimize(String subIndex) throws SearchEngineException;
75: }
|