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.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 int getDatabaseCount() throws Exception;
045    
046            public Document getDocument(Object obj) throws SearchException;
047    
048            public BooleanQuery getFacetQuery(
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            public String getPortletId();
058    
059            public String getSearchEngineId();
060    
061            public String getSortField(String orderByCol);
062    
063            public String getSortField(String orderByCol, int sortType);
064    
065            /**
066             * @deprecated As of 7.0.0, replaced by {@link #getSummary(Document, String,
067             *             PortletURL, PortletRequest, PortletResponse)}
068             */
069            @Deprecated
070            public Summary getSummary(
071                            Document document, Locale locale, String snippet,
072                            PortletURL portletURL)
073                    throws SearchException;
074    
075            public Summary getSummary(
076                            Document document, String snippet, PortletURL portletURL,
077                            PortletRequest portletRequest, PortletResponse portletResponse)
078                    throws SearchException;
079    
080            public boolean hasPermission(
081                            PermissionChecker permissionChecker, String entryClassName,
082                            long entryClassPK, String actionId)
083                    throws Exception;
084    
085            public boolean isCommitImmediately();
086    
087            public boolean isFilterSearch();
088    
089            public boolean isPermissionAware();
090    
091            public boolean isStagingAware();
092    
093            public boolean isVisible(long classPK, int status) throws Exception;
094    
095            public boolean isVisibleRelatedEntry(long classPK, int status)
096                    throws Exception;
097    
098            public void postProcessContextQuery(
099                            BooleanQuery contextQuery, SearchContext searchContext)
100                    throws Exception;
101    
102            public void postProcessSearchQuery(
103                            BooleanQuery searchQuery, SearchContext searchContext)
104                    throws Exception;
105    
106            public void registerIndexerPostProcessor(
107                    IndexerPostProcessor indexerPostProcessor);
108    
109            public void reindex(Object obj) throws SearchException;
110    
111            public void reindex(String className, long classPK) throws SearchException;
112    
113            public void reindex(String[] ids) throws SearchException;
114    
115            public void reindexDDMStructures(List<Long> ddmStructureIds)
116                    throws SearchException;
117    
118            public Hits search(SearchContext searchContext) throws SearchException;
119    
120            public Hits search(
121                            SearchContext searchContext, String... selectedFieldNames)
122                    throws SearchException;
123    
124            public void unregisterIndexerPostProcessor(
125                    IndexerPostProcessor indexerPostProcessor);
126    
127            public void updateFullQuery(SearchContext searchContext);
128    
129    }