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