1
22
23 package com.liferay.portal.lucene;
24
25 import java.io.IOException;
26
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29 import org.apache.lucene.analysis.Analyzer;
30 import org.apache.lucene.document.Document;
31 import org.apache.lucene.index.CorruptIndexException;
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 throws CorruptIndexException, IOException {
53
54 if (_log.isDebugEnabled()) {
55 _log.debug("Ignoring invocation to addDocument");
56 }
57 }
58
59 public void addDocument(Document document, Analyzer analyzer)
60 throws CorruptIndexException, IOException {
61
62 if (_log.isDebugEnabled()) {
63 _log.debug("Ignoring invocation to addDocument");
64 }
65 }
66
67 public synchronized void addIndexes(Directory[] directories)
68 throws CorruptIndexException, IOException {
69
70 if (_log.isDebugEnabled()) {
71 _log.debug("Ignoring invocation to addIndexes");
72 }
73 }
74
75 public synchronized void addIndexes(IndexReader[] indexReaders)
76 throws CorruptIndexException, IOException {
77
78 if (_log.isDebugEnabled()) {
79 _log.debug("Ignoring invocation to addIndexes");
80 }
81 }
82
83 public synchronized void addIndexesNoOptimize(Directory[] directories)
84 throws CorruptIndexException, IOException {
85
86 if (_log.isDebugEnabled()) {
87 _log.debug("Ignoring invocation to addIndexesNoOptimize");
88 }
89 }
90
91 public synchronized void deleteDocuments(Term term)
92 throws CorruptIndexException, IOException {
93
94 if (_log.isDebugEnabled()) {
95 _log.debug("Ignoring invocation to deleteDocuments");
96 }
97 }
98
99 public synchronized void deleteDocuments(Term[] terms)
100 throws CorruptIndexException, IOException {
101
102 if (_log.isDebugEnabled()) {
103 _log.debug("Ignoring invocation to deleteDocuments");
104 }
105 }
106
107 public void updateDocument(Term term, Document document)
108 throws CorruptIndexException, IOException {
109
110 if (_log.isDebugEnabled()) {
111 _log.debug("Ignoring invocation to updateDocument");
112 }
113 }
114
115 public void updateDocument(Term term, Document document, Analyzer analyzer)
116 throws CorruptIndexException, IOException {
117
118 if (_log.isDebugEnabled()) {
119 _log.debug("Ignoring invocation to updateDocument");
120 }
121 }
122
123 public synchronized void optimize()
124 throws CorruptIndexException, IOException {
125
126 if (_log.isDebugEnabled()) {
127 _log.debug("Ignoring invocation to optimize");
128 }
129 }
130
131 private static Log _log = LogFactory.getLog(ReadOnlyIndexWriter.class);
132
133 }