Support arbitrary account queries via REST
GET /accounts/?q=<query> supports arbitrary account queries now. So far this REST endpoint was used for account suggestions, suggesting accounts for a substring that the user has typed. This will continue to work since this is handled by the default field for account queries. However if the provided query contains query operators a full-fledged account query is executed. This is undesired for account suggestions. This is why the old behaviour for account suggestions is preserved when the parameter 'suggest' is provided. The web UI and the java extension API are adapted to set this new parameter for account suggestions. For old clients the new REST endpoint provides enough backward compatibility so that they are not breaking as it is rather unlikely that a substring that was typed by a user contains a query operator. Using /accounts/?q=<query> for arbitrary account queries has the advantage that this is consistent with the REST endpoint for querying changes which is /changes/?q=<query>. Rename SuggestAccounts to QueryAccounts to reflect the new functionality and to have a consistent name with QueryChanges. Since the account query predicates are now exposed to external users this change also adds documentation for them. Change-Id: Iabe3e52893a17a21d4bfdec6dab737e0cebaea23 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -53,6 +53,7 @@ public class AccountApi {
|
||||
public static void suggest(String query, int limit,
|
||||
AsyncCallback<JsArray<AccountInfo>> cb) {
|
||||
new RestApi("/accounts/")
|
||||
.addParameterTrue("suggest")
|
||||
.addParameter("q", query)
|
||||
.addParameter("n", limit)
|
||||
.background()
|
||||
|
||||
Reference in New Issue
Block a user