001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.search;
016    
017    import com.liferay.portal.security.permission.PermissionChecker;
018    
019    import java.util.List;
020    import java.util.Locale;
021    
022    import javax.portlet.PortletRequest;
023    import javax.portlet.PortletResponse;
024    import javax.portlet.PortletURL;
025    
026    /**
027     * @author Brian Wing Shun Chan
028     * @author Raymond Aug??
029     * @author Ryan Park
030     */
031    public interface Indexer {
032    
033            public static final int DEFAULT_INTERVAL = 10000;
034    
035            public void addRelatedEntryFields(Document document, Object obj)
036                    throws Exception;
037    
038            public void delete(long companyId, String uid) throws SearchException;
039    
040            public void delete(Object obj) throws SearchException;
041    
042            public String[] getClassNames();
043    
044            public Document getDocument(Object obj) throws SearchException;
045    
046            public BooleanQuery getFacetQuery(
047                            String className, SearchContext searchContext)
048                    throws Exception;
049    
050            public BooleanQuery getFullQuery(SearchContext searchContext)
051                    throws SearchException;
052    
053            public IndexerPostProcessor[] getIndexerPostProcessors();
054    
055            public String getPortletId();
056    
057            public String getSearchEngineId();
058    
059            public String getSortField(String orderByCol);
060    
061            public String getSortField(String orderByCol, int sortType);
062    
063            /**
064             * @deprecated As of 7.0.0, replaced by {@link #getSummary(Document, Locale,
065             *             String, PortletURL, PortletRequest, PortletResponse)}
066             */
067            @Deprecated
068            public Summary getSummary(
069                            Document document, Locale locale, String snippet,
070                            PortletURL portletURL)
071                    throws SearchException;
072    
073            public Summary getSummary(
074                            Document document, Locale locale, String snippet,
075                            PortletURL portletURL, PortletRequest portletRequest,
076                            PortletResponse portletResponse)
077                    throws SearchException;
078    
079            public boolean hasPermission(
080                            PermissionChecker permissionChecker, String entryClassName,
081                            long entryClassPK, String actionId)
082                    throws Exception;
083    
084            public boolean isFilterSearch();
085    
086            public boolean isPermissionAware();
087    
088            public boolean isStagingAware();
089    
090            public boolean isVisible(long classPK, int status)
091                    throws Exception;
092    
093            public boolean isVisibleRelatedEntry(long classPK, int status)
094                    throws Exception;
095    
096            public void postProcessContextQuery(
097                            BooleanQuery contextQuery, SearchContext searchContext)
098                    throws Exception;
099    
100            public void postProcessSearchQuery(
101                            BooleanQuery searchQuery, SearchContext searchContext)
102                    throws Exception;
103    
104            public void registerIndexerPostProcessor(
105                    IndexerPostProcessor indexerPostProcessor);
106    
107            public void reindex(Object obj) throws SearchException;
108    
109            public void reindex(String className, long classPK) throws SearchException;
110    
111            public void reindex(String[] ids) throws SearchException;
112    
113            public void reindexDDMStructures(List<Long> ddmStructureIds)
114                    throws SearchException;
115    
116            public Hits search(SearchContext searchContext) throws SearchException;
117    
118            public void unregisterIndexerPostProcessor(
119                    IndexerPostProcessor indexerPostProcessor);
120    
121    }