1 package com.atlassian.sal.api.search;
2
3 import com.atlassian.sal.api.user.UserKey;
4
5 /**
6 * Allows for simple string based searches in an application. Currently this only supports String based
7 * (quicksearch type) queries, but this may be extended in the future.
8 *
9 * @since 2.0
10 */
11 public interface SearchProvider {
12 /**
13 * Runs the a search given a query and returns a searchResult. The query will return as many hits as the underlying
14 * application would return by default.
15 * <p/>
16 * The searchQuery should be URLencoded, as it may contain parameters as well. For example if a search should only
17 * return a maximum number of hits the searchQuery would be '<searchString>&maxHits=20'
18 *
19 * @param username The user to run the search as. May be null for anonymous searches.
20 * @param searchQuery The query to run
21 * @return A SearchResults object
22 * @deprecated since 2.10, use {@link #search(com.atlassian.sal.api.user.UserKey, String)} instead.
23 */
24 @Deprecated
25 SearchResults search(String username, String searchQuery);
26
27 /**
28 * Runs the a search given a query and returns a searchResult. The query will return as many hits as the underlying
29 * application would return by default.
30 * <p/>
31 * The searchQuery should be URLencoded, as it may contain parameters as well. For example if a search should only
32 * return a maximum number of hits the searchQuery would be '<searchString>&maxHits=20'
33 *
34 * @param userKey The key of the user to run the search as. May be null for anonymous searches.
35 * @param searchQuery The query to run
36 * @return A SearchResults object
37 * @since 2.10
38 */
39 SearchResults search(UserKey userKey, String searchQuery);
40 }