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 Summary getSummary(
060                            Document document, Locale locale, String snippet,
061                            PortletURL portletURL)
062                    throws SearchException;
063    
064            public boolean hasPermission(
065                            PermissionChecker permissionChecker, String entryClassName,
066                            long entryClassPK, String actionId)
067                    throws Exception;
068    
069            public boolean isFilterSearch();
070    
071            public boolean isPermissionAware();
072    
073            public boolean isStagingAware();
074    
075            public void postProcessContextQuery(
076                            BooleanQuery contextQuery, SearchContext searchContext)
077                    throws Exception;
078    
079            public void postProcessSearchQuery(
080                            BooleanQuery searchQuery, SearchContext searchContext)
081                    throws Exception;
082    
083            public void registerIndexerPostProcessor(
084                    IndexerPostProcessor indexerPostProcessor);
085    
086            public void reindex(Object obj) throws SearchException;
087    
088            public void reindex(String className, long classPK) throws SearchException;
089    
090            public void reindex(String[] ids) throws SearchException;
091    
092            public void reindexDDMStructures(List<Long> ddmStructureIds)
093                    throws SearchException;
094    
095            public Hits search(SearchContext searchContext) throws SearchException;
096    
097            public void unregisterIndexerPostProcessor(
098                    IndexerPostProcessor indexerPostProcessor);
099    
100    }