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.search.result.SearchResultTranslator;
018    import com.liferay.portal.kernel.util.ProxyFactory;
019    
020    import java.util.List;
021    import java.util.Locale;
022    
023    import javax.portlet.PortletRequest;
024    import javax.portlet.PortletResponse;
025    
026    /**
027     * @author Eudaldo Alonso
028     */
029    public class SearchResultUtil {
030    
031            public static List<SearchResult> getSearchResults(
032                    Hits hits, Locale locale) {
033    
034                    return getSearchResults(hits, locale, null, null);
035            }
036    
037            public static List<SearchResult> getSearchResults(
038                    Hits hits, Locale locale, PortletRequest portletRequest,
039                    PortletResponse portletResponse) {
040    
041                    return _searchResultTranslator.translate(
042                            hits, locale, portletRequest, portletResponse);
043            }
044    
045            private static final SearchResultTranslator _searchResultTranslator =
046                    ProxyFactory.newServiceTrackedInstance(SearchResultTranslator.class);
047    
048    }