001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.search.lucene;
016    
017    import java.io.IOException;
018    import java.io.InputStream;
019    import java.io.OutputStream;
020    
021    import org.apache.lucene.document.Document;
022    import org.apache.lucene.index.Term;
023    import org.apache.lucene.store.Directory;
024    
025    /**
026     * @author Bruno Farache
027     * @author Shuyang Zhou
028     */
029    public interface IndexAccessor {
030    
031            public static final long DEFAULT_LAST_GENERATION = -1;
032    
033            public void addDocument(Document document) throws IOException;
034    
035            public void close();
036    
037            public void delete() ;
038    
039            public void deleteDocuments(Term term) throws IOException;
040    
041            public void dumpIndex(OutputStream outputStream) throws IOException;
042    
043            public void enableDumpIndex();
044    
045            public long getCompanyId();
046    
047            public long getLastGeneration();
048    
049            public Directory getLuceneDir();
050    
051            public void loadIndex(InputStream inputStream) throws IOException;
052    
053            public void updateDocument(Term term, Document document) throws IOException;
054    
055    }