001    /**
002     * Copyright (c) 2000-2013 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.security.permission.PermissionChecker;
018    
019    import java.util.Locale;
020    
021    import javax.portlet.PortletURL;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     * @author Raymond Aug??
026     * @author Ryan Park
027     */
028    public interface Indexer {
029    
030            public static final int DEFAULT_INTERVAL = 10000;
031    
032            public void delete(long companyId, String uid) throws SearchException;
033    
034            public void delete(Object obj) throws SearchException;
035    
036            public String[] getClassNames();
037    
038            public Document getDocument(Object obj) throws SearchException;
039    
040            public BooleanQuery getFacetQuery(
041                            String className, SearchContext searchContext)
042                    throws Exception;
043    
044            public BooleanQuery getFullQuery(SearchContext searchContext)
045                    throws SearchException;
046    
047            public IndexerPostProcessor[] getIndexerPostProcessors();
048    
049            public String getPortletId();
050    
051            public String getSearchEngineId();
052    
053            public String getSortField(String orderByCol);
054    
055            public Summary getSummary(
056                            Document document, Locale locale, String snippet,
057                            PortletURL portletURL)
058                    throws SearchException;
059    
060            public boolean hasPermission(
061                            PermissionChecker permissionChecker, long entryClassPK,
062                            String actionId)
063                    throws Exception;
064    
065            public boolean isFilterSearch();
066    
067            public boolean isPermissionAware();
068    
069            public boolean isStagingAware();
070    
071            public void postProcessContextQuery(
072                            BooleanQuery contextQuery, SearchContext searchContext)
073                    throws Exception;
074    
075            public void postProcessSearchQuery(
076                            BooleanQuery searchQuery, SearchContext searchContext)
077                    throws Exception;
078    
079            public void registerIndexerPostProcessor(
080                    IndexerPostProcessor indexerPostProcessor);
081    
082            public void reindex(Object obj) throws SearchException;
083    
084            public void reindex(String className, long classPK) throws SearchException;
085    
086            public void reindex(String[] ids) throws SearchException;
087    
088            public Hits search(SearchContext searchContext) throws SearchException;
089    
090            public void unregisterIndexerPostProcessor(
091                    IndexerPostProcessor indexerPostProcessor);
092    
093    }