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  import org.apache.lucene.util.Version;
27  
28  /**
29   * <a href="LuceneHelper.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Bruno Farache
32   */
33  public interface LuceneHelper {
34  
35      public void addDocument(long companyId, Document document)
36          throws IOException;
37  
38      public void addExactTerm(
39          BooleanQuery booleanQuery, String field, String value);
40  
41      public void addRequiredTerm(
42          BooleanQuery booleanQuery, String field, String value, boolean like);
43  
44      public void addTerm(
45              BooleanQuery booleanQuery, String field, String value, boolean like)
46          throws ParseException;
47  
48      public void delete(long companyId);
49  
50      public void deleteDocuments(long companyId, Term term) throws IOException;
51  
52      public Analyzer getAnalyzer();
53  
54      public String[] getQueryTerms(Query query);
55  
56      public IndexSearcher getSearcher(long companyId, boolean readOnly)
57          throws IOException;
58  
59      public String getSnippet(
60              Query query, String field, String s, int maxNumFragments,
61              int fragmentLength, String fragmentSuffix, String preTag,
62              String postTag)
63          throws IOException;
64  
65      public Version getVersion();
66  
67      public void shutdown();
68  
69      public void updateDocument(long companyId, Term term, Document document)
70          throws IOException;
71  
72  }