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.lucene.engine.manager;
18:
19: import java.io.IOException;
20:
21: import org.apache.lucene.analysis.Analyzer;
22: import org.apache.lucene.index.IndexDeletionPolicy;
23: import org.apache.lucene.index.IndexWriter;
24: import org.apache.lucene.search.IndexSearcher;
25: import org.apache.lucene.store.Directory;
26: import org.compass.core.config.CompassSettings;
27: import org.compass.core.engine.SearchEngineException;
28: import org.compass.core.engine.SearchEngineIndexManager;
29: import org.compass.core.executor.ExecutorManager;
30: import org.compass.core.lucene.engine.LuceneSettings;
31: import org.compass.core.lucene.engine.store.LuceneSearchEngineStore;
32: import org.compass.core.transaction.context.TransactionContext;
33:
34: /**
35: * Specialized Lucene index manager extension.
36: *
37: * @author kimchy
38: */
39: public interface LuceneSearchEngineIndexManager extends
40: SearchEngineIndexManager {
41:
42: LuceneSettings getSettings();
43:
44: LuceneSearchEngineStore getStore();
45:
46: IndexWriter openIndexWriter(CompassSettings settings,
47: String subIndex) throws IOException;
48:
49: IndexWriter openIndexWriter(CompassSettings settings,
50: String subIndex, boolean autoCommit) throws IOException;
51:
52: IndexWriter openIndexWriter(CompassSettings settings,
53: Directory dir, boolean create) throws IOException;
54:
55: IndexWriter openIndexWriter(CompassSettings settings,
56: Directory dir, IndexDeletionPolicy deletionPolicy)
57: throws IOException;
58:
59: IndexWriter openIndexWriter(CompassSettings settings,
60: Directory dir, boolean autoCommit, boolean create)
61: throws IOException;
62:
63: IndexWriter openIndexWriter(CompassSettings settings,
64: Directory dir, boolean autoCommit, boolean create,
65: IndexDeletionPolicy deletionPolicy) throws IOException;
66:
67: IndexWriter openIndexWriter(CompassSettings settings,
68: Directory dir, boolean autoCommit, boolean create,
69: IndexDeletionPolicy deletionPolicy, Analyzer analyzer)
70: throws IOException;
71:
72: LuceneIndexHolder openIndexHolderBySubIndex(String subIndex)
73: throws SearchEngineException;
74:
75: void refreshCache(String subIndex, IndexSearcher indexSearcher)
76: throws SearchEngineException;
77:
78: /**
79: * Since there might be several instances of Compass running against the same index, they
80: * need to be globally notified to invalidate the cache after the commit lock has been
81: * obtained for the second step on the {@link #operate(org.compass.core.engine.SearchEngineIndexManager.IndexOperationCallback)}
82: * or {@link #replaceIndex(org.compass.core.engine.SearchEngineIndexManager, org.compass.core.engine.SearchEngineIndexManager.ReplaceIndexCallback)}.
83: *
84: * <p>If directly set to 0, will not wait.
85: *
86: * @param timeToWaitInMillis
87: */
88: void setWaitForCacheInvalidationBeforeSecondStep(
89: long timeToWaitInMillis);
90:
91: ExecutorManager getExecutorManager();
92:
93: TransactionContext getTransactionContext();
94: }
|