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