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 SearchEngineUtil.getSearchReaderDestinationName(searchEngineId);
049            }
050    
051            @Override
052            public String getQueryString(SearchContext searchContext, Query query) {
053                    throw new UnsupportedOperationException();
054            }
055    
056            @Override
057            public Hits search(SearchContext searchContext, Query query) {
058                    throw new UnsupportedOperationException();
059            }
060    
061            /**
062             * @deprecated As of 7.0.0, replaced by {@link #search(SearchContext,
063             *             Query)}
064             */
065            @Deprecated
066            @Override
067            public Hits search(
068                    String searchEngineId, long companyId, Query query, Sort[] sort,
069                    int start, int end) {
070    
071                    throw new UnsupportedOperationException();
072            }
073    
074            @Override
075            public long searchCount(SearchContext searchContext, Query query) {
076                    throw new UnsupportedOperationException();
077            }
078    
079            @Override
080            public String spellCheckKeywords(SearchContext searchContext) {
081                    throw new UnsupportedOperationException();
082            }
083    
084            @Override
085            public Map<String, List<String>> spellCheckKeywords(
086                    SearchContext searchContext, int max) {
087    
088                    throw new UnsupportedOperationException();
089            }
090    
091            @Override
092            public SuggesterResults suggest(
093                    SearchContext searchContext, Suggester suggester) {
094    
095                    throw new UnsupportedOperationException();
096            }
097    
098            @Override
099            public String[] suggestKeywordQueries(
100                    SearchContext searchContext, int max) {
101    
102                    throw new UnsupportedOperationException();
103            }
104    
105    }