KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > search > JahiaSearcher


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
//
13
//
14
//
15

16 package org.jahia.services.search;
17
18 import org.jahia.data.search.JahiaSearchResult;
19 import org.jahia.exceptions.JahiaException;
20 import org.jahia.params.ParamBean;
21
22 import java.util.ArrayList JavaDoc;
23
24
25 /**
26  * Jahia Searcher interface.
27  *
28  * @author Khue Nguyen <a HREF="mailto:khue@jahia.org">khue@jahia.org</a>
29  */

30
31 public abstract class JahiaSearcher {
32
33     /** All available searcher names */
34     public static final String JavaDoc PAGE_SEARCHER = "PageSearcher";
35     public static final String JavaDoc CONTAINER_SEARCHER = "ContainerSearcher";
36
37
38     /** The last performed query. */
39     private String JavaDoc query;
40
41     /** The last result. */
42     private Object JavaDoc result;
43
44     /** Return the array of sites on which to perform search
45      *
46      * @return
47      */

48     public abstract int[] getSiteIds ();
49
50     //--------------------------------------------------------------------------
51
/**
52      * Return the searcher name, i.e PAGE_SEARCHER, CONAINER_SEARCHER,...
53      *
54      * @return String name, the searcher name.
55      */

56     public abstract String JavaDoc getName ();
57
58     //--------------------------------------------------------------------------
59
/**
60      * Perform the search for a given query as String.
61      * Return the results as a Object instance.
62      *
63      * @param String query, a valid query.
64      * @param ParamBean jParams, the param bean.
65      *
66      * @return JahiaSearchResult result.
67      */

68     public abstract JahiaSearchResult search (String JavaDoc query, ParamBean jParams)
69             throws JahiaException;
70
71     //--------------------------------------------------------------------------
72
/**
73      * Return the last query performed by search(query) method call.
74      *
75      * @return Object the result, the result is an instance of JahiaSearchResult object.
76      */

77     public String JavaDoc getQuery () {
78         return this.query;
79     }
80
81     //--------------------------------------------------------------------------
82
/**
83      * Set the last performed query.
84      *
85      * @param String query, the last performed query.
86      */

87     public void setQuery (String JavaDoc query) {
88         this.query = query;
89     }
90
91     //--------------------------------------------------------------------------
92
/**
93      * Return the results returned by the last search(query) method call.
94      *
95      * @return Object the result, the result is an instance of JahiaSearchResult object.
96      */

97     public Object JavaDoc getResult () {
98         return this.result;
99     }
100
101     //--------------------------------------------------------------------------
102
/**
103      * Set the result.
104      *
105      * @param Object result, the result of the search result.
106      */

107     void setResult (Object JavaDoc result) {
108         this.result = result;
109     }
110
111     //--------------------------------------------------------------------------
112
/**
113      * @return the list of languages code to search.
114      */

115     public abstract ArrayList JavaDoc getLanguageCodes ();
116
117 }
118
Popular Tags