001    /**
002     * Copyright (c) 2000-2010 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    
019    import org.apache.lucene.analysis.Analyzer;
020    import org.apache.lucene.document.Document;
021    import org.apache.lucene.index.Term;
022    import org.apache.lucene.queryParser.ParseException;
023    import org.apache.lucene.search.BooleanQuery;
024    import org.apache.lucene.search.IndexSearcher;
025    import org.apache.lucene.search.Query;
026    
027    /**
028     * @author Bruno Farache
029     */
030    public interface LuceneHelper {
031    
032            public void addDocument(long companyId, Document document)
033                    throws IOException;
034    
035            public void addExactTerm(
036                    BooleanQuery booleanQuery, String field, String value);
037    
038            public void addRequiredTerm(
039                    BooleanQuery booleanQuery, String field, String value, boolean like);
040    
041            public void addTerm(
042                            BooleanQuery booleanQuery, String field, String value, boolean like)
043                    throws ParseException;
044    
045            public void delete(long companyId);
046    
047            public void deleteDocuments(long companyId, Term term) throws IOException;
048    
049            public Analyzer getAnalyzer();
050    
051            public String[] getQueryTerms(Query query);
052    
053            public IndexSearcher getSearcher(long companyId, boolean readOnly)
054                    throws IOException;
055    
056            public String getSnippet(
057                            Query query, String field, String s, int maxNumFragments,
058                            int fragmentLength, String fragmentSuffix, String preTag,
059                            String postTag)
060                    throws IOException;
061    
062            public void shutdown();
063    
064            public void updateDocument(long companyId, Term term, Document document)
065                    throws IOException;
066    
067    }