1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.portal.search.lucene;
16  
17  import java.io.IOException;
18  
19  import org.apache.lucene.analysis.Analyzer;
20  import org.apache.lucene.document.Document;
21  import org.apache.lucene.index.Term;
22  import org.apache.lucene.queryParser.ParseException;
23  import org.apache.lucene.search.BooleanQuery;
24  import org.apache.lucene.search.IndexSearcher;
25  import org.apache.lucene.search.Query;
26  
27  /**
28   * <a href="LuceneHelper.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Bruno Farache
31   */
32  public interface LuceneHelper {
33  
34      public void addDocument(long companyId, Document document)
35          throws IOException;
36  
37      public void addExactTerm(
38          BooleanQuery booleanQuery, String field, String value);
39  
40      public void addRequiredTerm(
41          BooleanQuery booleanQuery, String field, String value, boolean like);
42  
43      public void addTerm(
44              BooleanQuery booleanQuery, String field, String value, boolean like)
45          throws ParseException;
46  
47      public void delete(long companyId);
48  
49      public void deleteDocuments(long companyId, Term term) throws IOException;
50  
51      public Analyzer getAnalyzer();
52  
53      public String[] getQueryTerms(Query query);
54  
55      public IndexSearcher getSearcher(long companyId, boolean readOnly)
56          throws IOException;
57  
58      public String getSnippet(
59              Query query, String field, String s, int maxNumFragments,
60              int fragmentLength, String fragmentSuffix, String preTag,
61              String postTag)
62          throws IOException;
63  
64      public void shutdown();
65  
66      public void updateDocument(long companyId, Term term, Document document)
67          throws IOException;
68  
69  }