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