001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.search.dummy;
016    
017    import com.liferay.portal.kernel.search.BooleanQuery;
018    import com.liferay.portal.kernel.search.Document;
019    import com.liferay.portal.kernel.search.Hits;
020    import com.liferay.portal.kernel.search.Indexer;
021    import com.liferay.portal.kernel.search.IndexerPostProcessor;
022    import com.liferay.portal.kernel.search.SearchContext;
023    import com.liferay.portal.kernel.search.Summary;
024    import com.liferay.portal.kernel.search.filter.BooleanFilter;
025    import com.liferay.portal.kernel.util.StringPool;
026    import com.liferay.portal.security.permission.PermissionChecker;
027    
028    import java.util.Collection;
029    import java.util.Locale;
030    
031    import javax.portlet.PortletRequest;
032    import javax.portlet.PortletResponse;
033    
034    /**
035     * @author Brian Wing Shun Chan
036     */
037    public class DummyIndexer implements Indexer<Object> {
038    
039            @Override
040            public void delete(long companyId, String uid) {
041            }
042    
043            @Override
044            public void delete(Object object) {
045            }
046    
047            @Override
048            public String getClassName() {
049                    return StringPool.BLANK;
050            }
051    
052            /**
053             * @deprecated As of 7.0.0, replaced by {@link #getSearchClassNames}
054             */
055            @Deprecated
056            @Override
057            public String[] getClassNames() {
058                    return new String[0];
059            }
060    
061            @Override
062            public Document getDocument(Object object) {
063                    return null;
064            }
065    
066            @Override
067            public BooleanFilter getFacetBooleanFilter(
068                    String className, SearchContext searchContext) {
069    
070                    return null;
071            }
072    
073            @Override
074            public BooleanQuery getFullQuery(SearchContext searchContext) {
075                    return null;
076            }
077    
078            @Override
079            public IndexerPostProcessor[] getIndexerPostProcessors() {
080                    return new IndexerPostProcessor[0];
081            }
082    
083            /**
084             * @deprecated As of 7.0.0, replaced by {@link #getClassName}
085             */
086            @Deprecated
087            @Override
088            public String getPortletId() {
089                    return StringPool.BLANK;
090            }
091    
092            @Override
093            public String[] getSearchClassNames() {
094                    return new String[0];
095            }
096    
097            @Override
098            public String getSearchEngineId() {
099                    return StringPool.BLANK;
100            }
101    
102            @Override
103            public String getSortField(String orderByCol) {
104                    return StringPool.BLANK;
105            }
106    
107            @Override
108            public String getSortField(String orderByCol, int sortType) {
109                    return StringPool.BLANK;
110            }
111    
112            /**
113             * @deprecated As of 7.0.0, replaced by {@link #getSummary(Document, String,
114             *             PortletRequest, PortletResponse)}
115             */
116            @Deprecated
117            @Override
118            public Summary getSummary(
119                    Document document, Locale locale, String snippet) {
120    
121                    return null;
122            }
123    
124            @Override
125            public Summary getSummary(
126                    Document document, String snippet, PortletRequest portletRequest,
127                    PortletResponse portletResponse) {
128    
129                    return null;
130            }
131    
132            @Override
133            public boolean hasPermission(
134                    PermissionChecker permissionChecker, String entryClassName,
135                    long entryClassPK, String actionId) {
136    
137                    return false;
138            }
139    
140            @Override
141            public boolean isCommitImmediately() {
142                    return false;
143            }
144    
145            @Override
146            public boolean isFilterSearch() {
147                    return false;
148            }
149    
150            @Override
151            public boolean isIndexerEnabled() {
152                    return false;
153            }
154    
155            @Override
156            public boolean isPermissionAware() {
157                    return false;
158            }
159    
160            @Override
161            public boolean isStagingAware() {
162                    return false;
163            }
164    
165            @Override
166            public boolean isVisible(long classPK, int status) throws Exception {
167                    return true;
168            }
169    
170            @Override
171            public boolean isVisibleRelatedEntry(long classPK, int status)
172                    throws Exception {
173    
174                    return true;
175            }
176    
177            @Override
178            public void postProcessContextBooleanFilter(
179                            BooleanFilter contextBooleanFilter, SearchContext searchContext)
180                    throws Exception {
181            }
182    
183            /**
184             * @deprecated As of 7.0.0, replaced by {@link
185             *             #postProcessContextBooleanFilter(BooleanFilter,
186             *             SearchContext)}
187             */
188            @Deprecated
189            @Override
190            public void postProcessContextQuery(
191                    BooleanQuery contextQuery, SearchContext searchContext) {
192            }
193    
194            @Override
195            public void postProcessSearchQuery(
196                    BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
197                    SearchContext searchContext) {
198            }
199    
200            /**
201             * @deprecated As of 7.0.0, replaced by {@link
202             *             #postProcessSearchQuery(BooleanQuery, BooleanFilter,
203             *             SearchContext)}
204             */
205            @Deprecated
206            @Override
207            public void postProcessSearchQuery(
208                    BooleanQuery searchQuery, SearchContext searchContext) {
209    
210                    throw new UnsupportedOperationException();
211            }
212    
213            @Override
214            public void registerIndexerPostProcessor(
215                    IndexerPostProcessor indexerPostProcessor) {
216            }
217    
218            @Override
219            public void reindex(Collection<Object> objects) {
220            }
221    
222            @Override
223            public void reindex(Object obj) {
224            }
225    
226            @Override
227            public void reindex(String className, long classPK) {
228            }
229    
230            @Override
231            public void reindex(String[] ids) {
232            }
233    
234            @Override
235            public Hits search(SearchContext searchContext) {
236                    return null;
237            }
238    
239            @Override
240            public Hits search(
241                    SearchContext searchContext, String... selectedFieldNames) {
242    
243                    return null;
244            }
245    
246            @Override
247            public long searchCount(SearchContext searchContext) {
248                    return 0;
249            }
250    
251            @Override
252            public void setIndexerEnabled(boolean indexerEnabled) {
253            }
254    
255            @Override
256            public void unregisterIndexerPostProcessor(
257                    IndexerPostProcessor indexerPostProcessor) {
258            }
259    
260    }