Skip to content

Commit

Permalink
Merge pull request #194 from auth0/rm-search-engine-default
Browse files Browse the repository at this point in the history
Remove default version for search_engine
  • Loading branch information
cocojoe authored Apr 12, 2019
2 parents 155f76d + 3204538 commit f3bb0f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
14 changes: 6 additions & 8 deletions src/main/java/com/auth0/client/mgmt/filter/UserFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
public class UserFilter extends QueryFilter {

/**
* Creates a new instance using the search engine 'v2'.
* Creates a new instance using the latest search engine version.
* <p>
* This version of the search engine is now deprecated and will stop working on November 13th 2018.
* Please, migrate as soon as possible and use the {@link #withSearchEngine(String)} method to specify version 'v3'.
* See the migration guide at https://auth0.com/docs/users/search/v3#migrate-from-search-engine-v2-to-v3
* Since version 1.12.0 this SDK no longer specifies a search engine version by default. If you need to use
* a version different than the latest one, please set it explicitly by calling {@link #withSearchEngine(String)}.
* See the latest user search doc: https://auth0.com/docs/users/search/
*/
public UserFilter() {
withSearchEngine("v2");
}

@Override
Expand All @@ -23,10 +22,9 @@ public UserFilter withTotals(boolean includeTotals) {
}

/**
* Selects which Search Engine version to use.
* Selects which Search Engine version to use when querying for users.
* <p>
* Version 2 is now deprecated and will stop working on November 13th 2018. Please, migrate as soon as possible to 'v3'.
* See the migration guide at https://auth0.com/docs/users/search/v3#migrate-from-search-engine-v2-to-v3
* See the latest user search doc: https://auth0.com/docs/users/search/
*
* @param searchEngineVersion the search engine version to use on queries.
* @return this filter instance
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/auth0/client/mgmt/UsersEntityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void shouldListUsersWithQuery() throws Exception {
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/users"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("search_engine", "v2"));
assertThat(recordedRequest, not(hasQueryParameter("search_engine")));
assertThat(recordedRequest, hasQueryParameter("q", "email%3A%5C*%40gmail.com"));

assertThat(response, is(notNullValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;

public class UserFilterTest {
Expand All @@ -18,9 +17,9 @@ public void setUp() throws Exception {
}

@Test
public void shouldUseSearchEngineV2ByDefault() throws Exception {
public void shouldNotSetADefaultSearchEngineValue() throws Exception {
assertThat(filter.getAsMap(), is(notNullValue()));
assertThat(filter.getAsMap(), Matchers.hasEntry("search_engine", (Object) "v2"));
assertThat(filter.getAsMap(), not(Matchers.hasKey("search_engine")));
}

@Test
Expand Down

0 comments on commit f3bb0f4

Please sign in to comment.