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.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    }