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 void postProcessContextQuery(
078                            BooleanQuery contextQuery, SearchContext searchContext)
079                    throws Exception;
080    
081            public void postProcessSearchQuery(
082                            BooleanQuery searchQuery, SearchContext searchContext)
083                    throws Exception;
084    
085            public void registerIndexerPostProcessor(
086                    IndexerPostProcessor indexerPostProcessor);
087    
088            public void reindex(Object obj) throws SearchException;
089    
090            public void reindex(String className, long classPK) throws SearchException;
091    
092            public void reindex(String[] ids) throws SearchException;
093    
094            public void reindexDDMStructures(List<Long> ddmStructureIds)
095                    throws SearchException;
096    
097            public Hits search(SearchContext searchContext) throws SearchException;
098    
099            public void unregisterIndexerPostProcessor(
100                    IndexerPostProcessor indexerPostProcessor);
101    
102    }