1
22
23 package com.liferay.portal.search.lucene;
24
25 import com.liferay.portal.kernel.log.Log;
26 import com.liferay.portal.kernel.log.LogFactoryUtil;
27
28 import java.io.IOException;
29
30 import org.apache.lucene.analysis.Analyzer;
31 import org.apache.lucene.document.Document;
32 import org.apache.lucene.index.IndexReader;
33 import org.apache.lucene.index.IndexWriter;
34 import org.apache.lucene.index.Term;
35 import org.apache.lucene.store.Directory;
36
37
42 public class ReadOnlyIndexWriter extends IndexWriter {
43
44 public ReadOnlyIndexWriter(
45 Directory luceneDir, Analyzer analyzer, boolean create)
46 throws IOException {
47
48 super(luceneDir, analyzer, create);
49 }
50
51 public void addDocument(Document document) {
52 if (_log.isDebugEnabled()) {
53 _log.debug("Ignoring invocation to addDocument");
54 }
55 }
56
57 public void addDocument(Document document, Analyzer analyzer) {
58 if (_log.isDebugEnabled()) {
59 _log.debug("Ignoring invocation to addDocument");
60 }
61 }
62
63 public synchronized void addIndexes(Directory[] directories) {
64 if (_log.isDebugEnabled()) {
65 _log.debug("Ignoring invocation to addIndexes");
66 }
67 }
68
69 public synchronized void addIndexes(IndexReader[] indexReaders) {
70 if (_log.isDebugEnabled()) {
71 _log.debug("Ignoring invocation to addIndexes");
72 }
73 }
74
75 public synchronized void addIndexesNoOptimize(Directory[] directories) {
76 if (_log.isDebugEnabled()) {
77 _log.debug("Ignoring invocation to addIndexesNoOptimize");
78 }
79 }
80
81 public synchronized void deleteDocuments(Term term) {
82 if (_log.isDebugEnabled()) {
83 _log.debug("Ignoring invocation to deleteDocuments");
84 }
85 }
86
87 public synchronized void deleteDocuments(Term[] terms) {
88 if (_log.isDebugEnabled()) {
89 _log.debug("Ignoring invocation to deleteDocuments");
90 }
91 }
92
93 public void updateDocument(Term term, Document document) {
94 if (_log.isDebugEnabled()) {
95 _log.debug("Ignoring invocation to updateDocument");
96 }
97 }
98
99 public void updateDocument(
100 Term term, Document document, Analyzer analyzer) {
101
102 if (_log.isDebugEnabled()) {
103 _log.debug("Ignoring invocation to updateDocument");
104 }
105 }
106
107 public synchronized void optimize() {
108 if (_log.isDebugEnabled()) {
109 _log.debug("Ignoring invocation to optimize");
110 }
111 }
112
113 private static Log _log = LogFactoryUtil.getLog(ReadOnlyIndexWriter.class);
114
115 }