1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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  }