01: package org.apache.cocoon.components.search.components;
02:
03: import org.apache.cocoon.ProcessingException;
04: import org.apache.lucene.search.Hits;
05: import org.apache.lucene.search.Query;
06: import org.apache.lucene.store.Directory;
07:
08: /**
09: * this Searcher Component allows: <br/> - searching in several indexes <br/> - sorting hits by a
10: * specified field and order
11: *
12: * @author Nicolas Maisonneuve
13: */
14: public interface Searcher {
15: /**
16: * The ROLE name of this avalon component.
17: * <p>
18: * Its value if the FQN of this interface, ie.
19: * <code>org.apache.cocoon.components.search.Searcher</code>.
20: * </p>
21: *
22: * @since
23: */
24: String ROLE = Searcher.class.getName();
25:
26: /**
27: * Add a lucene directory -- you can add several directories
28: * <p>
29: * The directory specifies the directory used for looking up the index. It defines the physical
30: * place of the index
31: * </p>
32: *
33: * @param directory The new directory value
34: */
35: public void addDirectory(Directory directory);
36:
37: /**
38: * Set the field by which the search results are to be sorted
39: * @param field the index field
40: * @param reverse reverse order or not
41: */
42: public void setSortField(String field, boolean reverse);
43:
44: /**
45: * Search using a Lucene Query object, returning zero, or more hits.
46: *
47: * @param query A lucene query
48: * @return Hits zero or more hits matching the query string
49: * @exception ProcessingException throwing due to processing errors while looking up the index
50: * directory, parsing the query string, generating the hits.
51: */
52: public Hits search(Query query) throws ProcessingException;
53: }
|