1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.search.lucene;
24  
25  import java.io.IOException;
26  
27  import org.apache.lucene.analysis.Analyzer;
28  import org.apache.lucene.document.Document;
29  import org.apache.lucene.index.Term;
30  import org.apache.lucene.queryParser.ParseException;
31  import org.apache.lucene.search.BooleanQuery;
32  import org.apache.lucene.search.IndexSearcher;
33  import org.apache.lucene.search.Query;
34  
35  /**
36   * <a href="LuceneHelper.java.html"><b><i>View Source</i></b></a>
37   *
38   * @author Bruno Farache
39   */
40  public interface LuceneHelper {
41  
42      public void addDocument(long companyId, Document document)
43          throws IOException;
44  
45      public void addExactTerm(
46          BooleanQuery booleanQuery, String field, String value);
47  
48      public void addRequiredTerm(
49          BooleanQuery booleanQuery, String field, String value, boolean like);
50  
51      public void addTerm(
52              BooleanQuery booleanQuery, String field, String value, boolean like)
53          throws ParseException;
54  
55      public void delete(long companyId);
56  
57      public void deleteDocuments(long companyId, Term term) throws IOException;
58  
59      public Analyzer getAnalyzer();
60  
61      public String[] getQueryTerms(Query query);
62  
63      public IndexSearcher getSearcher(long companyId, boolean readOnly)
64          throws IOException;
65  
66      public String getSnippet(
67              Query query, String field, String s, int maxNumFragments,
68              int fragmentLength, String fragmentSuffix, String preTag,
69              String postTag)
70          throws IOException;
71  
72      public void shutdown();
73  
74      public void updateDocument(long companyId, Term term, Document document)
75          throws IOException;
76  
77  }