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;
016    
017    import com.liferay.portal.kernel.util.ArrayUtil;
018    
019    import java.util.Locale;
020    
021    import javax.portlet.PortletRequest;
022    import javax.portlet.PortletResponse;
023    import javax.portlet.PortletURL;
024    
025    /**
026     * @author Eudaldo Alonso
027     * @author L??szl?? Csontos
028     */
029    public abstract class BaseSearcher extends BaseIndexer {
030    
031            @Override
032            public IndexerPostProcessor[] getIndexerPostProcessors() {
033                    throw new UnsupportedOperationException();
034            }
035    
036            @Override
037            public String getPortletId() {
038                    return null;
039            }
040    
041            @Override
042            public void postProcessSearchQuery(
043                            BooleanQuery searchQuery, SearchContext searchContext)
044                    throws Exception {
045    
046                    String[] classNames = getClassNames();
047    
048                    if (ArrayUtil.isEmpty(classNames)) {
049                            return;
050                    }
051    
052                    for (String className : classNames) {
053                            Indexer indexer = IndexerRegistryUtil.getIndexer(className);
054    
055                            if (indexer == null) {
056                                    continue;
057                            }
058    
059                            indexer.postProcessSearchQuery(searchQuery, searchContext);
060                    }
061            }
062    
063            @Override
064            public void registerIndexerPostProcessor(
065                    IndexerPostProcessor indexerPostProcessor) {
066    
067                    throw new UnsupportedOperationException();
068            }
069    
070            @Override
071            protected void doDelete(Object obj) throws Exception {
072                    throw new UnsupportedOperationException();
073            }
074    
075            @Override
076            protected Document doGetDocument(Object obj) throws Exception {
077                    throw new UnsupportedOperationException();
078            }
079    
080            @Override
081            protected Summary doGetSummary(
082                            Document document, Locale locale, String snippet,
083                            PortletURL portletURL, PortletRequest portletRequest,
084                            PortletResponse portletResponse)
085                    throws Exception {
086    
087                    throw new UnsupportedOperationException();
088            }
089    
090            @Override
091            protected void doReindex(Object obj) throws Exception {
092                    throw new UnsupportedOperationException();
093            }
094    
095            @Override
096            protected void doReindex(String className, long classPK) throws Exception {
097                    throw new UnsupportedOperationException();
098            }
099    
100            @Override
101            protected void doReindex(String[] ids) throws Exception {
102                    throw new UnsupportedOperationException();
103            }
104    
105            @Override
106            protected String getPortletId(SearchContext searchContext) {
107                    return null;
108            }
109    
110    }