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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.backgroundtask.BackgroundTask;
020    
021    import java.io.Serializable;
022    
023    import java.util.Collection;
024    import java.util.Locale;
025    import java.util.Map;
026    
027    /**
028     * @author Michael C. Han
029     */
030    @ProviderType
031    public interface IndexWriterHelper {
032    
033            public void addDocument(
034                            String searchEngineId, long companyId, Document document,
035                            boolean commitImmediately)
036                    throws SearchException;
037    
038            public void addDocuments(
039                            String searchEngineId, long companyId,
040                            Collection<Document> documents, boolean commitImmediately)
041                    throws SearchException;
042    
043            public void commit(String searchEngineId) throws SearchException;
044    
045            public void commit(String searchEngineId, long companyId)
046                    throws SearchException;
047    
048            public void deleteDocument(
049                            String searchEngineId, long companyId, String uid,
050                            boolean commitImmediately)
051                    throws SearchException;
052    
053            public void deleteDocuments(
054                            String searchEngineId, long companyId, Collection<String> uids,
055                            boolean commitImmediately)
056                    throws SearchException;
057    
058            public void deleteEntityDocuments(
059                            String searchEngineId, long companyId, String className,
060                            boolean commitImmediately)
061                    throws SearchException;
062    
063            public int getReindexTaskCount(long groupId, boolean completed)
064                    throws SearchException;
065    
066            public void indexKeyword(
067                            long companyId, String querySuggestion, float weight,
068                            String keywordType, Locale locale)
069                    throws SearchException;
070    
071            public void indexKeyword(
072                            String searchEngineId, long companyId, String querySuggestion,
073                            float weight, String keywordType, Locale locale)
074                    throws SearchException;
075    
076            public void indexQuerySuggestionDictionaries(long companyId)
077                    throws SearchException;
078    
079            public void indexQuerySuggestionDictionaries(
080                            String searchEngineId, long companyId)
081                    throws SearchException;
082    
083            public void indexQuerySuggestionDictionary(long companyId, Locale locale)
084                    throws SearchException;
085    
086            public void indexQuerySuggestionDictionary(
087                            String searchEngineId, long companyId, Locale locale)
088                    throws SearchException;
089    
090            public void indexSpellCheckerDictionaries(long companyId)
091                    throws SearchException;
092    
093            public void indexSpellCheckerDictionaries(
094                            String searchEngineId, long companyId)
095                    throws SearchException;
096    
097            public void indexSpellCheckerDictionary(long companyId, Locale locale)
098                    throws SearchException;
099    
100            public void indexSpellCheckerDictionary(
101                            String searchEngineId, long companyId, Locale locale)
102                    throws SearchException;
103    
104            /**
105             * @deprecated As of 7.0.0, replaced by {@link
106             *             com.liferay.portal.search.index.IndexStatusManager#
107             *             isIndexReadOnly}
108             */
109            @Deprecated
110            public boolean isIndexReadOnly();
111    
112            public void partiallyUpdateDocument(
113                            String searchEngineId, long companyId, Document document,
114                            boolean commitImmediately)
115                    throws SearchException;
116    
117            public void partiallyUpdateDocuments(
118                            String searchEngineId, long companyId,
119                            Collection<Document> documents, boolean commitImmediately)
120                    throws SearchException;
121    
122            public BackgroundTask reindex(
123                            long userId, String jobName, long[] companyIds,
124                            Map<String, Serializable> taskContextMap)
125                    throws SearchException;
126    
127            public BackgroundTask reindex(
128                            long userId, String jobName, long[] companyIds, String className,
129                            Map<String, Serializable> taskContextMap)
130                    throws SearchException;
131    
132            /**
133             * @deprecated As of 7.0.0, replaced by {@link
134             *             com.liferay.portal.search.index.IndexStatusManager#
135             *             setIndexReadOnly(boolean)}
136             */
137            @Deprecated
138            public void setIndexReadOnly(boolean indexReadOnly);
139    
140            public void updateDocument(
141                            String searchEngineId, long companyId, Document document,
142                            boolean commitImmediately)
143                    throws SearchException;
144    
145            public void updateDocuments(
146                            String searchEngineId, long companyId,
147                            Collection<Document> documents, boolean commitImmediately)
148                    throws SearchException;
149    
150            public void updatePermissionFields(String name, String primKey);
151    
152    }