01 /*
02 * Searchable.java
03 *
04 * Niraj Aswani, 19/March/07
05 *
06 * $Id: Searchable.html,v 1.0 2007/03/19 16:22:01 niraj Exp $
07 */
08 package gate.creole.annic;
09
10 import java.util.Map;
11
12 /**
13 * The interface declares methods which should be implemented by an
14 * object wishing to get indexed and being searchable.
15 *
16 * @author niraj
17 *
18 */
19 public interface Searchable {
20
21 /**
22 * This method is used to specify the indexer which is used to index
23 * documents
24 *
25 * @param indexer
26 * @param parameters - parameters required by the specific
27 * implementation of provided indexer
28 * @throws IndexException
29 */
30 public void setIndexer(Indexer indexer, Map parameters) throws IndexException;
31
32 /**
33 * Returns the Indexer
34 *
35 * @return
36 */
37 public Indexer getIndexer();
38
39 /**
40 * This method is used to specify the searcher which is used for
41 * searchering the index
42 *
43 * @param searcher
44 * @throws SearchException
45 */
46 public void setSearcher(Searcher searcher) throws SearchException;
47
48 /**
49 * Returns the Searcher
50 *
51 * @return
52 */
53 public Searcher getSearcher();
54
55 /**
56 * @param query
57 * @param searchParameters - parameters required for searching an
58 * index (e.g. location of the index)
59 * @return true if the search was successful
60 * @throws SearchException
61 */
62 public boolean search(String query, Map searchParameters)
63 throws SearchException;
64
65 /**
66 * @param numberOfPatterns
67 * @return an Array of Hit that has atleast a document ID, start and
68 * end offset and the original query string
69 * @throws SearchException
70 */
71 public Hit[] next(int numberOfPatterns) throws SearchException;
72
73 }
|