KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > search > SearchQueryHandler


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.storage.search;
11
12 import java.util.List JavaDoc;
13 import org.mmbase.module.core.MMObjectBuilder;
14
15 /**
16  * Defines methods for an object that handles search query requests.
17  *
18  * @author Rob van Maris
19  * @version $Id: SearchQueryHandler.java,v 1.4 2005/12/10 14:21:57 michiel Exp $
20  * @since MMBase-1.7
21  */

22 public interface SearchQueryHandler {
23     /**
24      * Support level for features that are not supported.
25      */

26     public final static int SUPPORT_NONE = 0;
27
28     /**
29      * Support level for features that are supported, but not recommended when performance is critical.
30      */

31     public final static int SUPPORT_WEAK = 1;
32
33     /**
34      * Support level for features that are available for use under normal circumstances.
35      */

36     public final static int SUPPORT_NORMAL = 2;
37
38     /**
39      * Support level for features that are optimally supported. This applies also to features that are supported without a significant impact on performance penalty.
40      */

41     public final static int SUPPORT_OPTIMAL = 3;
42
43     /**
44      * Feature that allows specifying the maximum number of results to be returned.
45      * @see SearchQuery#getMaxNumber
46      */

47     public final static int FEATURE_MAX_NUMBER = 1;
48
49     /**
50      * Feature that allows specifying an index in the list of results, as a starting popublic final static int for results to be returned.
51      * @see SearchQuery#getOffset
52      */

53     public final static int FEATURE_OFFSET = 2;
54
55
56     /**
57      * Feature that allows to search on string by a regular expression.
58      * @see SearchQuery#getOffset
59      */

60     public final static int FEATURE_REGEXP = 3;
61
62     /**
63      * Gets the level at which a feature is supported for a query
64      * by this handler. This is one of either:
65      * <ul>
66      * <li>{@link #SUPPORT_NONE SUPPORT_NONE}
67      * <li>{@link #SUPPORT_WEAK SUPPORT_WEAK}
68      * <li>{@link #SUPPORT_NORMAL SUPPORT_NORMAL}
69      * <li>{@link #SUPPORT_OPTIMAL SUPPORT_OPTIMAL}
70      * </ul>
71      * Given the choice, the query handler with the highest level of support is prefered.
72      */

73     public int getSupportLevel(int feature, SearchQuery query)
74     throws SearchQueryException;
75
76     /**
77      * Gets the level at which a constraint is supported for a query
78      * by this handler. This is one of either:
79      * <ul>
80      * <li>{@link #SUPPORT_NONE SUPPORT_NONE}
81      * <li>{@link #SUPPORT_WEAK SUPPORT_WEAK}
82      * <li>{@link #SUPPORT_NORMAL SUPPORT_NORMAL}
83      * <li>{@link #SUPPORT_OPTIMAL SUPPORT_OPTIMAL}
84      * </ul>
85      * Given the choice, the query handler with the highest level of support is prefered.
86      */

87     public int getSupportLevel(Constraint constraint, SearchQuery query)
88     throws SearchQueryException;
89
90     /**
91      * Processes a search query, returns the result as a list of nodes.
92      * Depending on the specified builder, the results will be:
93      * <ul>
94      * <li>Resultnodes, with fields named according to the field aliases
95      * specified by the query.
96      * <li>Clusternodes, with fields named
97      * <code>&lt;step alias&gt;.&lt;field name&gt;</code>, where
98      * the step alias is required to be of the form
99      * <code>&lt;step tablename&gt;&lt;x&gt;</code>, and
100      * <code>&lt;x&gt;</code> is either empty or a single digit. Examples: <br />
101      * <code>images.number</code>, <code>images0.number</code>,
102      * <code>images1.number</code>
103      * <li>Real nodes, where all fields are required to be included in
104      * the query.
105      * </ul>
106      * @param query The search query.
107      * @param builder The builder for the result nodes. Specify a
108      * {@link ResultBuilder ResultBuilder}
109      * to get resultnodes.
110      * {@link org.mmbase.module.core.ClusterBuilder ClusterBuilder}
111      * to get clusternodes.
112      * @return The resulting nodes.
113      * @see ResultNode
114      * @see org.mmbase.module.core.ClusterNode
115      */

116     public List JavaDoc getNodes(SearchQuery query, MMObjectBuilder builder)
117     throws SearchQueryException;
118 }
119
Popular Tags