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