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.ProxyFactory;
018    
019    import java.util.List;
020    import java.util.Map;
021    
022    /**
023     * @author Michael C. Han
024     */
025    public class IndexSearcherHelperUtil {
026    
027            public static String getQueryString(
028                    SearchContext searchContext, Query query) {
029    
030                    return _indexSearcherHelper.getQueryString(searchContext, query);
031            }
032    
033            public static Hits search(SearchContext searchContext, Query query)
034                    throws SearchException {
035    
036                    return _indexSearcherHelper.search(searchContext, query);
037            }
038    
039            public static long searchCount(SearchContext searchContext, Query query)
040                    throws SearchException {
041    
042                    return _indexSearcherHelper.searchCount(searchContext, query);
043            }
044    
045            public static String spellCheckKeywords(SearchContext searchContext)
046                    throws SearchException {
047    
048                    return _indexSearcherHelper.spellCheckKeywords(searchContext);
049            }
050    
051            public static Map<String, List<String>> spellCheckKeywords(
052                            SearchContext searchContext, int max)
053                    throws SearchException {
054    
055                    return _indexSearcherHelper.spellCheckKeywords(searchContext, max);
056            }
057    
058            public static String[] suggestKeywordQueries(
059                            SearchContext searchContext, int max)
060                    throws SearchException {
061    
062                    return _indexSearcherHelper.suggestKeywordQueries(searchContext, max);
063            }
064    
065            private static final IndexSearcherHelper _indexSearcherHelper =
066                    ProxyFactory.newServiceTrackedInstance(IndexSearcherHelper.class);
067    
068    }