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.messaging.proxy.BaseMultiDestinationProxyBean;
018    import com.liferay.portal.kernel.messaging.proxy.ProxyRequest;
019    import com.liferay.portal.kernel.search.suggest.Suggester;
020    import com.liferay.portal.kernel.search.suggest.SuggesterResults;
021    
022    import java.util.List;
023    import java.util.Map;
024    
025    /**
026     * @author Bruno Farache
027     * @author Tina Tian
028     * @author Raymond Aug??
029     */
030    public class IndexSearcherProxyBean
031            extends BaseMultiDestinationProxyBean implements IndexSearcher {
032    
033            @Override
034            public String getDestinationName(ProxyRequest proxyRequest) {
035                    Object[] arguments = proxyRequest.getArguments();
036    
037                    String searchEngineId = null;
038    
039                    if (arguments[0] instanceof SearchContext) {
040                            SearchContext searchContext = (SearchContext)arguments[0];
041    
042                            searchEngineId = searchContext.getSearchEngineId();
043                    }
044                    else {
045                            searchEngineId = (String)arguments[0];
046                    }
047    
048                    return SearchEngineHelperUtil.getSearchReaderDestinationName(
049                            searchEngineId);
050            }
051    
052            @Override
053            public String getQueryString(SearchContext searchContext, Query query) {
054                    throw new UnsupportedOperationException();
055            }
056    
057            @Override
058            public Hits search(SearchContext searchContext, Query query) {
059                    throw new UnsupportedOperationException();
060            }
061    
062            /**
063             * @deprecated As of 7.0.0, replaced by {@link #search(SearchContext,
064             *             Query)}
065             */
066            @Deprecated
067            @Override
068            public Hits search(
069                    String searchEngineId, long companyId, Query query, Sort[] sort,
070                    int start, int end) {
071    
072                    throw new UnsupportedOperationException();
073            }
074    
075            @Override
076            public long searchCount(SearchContext searchContext, Query query) {
077                    throw new UnsupportedOperationException();
078            }
079    
080            @Override
081            public String spellCheckKeywords(SearchContext searchContext) {
082                    throw new UnsupportedOperationException();
083            }
084    
085            @Override
086            public Map<String, List<String>> spellCheckKeywords(
087                    SearchContext searchContext, int max) {
088    
089                    throw new UnsupportedOperationException();
090            }
091    
092            @Override
093            public SuggesterResults suggest(
094                    SearchContext searchContext, Suggester suggester) {
095    
096                    throw new UnsupportedOperationException();
097            }
098    
099            @Override
100            public String[] suggestKeywordQueries(
101                    SearchContext searchContext, int max) {
102    
103                    throw new UnsupportedOperationException();
104            }
105    
106    }