View Javadoc

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      /**
14       * Runs the a search given a query and returns a searchResult. The query will return as many hits as the underlying
15       * application would return by default.
16       * <p/>
17       * The searchQuery should be URLencoded, as it may contain parameters as well.  For example if a search should only
18       * return a maximum number of hits the searchQuery would be '<searchString>&maxHits=20'
19       *
20       * @param username    The user to run the search as.  May be null for anonymous searches.
21       * @param searchQuery The query to run
22       * @return A SearchResults object
23       * @deprecated since 2.10, use {@link #search(com.atlassian.sal.api.user.UserKey, String)} instead.
24       */
25      @Deprecated
26      SearchResults search(String username, String searchQuery);
27  
28      /**
29       * Runs the a search given a query and returns a searchResult. The query will return as many hits as the underlying
30       * application would return by default.
31       * <p/>
32       * The searchQuery should be URLencoded, as it may contain parameters as well.  For example if a search should only
33       * return a maximum number of hits the searchQuery would be '<searchString>&maxHits=20'
34       *
35       * @param userKey     The key of the user to run the search as.  May be null for anonymous searches.
36       * @param searchQuery The query to run
37       * @return A SearchResults object
38       * @since 2.10
39       */
40      SearchResults search(UserKey userKey, String searchQuery);
41  }