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.filter.BooleanFilter;
018    import com.liferay.portal.security.permission.PermissionChecker;
019    
020    import java.util.Locale;
021    
022    import javax.portlet.PortletRequest;
023    import javax.portlet.PortletResponse;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     * @author Raymond Aug??
028     * @author Ryan Park
029     */
030    public interface Indexer {
031    
032            public static final int DEFAULT_INTERVAL = 10000;
033    
034            public void delete(long companyId, String uid) throws SearchException;
035    
036            public void delete(Object obj) throws SearchException;
037    
038            public String getClassName();
039    
040            /**
041             * @deprecated As of 7.0.0, replaced by {@link #getSearchClassNames}
042             */
043            @Deprecated
044            public String[] getClassNames();
045    
046            public Document getDocument(Object obj) throws SearchException;
047    
048            public BooleanFilter getFacetBooleanFilter(
049                            String className, SearchContext searchContext)
050                    throws Exception;
051    
052            public BooleanQuery getFullQuery(SearchContext searchContext)
053                    throws SearchException;
054    
055            public IndexerPostProcessor[] getIndexerPostProcessors();
056    
057            /**
058             * @deprecated As of 7.0.0, replaced by {@link #getClassName}
059             */
060            @Deprecated
061            public String getPortletId();
062    
063            public String[] getSearchClassNames();
064    
065            public String getSearchEngineId();
066    
067            public String getSortField(String orderByCol);
068    
069            public String getSortField(String orderByCol, int sortType);
070    
071            /**
072             * @deprecated As of 7.0.0, replaced by {@link #getSummary(Document, String,
073             *             PortletRequest, PortletResponse)}
074             */
075            @Deprecated
076            public Summary getSummary(Document document, Locale locale, String snippet)
077                    throws SearchException;
078    
079            public Summary getSummary(
080                            Document document, String snippet, PortletRequest portletRequest,
081                            PortletResponse portletResponse)
082                    throws SearchException;
083    
084            public boolean hasPermission(
085                            PermissionChecker permissionChecker, String entryClassName,
086                            long entryClassPK, String actionId)
087                    throws Exception;
088    
089            public boolean isCommitImmediately();
090    
091            public boolean isFilterSearch();
092    
093            public boolean isPermissionAware();
094    
095            public boolean isStagingAware();
096    
097            public boolean isVisible(long classPK, int status) throws Exception;
098    
099            public boolean isVisibleRelatedEntry(long classPK, int status)
100                    throws Exception;
101    
102            public void postProcessContextBooleanFilter(
103                            BooleanFilter contextBooleanFilter, SearchContext searchContext)
104                    throws Exception;
105    
106            /**
107             * @deprecated As of 7.0.0, replaced by {@link #postProcessContextBooleanFilter(
108             *             BooleanFilter, SearchContext)}
109             */
110            @Deprecated
111            public void postProcessContextQuery(
112                            BooleanQuery contextQuery, SearchContext searchContext)
113                    throws Exception;
114    
115            public void postProcessSearchQuery(
116                            BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
117                            SearchContext searchContext)
118                    throws Exception;
119    
120            /**
121             * @deprecated As of 7.0.0, replaced by {@link #postProcessSearchQuery(
122             *             BooleanQuery, BooleanFilter, SearchContext)}
123             */
124            @Deprecated
125            public void postProcessSearchQuery(
126                            BooleanQuery searchQuery, SearchContext searchContext)
127                    throws Exception;
128    
129            public void registerIndexerPostProcessor(
130                    IndexerPostProcessor indexerPostProcessor);
131    
132            public void reindex(Object obj) throws SearchException;
133    
134            public void reindex(String className, long classPK) throws SearchException;
135    
136            public void reindex(String[] ids) throws SearchException;
137    
138            public Hits search(SearchContext searchContext) throws SearchException;
139    
140            public Hits search(
141                            SearchContext searchContext, String... selectedFieldNames)
142                    throws SearchException;
143    
144            public long searchCount(SearchContext searchContext) throws SearchException;
145    
146            public void unregisterIndexerPostProcessor(
147                    IndexerPostProcessor indexerPostProcessor);
148    
149    }