01: package net.bagaluten.jca.lucene.connector;
02:
03: import java.util.Set;
04:
05: import javax.resource.ResourceException;
06:
07: /**
08: * @author ThomasS
09: *
10: */
11: /**
12: * @author ThomasS
13: *
14: */
15: public interface LuceneConnection {
16:
17: /**
18: * do a lucene query
19: * @param query lucene query string
20: * @param fields define fileds we want to have in the result set
21: * @param offset start with this result in the resultset
22: * @param count number of results to return
23: * @return Resultset with the specified fields set
24: * @throws ResourceException on Error
25: */
26: Entries search(String query, Set<QueryField> fields, int offset,
27: int count) throws ResourceException;
28:
29: /**
30: * @param words the word or words you want a spell check done on
31: * @param field the suggested words are restricted to the words present in this field
32: * @param suggestNumber the number of suggest words
33: *
34: * @return a set of suggest words
35: *
36: * @throws ResourceException on Error
37: */
38: Set<String> suggest(String words, QueryField field,
39: int suggestNumber) throws ResourceException;
40:
41: /**
42: * add an entry to the index
43: * @param entry to add
44: * @return true on success, false otherwise
45: */
46: boolean add(Entry entry);
47:
48: /**
49: * add a couple of entries to the index
50: * @param entries to add
51: * @return number of entries added
52: * @throws ResourceException on error
53: */
54: int bulkAdd(Entries entries) throws ResourceException;
55:
56: /**
57: * optimiye the index
58: * @throws ResourceException on error
59: */
60: void optimize() throws ResourceException;
61:
62: /**
63: * close this connection and free the resources
64: */
65: void close();
66:
67: }
|