Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search flag into base clients #448

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ public BaseBrowsableClient(@Nonnull Client restliClient) {
public abstract BrowseResult browse(@Nonnull String inputPath, @Nullable Map<String, String> requestFilters, int from, int size)
throws RemoteInvocationException;

/**
* Browse method that allows caller to choose the platform.
*/
@Nonnull
public BrowseResult browse(@Nonnull String inputPath, @Nullable Map<String, String> requestFilters, @Nullable SearchPlatform searchPlatform,
int from, int size) throws RemoteInvocationException {
throw new UnsupportedOperationException("Not implemented yet.");
}

/**
* Returns a list of paths for a given urn.
*
Expand All @@ -49,4 +58,11 @@ public StringArray getBrowsePaths(@Nonnull URN urn) throws RemoteInvocationExcep
throw new UnsupportedOperationException("Not implemented yet.");
}

/**
* Returns a list of paths for a given urn and allows caller to choose the platform.
*/
@Nonnull
public StringArray getBrowsePaths(@Nonnull URN urn, @Nullable SearchPlatform searchPlatform) throws RemoteInvocationException {
throw new UnsupportedOperationException("Not implemented yet.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@
*/
public abstract class BaseSearchableClient<VALUE extends RecordTemplate> extends BaseClient {

public enum SearchPlatform {
ELASTICSEARCH("elasticsearch"),
HOSTEDSEARCH("hostedsearch");

private final String platformName;

SearchPlatform(String platform) {
this.platformName = platform;
}

public String getPlatformName() {
return platformName;
}
}

public BaseSearchableClient(@Nonnull Client restliClient) {
super(restliClient);
}
Expand All @@ -41,6 +56,16 @@ public abstract CollectionResponse<VALUE> search(@Nonnull String input, @Nullabl
@Nullable Map<String, String> requestFilters, @Nullable SortCriterion sortCriterion, int start, int count)
throws RemoteInvocationException;

/**
* Similar to {@link #search(String, StringArray, Map, SortCriterion, int, int)} with platform flag to indicate the request
* should be served by elasticsearch or hostedsearch.
*/
public CollectionResponse<VALUE> search(@Nonnull String input, @Nullable StringArray aspectNames,
@Nullable Map<String, String> requestFilters, @Nullable SortCriterion sortCriterion, @Nullable SearchPlatform platform,
int start, int count) throws RemoteInvocationException {
throw new UnsupportedOperationException("Not implemented in BaseSearchableClient.");
}

/**
* Similar to {@link #search(String, StringArray, Map, SortCriterion, int, int)} with null for aspect names, meaning
* all aspects will be returned.
Expand All @@ -51,6 +76,15 @@ public CollectionResponse<VALUE> search(@Nonnull String input, @Nullable Map<Str
return search(input, null, requestFilters, sortCriterion, start, count);
}

/**
* Autocomplete with search platform flag.
*/
@Nonnull
public AutoCompleteResult autocomplete(@Nonnull String query, @Nullable String field, @Nullable Map<String, String> requestFilters,
@Nullable SearchPlatform platform, int limit) throws RemoteInvocationException {
throw new UnsupportedOperationException("Not implemented in BaseSearchableClient.");
}

/**
* Autocomplete method that the client will override only if they need this capability.
*
Expand Down
Loading