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.Locale;
029    
030    import javax.portlet.PortletRequest;
031    import javax.portlet.PortletResponse;
032    
033    /**
034     * @author Brian Wing Shun Chan
035     */
036    public class DummyIndexer implements Indexer {
037    
038            @Override
039            public void delete(long companyId, String uid) {
040            }
041    
042            @Override
043            public void delete(Object obj) {
044            }
045    
046            @Override
047            public String getClassName() {
048                    return StringPool.BLANK;
049            }
050    
051            /**
052             * @deprecated As of 7.0.0, replaced by {@link #getSearchClassNames}
053             */
054            @Deprecated
055            @Override
056            public String[] getClassNames() {
057                    return new String[0];
058            }
059    
060            @Override
061            public Document getDocument(Object obj) {
062                    return null;
063            }
064    
065            @Override
066            public BooleanFilter getFacetBooleanFilter(
067                    String className, SearchContext searchContext) {
068    
069                    return null;
070            }
071    
072            @Override
073            public BooleanQuery getFullQuery(SearchContext searchContext) {
074                    return null;
075            }
076    
077            @Override
078            public IndexerPostProcessor[] getIndexerPostProcessors() {
079                    return new IndexerPostProcessor[0];
080            }
081    
082            /**
083             * @deprecated As of 7.0.0, replaced by {@link #getClassName}
084             */
085            @Deprecated
086            @Override
087            public String getPortletId() {
088                    return StringPool.BLANK;
089            }
090    
091            @Override
092            public String[] getSearchClassNames() {
093                    return new String[0];
094            }
095    
096            @Override
097            public String getSearchEngineId() {
098                    return StringPool.BLANK;
099            }
100    
101            @Override
102            public String getSortField(String orderByCol) {
103                    return StringPool.BLANK;
104            }
105    
106            @Override
107            public String getSortField(String orderByCol, int sortType) {
108                    return StringPool.BLANK;
109            }
110    
111            /**
112             * @deprecated As of 7.0.0, replaced by {@link #getSummary(Document, String,
113             *             PortletRequest, PortletResponse)}
114             */
115            @Deprecated
116            @Override
117            public Summary getSummary(
118                    Document document, Locale locale, String snippet) {
119    
120                    return null;
121            }
122    
123            @Override
124            public Summary getSummary(
125                    Document document, String snippet, PortletRequest portletRequest,
126                    PortletResponse portletResponse) {
127    
128                    return null;
129            }
130    
131            @Override
132            public boolean hasPermission(
133                    PermissionChecker permissionChecker, String entryClassName,
134                    long entryClassPK, String actionId) {
135    
136                    return false;
137            }
138    
139            @Override
140            public boolean isCommitImmediately() {
141                    return false;
142            }
143    
144            @Override
145            public boolean isFilterSearch() {
146                    return false;
147            }
148    
149            @Override
150            public boolean isPermissionAware() {
151                    return false;
152            }
153    
154            @Override
155            public boolean isStagingAware() {
156                    return false;
157            }
158    
159            @Override
160            public boolean isVisible(long classPK, int status) throws Exception {
161                    return true;
162            }
163    
164            @Override
165            public boolean isVisibleRelatedEntry(long classPK, int status)
166                    throws Exception {
167    
168                    return true;
169            }
170    
171            @Override
172            public void postProcessContextBooleanFilter(
173                            BooleanFilter contextBooleanFilter, SearchContext searchContext)
174                    throws Exception {
175            }
176    
177            /**
178             * @deprecated As of 7.0.0, replaced by {@link #postProcessContextBooleanFilter(
179             *             BooleanFilter, SearchContext)}
180             */
181            @Deprecated
182            @Override
183            public void postProcessContextQuery(
184                    BooleanQuery contextQuery, SearchContext searchContext) {
185            }
186    
187            @Override
188            public void postProcessSearchQuery(
189                    BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
190                    SearchContext searchContext) {
191            }
192    
193            /**
194             * @deprecated As of 7.0.0, replaced by {@link #postProcessSearchQuery(
195             *             BooleanQuery, BooleanFilter, SearchContext)}
196             */
197            @Deprecated
198            @Override
199            public void postProcessSearchQuery(
200                    BooleanQuery searchQuery, SearchContext searchContext) {
201    
202                    throw new UnsupportedOperationException();
203            }
204    
205            @Override
206            public void registerIndexerPostProcessor(
207                    IndexerPostProcessor indexerPostProcessor) {
208            }
209    
210            @Override
211            public void reindex(Object obj) {
212            }
213    
214            @Override
215            public void reindex(String className, long classPK) {
216            }
217    
218            @Override
219            public void reindex(String[] ids) {
220            }
221    
222            @Override
223            public Hits search(SearchContext searchContext) {
224                    return null;
225            }
226    
227            @Override
228            public Hits search(
229                    SearchContext searchContext, String... selectedFieldNames) {
230    
231                    return null;
232            }
233    
234            @Override
235            public long searchCount(SearchContext searchContext) {
236                    return 0;
237            }
238    
239            @Override
240            public void unregisterIndexerPostProcessor(
241                    IndexerPostProcessor indexerPostProcessor) {
242            }
243    
244    }