From 90f5125ffa99da791cac137d9e2cc0db1c03841f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Thu, 19 May 2022 10:55:49 +0200 Subject: [PATCH] fix(specs): rename `search` method --- .../model/recommend/RequiredSearchParams.java | 62 ---- .../algolia/model/search/MultipleQueries.java | 147 -------- .../model/search/MultipleQueriesParams.java | 91 ----- .../model/search/MultipleQueriesResponse.java | 72 ---- .../model/search/MultipleQueriesStrategy.java | 57 --- .../model/search/MultipleQueriesType.java | 57 --- .../model/search/RequiredSearchParams.java | 62 ---- .../model/multipleQueries.ts | 21 -- .../model/multipleQueriesParams.ts | 7 - .../model/multipleQueriesResponse.ts | 5 - .../model/multipleQueriesStrategy.ts | 1 - .../model/multipleQueriesType.ts | 4 - .../model/requiredSearchParams.ts | 6 - .../client-search/model/multipleQueries.ts | 21 -- .../model/multipleQueriesParams.ts | 7 - .../model/multipleQueriesResponse.ts | 5 - .../model/multipleQueriesStrategy.ts | 1 - .../model/multipleQueriesType.ts | 4 - .../model/requiredSearchParams.ts | 6 - .../recommend/model/requiredSearchParams.ts | 6 - .../Model/Recommend/RequiredSearchParams.php | 216 ----------- .../lib/Model/Search/MultipleQueries.php | 340 ------------------ .../Model/Search/MultipleQueriesParams.php | 247 ------------- .../Model/Search/MultipleQueriesResponse.php | 209 ----------- .../Model/Search/MultipleQueriesStrategy.php | 29 -- .../lib/Model/Search/MultipleQueriesType.php | 31 -- .../lib/Model/Search/RequiredSearchParams.php | 216 ----------- .../java/com/algolia/playground/Search.java | 31 +- playground/javascript/node/search.ts | 8 +- playground/php/src/search.php | 13 +- specs/common/schemas/SearchParams.yml | 10 +- specs/search/common/enums.yml | 4 +- .../search/common/schemas/SearchResponse.yml | 2 +- specs/search/paths/search/multipleQueries.yml | 63 ---- specs/search/paths/search/search.yml | 45 ++- .../search/paths/search/searchSingleIndex.yml | 29 ++ specs/search/spec.yml | 4 +- tests/CTS/client/search/api.json | 21 +- .../requests/search/multipleQueries.json | 68 ---- tests/CTS/methods/requests/search/search.json | 108 ++++-- .../requests/search/searchSingleIndex.json | 41 +++ .../guides/filtering-your-search.mdx | 126 ++++--- .../api-clients/guides/retrieving-facets.mdx | 60 ++-- website/docs/api-clients/installation.mdx | 155 +++++--- website/docs/api-clients/migration-guide.mdx | 42 ++- 45 files changed, 487 insertions(+), 2273 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/recommend/RequiredSearchParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueries.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesParams.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesStrategy.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesType.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/RequiredSearchParams.java delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesStrategy.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/requiredSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts delete mode 100644 clients/algoliasearch-client-php/lib/Model/Recommend/RequiredSearchParams.php delete mode 100644 clients/algoliasearch-client-php/lib/Model/Search/MultipleQueries.php delete mode 100644 clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesParams.php delete mode 100644 clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesResponse.php delete mode 100644 clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesStrategy.php delete mode 100644 clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesType.php delete mode 100644 clients/algoliasearch-client-php/lib/Model/Search/RequiredSearchParams.php delete mode 100644 specs/search/paths/search/multipleQueries.yml create mode 100644 specs/search/paths/search/searchSingleIndex.yml delete mode 100644 tests/CTS/methods/requests/search/multipleQueries.json create mode 100644 tests/CTS/methods/requests/search/searchSingleIndex.json diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/recommend/RequiredSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/recommend/RequiredSearchParams.java deleted file mode 100644 index a4780d7ccb..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/recommend/RequiredSearchParams.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.algolia.model.recommend; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** RequiredSearchParams */ -public class RequiredSearchParams { - - @SerializedName("query") - private String query = ""; - - public RequiredSearchParams setQuery(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RequiredSearchParams requiredSearchParams = (RequiredSearchParams) o; - return Objects.equals(this.query, requiredSearchParams.query); - } - - @Override - public int hashCode() { - return Objects.hash(query); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RequiredSearchParams {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueries.java deleted file mode 100644 index a9b60e02a6..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueries.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.algolia.model.search; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** MultipleQueries */ -public class MultipleQueries { - - @SerializedName("indexName") - private String indexName; - - @SerializedName("query") - private String query = ""; - - @SerializedName("type") - private MultipleQueriesType type = MultipleQueriesType.DEFAULT; - - @SerializedName("facet") - private String facet; - - @SerializedName("params") - private String params; - - public MultipleQueries setIndexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - * The Algolia index name. - * - * @return indexName - */ - @javax.annotation.Nonnull - public String getIndexName() { - return indexName; - } - - public MultipleQueries setQuery(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nullable - public String getQuery() { - return query; - } - - public MultipleQueries setType(MultipleQueriesType type) { - this.type = type; - return this; - } - - /** - * Get type - * - * @return type - */ - @javax.annotation.Nullable - public MultipleQueriesType getType() { - return type; - } - - public MultipleQueries setFacet(String facet) { - this.facet = facet; - return this; - } - - /** - * The `facet` name. - * - * @return facet - */ - @javax.annotation.Nullable - public String getFacet() { - return facet; - } - - public MultipleQueries setParams(String params) { - this.params = params; - return this; - } - - /** - * A query string of search parameters. - * - * @return params - */ - @javax.annotation.Nullable - public String getParams() { - return params; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultipleQueries multipleQueries = (MultipleQueries) o; - return ( - Objects.equals(this.indexName, multipleQueries.indexName) && - Objects.equals(this.query, multipleQueries.query) && - Objects.equals(this.type, multipleQueries.type) && - Objects.equals(this.facet, multipleQueries.facet) && - Objects.equals(this.params, multipleQueries.params) - ); - } - - @Override - public int hashCode() { - return Objects.hash(indexName, query, type, facet, params); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MultipleQueries {\n"); - sb - .append(" indexName: ") - .append(toIndentedString(indexName)) - .append("\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesParams.java deleted file mode 100644 index d7de433462..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesParams.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.algolia.model.search; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** MultipleQueriesParams */ -public class MultipleQueriesParams { - - @SerializedName("requests") - private List requests = new ArrayList<>(); - - @SerializedName("strategy") - private MultipleQueriesStrategy strategy; - - public MultipleQueriesParams setRequests(List requests) { - this.requests = requests; - return this; - } - - public MultipleQueriesParams addRequests(MultipleQueries requestsItem) { - this.requests.add(requestsItem); - return this; - } - - /** - * Get requests - * - * @return requests - */ - @javax.annotation.Nonnull - public List getRequests() { - return requests; - } - - public MultipleQueriesParams setStrategy(MultipleQueriesStrategy strategy) { - this.strategy = strategy; - return this; - } - - /** - * Get strategy - * - * @return strategy - */ - @javax.annotation.Nullable - public MultipleQueriesStrategy getStrategy() { - return strategy; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultipleQueriesParams multipleQueriesParams = (MultipleQueriesParams) o; - return ( - Objects.equals(this.requests, multipleQueriesParams.requests) && - Objects.equals(this.strategy, multipleQueriesParams.strategy) - ); - } - - @Override - public int hashCode() { - return Objects.hash(requests, strategy); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MultipleQueriesParams {\n"); - sb.append(" requests: ").append(toIndentedString(requests)).append("\n"); - sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesResponse.java deleted file mode 100644 index c6e72805f2..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesResponse.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.algolia.model.search; - -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** MultipleQueriesResponse */ -public class MultipleQueriesResponse { - - @SerializedName("results") - private List results = null; - - public MultipleQueriesResponse setResults(List results) { - this.results = results; - return this; - } - - public MultipleQueriesResponse addResults(SearchResponse resultsItem) { - if (this.results == null) { - this.results = new ArrayList<>(); - } - this.results.add(resultsItem); - return this; - } - - /** - * Get results - * - * @return results - */ - @javax.annotation.Nullable - public List getResults() { - return results; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultipleQueriesResponse multipleQueriesResponse = (MultipleQueriesResponse) o; - return Objects.equals(this.results, multipleQueriesResponse.results); - } - - @Override - public int hashCode() { - return Objects.hash(results); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MultipleQueriesResponse {\n"); - sb.append(" results: ").append(toIndentedString(results)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesStrategy.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesStrategy.java deleted file mode 100644 index 446e340f26..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesStrategy.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.algolia.model.search; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** Gets or Sets multipleQueriesStrategy */ -@JsonAdapter(MultipleQueriesStrategy.Adapter.class) -public enum MultipleQueriesStrategy { - NONE("none"), - - STOP_IF_ENOUGH_MATCHES("stopIfEnoughMatches"); - - private final String value; - - MultipleQueriesStrategy(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static MultipleQueriesStrategy fromValue(String value) { - for (MultipleQueriesStrategy b : MultipleQueriesStrategy.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final MultipleQueriesStrategy enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MultipleQueriesStrategy read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return MultipleQueriesStrategy.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesType.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesType.java deleted file mode 100644 index c08f3139f0..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/MultipleQueriesType.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.algolia.model.search; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -/** Perform a search query with `default`, will search for facet values if `facet` is given. */ -@JsonAdapter(MultipleQueriesType.Adapter.class) -public enum MultipleQueriesType { - DEFAULT("default"), - - FACET("facet"); - - private final String value; - - MultipleQueriesType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static MultipleQueriesType fromValue(String value) { - for (MultipleQueriesType b : MultipleQueriesType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final MultipleQueriesType enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MultipleQueriesType read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return MultipleQueriesType.fromValue(value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/RequiredSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/RequiredSearchParams.java deleted file mode 100644 index d94b3d223f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/search/RequiredSearchParams.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.algolia.model.search; - -import com.google.gson.annotations.SerializedName; -import java.util.Objects; - -/** RequiredSearchParams */ -public class RequiredSearchParams { - - @SerializedName("query") - private String query = ""; - - public RequiredSearchParams setQuery(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RequiredSearchParams requiredSearchParams = (RequiredSearchParams) o; - return Objects.equals(this.query, requiredSearchParams.query); - } - - @Override - public int hashCode() { - return Objects.hash(query); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RequiredSearchParams {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueries.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueries.ts deleted file mode 100644 index 1096b0c8fa..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueries.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { MultipleQueriesType } from './multipleQueriesType'; - -export type MultipleQueries = { - /** - * The Algolia index name. - */ - indexName: string; - /** - * The text to search in the index. - */ - query?: string; - type?: MultipleQueriesType; - /** - * The `facet` name. - */ - facet?: string; - /** - * A query string of search parameters. - */ - params?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesParams.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesParams.ts deleted file mode 100644 index eef22ed29f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { MultipleQueries } from './multipleQueries'; -import type { MultipleQueriesStrategy } from './multipleQueriesStrategy'; - -export type MultipleQueriesParams = { - requests: MultipleQueries[]; - strategy?: MultipleQueriesStrategy; -}; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesResponse.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesResponse.ts deleted file mode 100644 index 7d96feba7b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { SearchResponse } from './searchResponse'; - -export type MultipleQueriesResponse = { - results?: SearchResponse[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesStrategy.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesStrategy.ts deleted file mode 100644 index 5090359e8e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesStrategy.ts +++ /dev/null @@ -1 +0,0 @@ -export type MultipleQueriesStrategy = 'none' | 'stopIfEnoughMatches'; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesType.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesType.ts deleted file mode 100644 index 470705f633..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/multipleQueriesType.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Perform a search query with `default`, will search for facet values if `facet` is given. - */ -export type MultipleQueriesType = 'default' | 'facet'; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/requiredSearchParams.ts deleted file mode 100644 index 411ca99b94..0000000000 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/requiredSearchParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RequiredSearchParams = { - /** - * The text to search in the index. - */ - query: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts deleted file mode 100644 index 1096b0c8fa..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueries.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { MultipleQueriesType } from './multipleQueriesType'; - -export type MultipleQueries = { - /** - * The Algolia index name. - */ - indexName: string; - /** - * The text to search in the index. - */ - query?: string; - type?: MultipleQueriesType; - /** - * The `facet` name. - */ - facet?: string; - /** - * A query string of search parameters. - */ - params?: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts deleted file mode 100644 index eef22ed29f..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesParams.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { MultipleQueries } from './multipleQueries'; -import type { MultipleQueriesStrategy } from './multipleQueriesStrategy'; - -export type MultipleQueriesParams = { - requests: MultipleQueries[]; - strategy?: MultipleQueriesStrategy; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts deleted file mode 100644 index 7d96feba7b..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesResponse.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { SearchResponse } from './searchResponse'; - -export type MultipleQueriesResponse = { - results?: SearchResponse[]; -}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts deleted file mode 100644 index 5090359e8e..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesStrategy.ts +++ /dev/null @@ -1 +0,0 @@ -export type MultipleQueriesStrategy = 'none' | 'stopIfEnoughMatches'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts deleted file mode 100644 index 470705f633..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/multipleQueriesType.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Perform a search query with `default`, will search for facet values if `facet` is given. - */ -export type MultipleQueriesType = 'default' | 'facet'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts deleted file mode 100644 index 411ca99b94..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/requiredSearchParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RequiredSearchParams = { - /** - * The text to search in the index. - */ - query: string; -}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts deleted file mode 100644 index 411ca99b94..0000000000 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/requiredSearchParams.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RequiredSearchParams = { - /** - * The text to search in the index. - */ - query: string; -}; diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/RequiredSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RequiredSearchParams.php deleted file mode 100644 index 033771d005..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Recommend/RequiredSearchParams.php +++ /dev/null @@ -1,216 +0,0 @@ - 'string', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $modelFormats = [ - 'query' => null, - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'query' => 'setQuery', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'query' => 'getQuery', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(array $data = null) - { - if (isset($data['query'])) { - $this->container['query'] = $data['query']; - } - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ( - !isset($this->container['query']) || - $this->container['query'] === null - ) { - $invalidProperties[] = "'query' can't be null"; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** - * Gets query - * - * @return string - */ - public function getQuery() - { - return $this->container['query'] ?? null; - } - - /** - * Sets query - * - * @param string $query the text to search in the index - * - * @return self - */ - public function setQuery($query) - { - $this->container['query'] = $query; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - * - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return mixed|null - */ - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueries.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueries.php deleted file mode 100644 index 6dfea55f00..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueries.php +++ /dev/null @@ -1,340 +0,0 @@ - 'string', - 'query' => 'string', - 'type' => '\Algolia\AlgoliaSearch\Model\Search\MultipleQueriesType', - 'facet' => 'string', - 'params' => 'string', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $modelFormats = [ - 'indexName' => null, - 'query' => null, - 'type' => null, - 'facet' => null, - 'params' => null, - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'indexName' => 'setIndexName', - 'query' => 'setQuery', - 'type' => 'setType', - 'facet' => 'setFacet', - 'params' => 'setParams', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'indexName' => 'getIndexName', - 'query' => 'getQuery', - 'type' => 'getType', - 'facet' => 'getFacet', - 'params' => 'getParams', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(array $data = null) - { - if (isset($data['indexName'])) { - $this->container['indexName'] = $data['indexName']; - } - if (isset($data['query'])) { - $this->container['query'] = $data['query']; - } - if (isset($data['type'])) { - $this->container['type'] = $data['type']; - } - if (isset($data['facet'])) { - $this->container['facet'] = $data['facet']; - } - if (isset($data['params'])) { - $this->container['params'] = $data['params']; - } - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ( - !isset($this->container['indexName']) || - $this->container['indexName'] === null - ) { - $invalidProperties[] = "'indexName' can't be null"; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** - * Gets indexName - * - * @return string - */ - public function getIndexName() - { - return $this->container['indexName'] ?? null; - } - - /** - * Sets indexName - * - * @param string $indexName the Algolia index name - * - * @return self - */ - public function setIndexName($indexName) - { - $this->container['indexName'] = $indexName; - - return $this; - } - - /** - * Gets query - * - * @return string|null - */ - public function getQuery() - { - return $this->container['query'] ?? null; - } - - /** - * Sets query - * - * @param string|null $query the text to search in the index - * - * @return self - */ - public function setQuery($query) - { - $this->container['query'] = $query; - - return $this; - } - - /** - * Gets type - * - * @return \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesType|null - */ - public function getType() - { - return $this->container['type'] ?? null; - } - - /** - * Sets type - * - * @param \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesType|null $type type - * - * @return self - */ - public function setType($type) - { - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets facet - * - * @return string|null - */ - public function getFacet() - { - return $this->container['facet'] ?? null; - } - - /** - * Sets facet - * - * @param string|null $facet the `facet` name - * - * @return self - */ - public function setFacet($facet) - { - $this->container['facet'] = $facet; - - return $this; - } - - /** - * Gets params - * - * @return string|null - */ - public function getParams() - { - return $this->container['params'] ?? null; - } - - /** - * Sets params - * - * @param string|null $params a query string of search parameters - * - * @return self - */ - public function setParams($params) - { - $this->container['params'] = $params; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - * - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return mixed|null - */ - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesParams.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesParams.php deleted file mode 100644 index 3b34125292..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesParams.php +++ /dev/null @@ -1,247 +0,0 @@ - '\Algolia\AlgoliaSearch\Model\Search\MultipleQueries[]', - 'strategy' => '\Algolia\AlgoliaSearch\Model\Search\MultipleQueriesStrategy', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $modelFormats = [ - 'requests' => null, - 'strategy' => null, - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'requests' => 'setRequests', - 'strategy' => 'setStrategy', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'requests' => 'getRequests', - 'strategy' => 'getStrategy', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(array $data = null) - { - if (isset($data['requests'])) { - $this->container['requests'] = $data['requests']; - } - if (isset($data['strategy'])) { - $this->container['strategy'] = $data['strategy']; - } - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ( - !isset($this->container['requests']) || - $this->container['requests'] === null - ) { - $invalidProperties[] = "'requests' can't be null"; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** - * Gets requests - * - * @return \Algolia\AlgoliaSearch\Model\Search\MultipleQueries[] - */ - public function getRequests() - { - return $this->container['requests'] ?? null; - } - - /** - * Sets requests - * - * @param \Algolia\AlgoliaSearch\Model\Search\MultipleQueries[] $requests requests - * - * @return self - */ - public function setRequests($requests) - { - $this->container['requests'] = $requests; - - return $this; - } - - /** - * Gets strategy - * - * @return \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesStrategy|null - */ - public function getStrategy() - { - return $this->container['strategy'] ?? null; - } - - /** - * Sets strategy - * - * @param \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesStrategy|null $strategy strategy - * - * @return self - */ - public function setStrategy($strategy) - { - $this->container['strategy'] = $strategy; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - * - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return mixed|null - */ - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesResponse.php deleted file mode 100644 index 29d66d17a3..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesResponse.php +++ /dev/null @@ -1,209 +0,0 @@ - '\Algolia\AlgoliaSearch\Model\Search\SearchResponse[]', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $modelFormats = [ - 'results' => null, - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'results' => 'setResults', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'results' => 'getResults', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(array $data = null) - { - if (isset($data['results'])) { - $this->container['results'] = $data['results']; - } - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** - * Gets results - * - * @return \Algolia\AlgoliaSearch\Model\Search\SearchResponse[]|null - */ - public function getResults() - { - return $this->container['results'] ?? null; - } - - /** - * Sets results - * - * @param \Algolia\AlgoliaSearch\Model\Search\SearchResponse[]|null $results results - * - * @return self - */ - public function setResults($results) - { - $this->container['results'] = $results; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - * - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return mixed|null - */ - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesStrategy.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesStrategy.php deleted file mode 100644 index 216d07cab3..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesStrategy.php +++ /dev/null @@ -1,29 +0,0 @@ - 'string', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $modelFormats = [ - 'query' => null, - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'query' => 'setQuery', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'query' => 'getQuery', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(array $data = null) - { - if (isset($data['query'])) { - $this->container['query'] = $data['query']; - } - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ( - !isset($this->container['query']) || - $this->container['query'] === null - ) { - $invalidProperties[] = "'query' can't be null"; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** - * Gets query - * - * @return string - */ - public function getQuery() - { - return $this->container['query'] ?? null; - } - - /** - * Sets query - * - * @param string $query the text to search in the index - * - * @return self - */ - public function setQuery($query) - { - $this->container['query'] = $query; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - * - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return mixed|null - */ - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } -} diff --git a/playground/java/src/main/java/com/algolia/playground/Search.java b/playground/java/src/main/java/com/algolia/playground/Search.java index b1b93726c9..f8bc911af3 100644 --- a/playground/java/src/main/java/com/algolia/playground/Search.java +++ b/playground/java/src/main/java/com/algolia/playground/Search.java @@ -1,18 +1,19 @@ package com.algolia.playground; +import com.algolia.api.SearchClient; import com.algolia.exceptions.AlgoliaApiException; import com.algolia.exceptions.AlgoliaRetryException; import com.algolia.exceptions.AlgoliaRuntimeException; import com.algolia.model.search.*; -import com.algolia.api.SearchClient; import com.algolia.utils.AlgoliaAgent; import io.github.cdimascio.dotenv.Dotenv; +import java.lang.InterruptedException; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import java.lang.InterruptedException; public class Search { - + public static void main(String[] args) { Dotenv dotenv = Dotenv.configure().directory("../").load(); @@ -27,21 +28,27 @@ public static void main(String[] args) { ); String indexName = dotenv.get("SEARCH_INDEX"); - SearchParamsObject params = new SearchParamsObject(); - params.setAroundRadius(AroundRadius.ofInteger(5)); - params.setQuery(dotenv.get("SEARCH_QUERY")); + String query = dotenv.get("SEARCH_QUERY"); try { - CompletableFuture result = client.searchAsync( - indexName, - SearchParams.ofSearchParamsObject(params) + SearchMethodParams searchMethodParams = new SearchMethodParams(); + List requests = new ArrayList<>(); + SearchQueries request = new SearchQueries(); + request.setIndexName(indexName); + request.setQuery(query); + requests.add(request); + searchMethodParams.setRequests(requests); + + CompletableFuture result = client.searchAsync( + searchMethodParams ); - SearchResponse sr = result.get(); + + SearchResponses sr = result.get(); System.out.println(sr); - } catch(InterruptedException e) { + } catch (InterruptedException e) { System.err.println("InterrupedException" + e.getMessage()); e.printStackTrace(); - } catch(ExecutionException e) { + } catch (ExecutionException e) { System.err.println("ExecutionException" + e.getMessage()); e.printStackTrace(); } catch (AlgoliaApiException e) { diff --git a/playground/javascript/node/search.ts b/playground/javascript/node/search.ts index 3f77099c0d..433c475de0 100644 --- a/playground/javascript/node/search.ts +++ b/playground/javascript/node/search.ts @@ -18,8 +18,12 @@ client.addAlgoliaAgent('Node playground', '0.0.1'); async function testSearch() { try { const res = await client.search({ - indexName: searchIndex, - searchParams: { query: searchQuery }, + requests: [ + { + indexName: searchIndex, + query: searchQuery, + }, + ], }); console.log(`[OK]`, res); diff --git a/playground/php/src/search.php b/playground/php/src/search.php index 3c4556e838..685e6305c2 100644 --- a/playground/php/src/search.php +++ b/playground/php/src/search.php @@ -4,7 +4,16 @@ use Algolia\AlgoliaSearch\Api\SearchClient; -$client = SearchClient::create(getenv('ALGOLIA_APPLICATION_ID'), getenv('ALGOLIA_ADMIN_KEY')); +$client = SearchClient::create( + getenv('ALGOLIA_APPLICATION_ID'), + getenv('ALGOLIA_ADMIN_KEY') +); $indexName = getenv('SEARCH_INDEX'); -var_dump($client->search($indexName, ['query' => getenv('SEARCH_QUERY')])); +var_dump( + $client->search([ + 'requests' => [ + ['indexName' => $indexName, 'query' => getenv('SEARCH_QUERY')], + ], + ]) +); diff --git a/specs/common/schemas/SearchParams.yml b/specs/common/schemas/SearchParams.yml index d83e550b5c..dd206ee9be 100644 --- a/specs/common/schemas/SearchParams.yml +++ b/specs/common/schemas/SearchParams.yml @@ -6,22 +6,14 @@ searchParams: searchParamsObject: allOf: - $ref: '#/baseSearchParams' - - $ref: '#/requiredSearchParams' - $ref: '../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams' -requiredSearchParams: +baseSearchParams: type: object additionalProperties: false - required: - - query properties: query: $ref: '#/query' - -baseSearchParams: - type: object - additionalProperties: false - properties: similarQuery: type: string description: Overrides the query parameter and performs a more generic search that can be used to find "similar" results. diff --git a/specs/search/common/enums.yml b/specs/search/common/enums.yml index 71574ed674..8ed8cbcdec 100644 --- a/specs/search/common/enums.yml +++ b/specs/search/common/enums.yml @@ -1,10 +1,10 @@ -multipleQueriesType: +searchType: type: string enum: [default, facet] default: default description: Perform a search query with `default`, will search for facet values if `facet` is given. -multipleQueriesStrategy: +searchStrategy: type: string enum: [none, stopIfEnoughMatches] diff --git a/specs/search/common/schemas/SearchResponse.yml b/specs/search/common/schemas/SearchResponse.yml index b832c1aaa2..5dfe5c10b4 100644 --- a/specs/search/common/schemas/SearchResponse.yml +++ b/specs/search/common/schemas/SearchResponse.yml @@ -1,4 +1,4 @@ -searchResponse: +SearchResponse: allOf: - $ref: '#/baseSearchResponse' - $ref: '#/searchHits' diff --git a/specs/search/paths/search/multipleQueries.yml b/specs/search/paths/search/multipleQueries.yml deleted file mode 100644 index 049d504b24..0000000000 --- a/specs/search/paths/search/multipleQueries.yml +++ /dev/null @@ -1,63 +0,0 @@ -post: - tags: - - Search - operationId: multipleQueries - summary: Search multiple indices. - description: Perform a search operation targeting one or many indices. - requestBody: - required: true - description: The `multipleQueries` requests and strategy. - content: - application/json: - schema: - title: multipleQueriesParams - type: object - additionalProperties: false - properties: - requests: - type: array - items: - title: multipleQueries - type: object - additionalProperties: false - properties: - indexName: - $ref: '../../../common/parameters.yml#/indexName' - query: - $ref: '../../../common/schemas/SearchParams.yml#/query' - type: - $ref: '../../common/enums.yml#/multipleQueriesType' - facet: - type: string - description: The `facet` name. - params: - type: string - description: A query string of search parameters. - required: - - indexName - strategy: - $ref: '../../common/enums.yml#/multipleQueriesStrategy' - required: - - requests - responses: - '200': - description: OK - content: - application/json: - schema: - title: multipleQueriesResponse - type: object - additionalProperties: false - properties: - results: - type: array - items: - $ref: '../../common/schemas/SearchResponse.yml#/searchResponse' - '400': - $ref: '../../../common/responses/BadRequest.yml' - '402': - $ref: '../../../common/responses/FeatureNotEnabled.yml' - '403': - $ref: '../../../common/responses/MethodNotAllowed.yml' - '404': - $ref: '../../../common/responses/IndexNotFound.yml' diff --git a/specs/search/paths/search/search.yml b/specs/search/paths/search/search.yml index 977cea7184..7aac6b594a 100644 --- a/specs/search/paths/search/search.yml +++ b/specs/search/paths/search/search.yml @@ -2,23 +2,56 @@ post: tags: - Search operationId: search - summary: Search in an index. - description: Perform a search operation targeting one specific index. - parameters: - - $ref: '../../../common/parameters.yml#/IndexName' + summary: Search multiple indices. + description: Perform a search operation targeting one or many indices. requestBody: required: true + description: The `search` requests and strategy. content: application/json: schema: - $ref: '../../../common/schemas/SearchParams.yml#/searchParams' + title: searchMethodParams + type: object + additionalProperties: false + properties: + requests: + type: array + items: + title: searchQueries + type: object + additionalProperties: false + properties: + indexName: + $ref: '../../../common/parameters.yml#/indexName' + query: + $ref: '../../../common/schemas/SearchParams.yml#/query' + type: + $ref: '../../common/enums.yml#/searchType' + facet: + type: string + description: The `facet` name. + params: + $ref: '../../../common/schemas/SearchParams.yml#/searchParams' + required: + - indexName + strategy: + $ref: '../../common/enums.yml#/searchStrategy' + required: + - requests responses: '200': description: OK content: application/json: schema: - $ref: '../../common/schemas/SearchResponse.yml#/searchResponse' + title: searchResponses + type: object + additionalProperties: false + properties: + results: + type: array + items: + $ref: '../../common/schemas/SearchResponse.yml#/SearchResponse' '400': $ref: '../../../common/responses/BadRequest.yml' '402': diff --git a/specs/search/paths/search/searchSingleIndex.yml b/specs/search/paths/search/searchSingleIndex.yml new file mode 100644 index 0000000000..104ff5bcdb --- /dev/null +++ b/specs/search/paths/search/searchSingleIndex.yml @@ -0,0 +1,29 @@ +post: + tags: + - Search + operationId: searchSingleIndex + summary: Search in a single index. + description: Perform a search operation targeting one specific index. + parameters: + - $ref: '../../../common/parameters.yml#/IndexName' + requestBody: + required: true + content: + application/json: + schema: + $ref: '../../../common/schemas/SearchParams.yml#/searchParams' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../common/schemas/SearchResponse.yml#/SearchResponse' + '400': + $ref: '../../../common/responses/BadRequest.yml' + '402': + $ref: '../../../common/responses/FeatureNotEnabled.yml' + '403': + $ref: '../../../common/responses/MethodNotAllowed.yml' + '404': + $ref: '../../../common/responses/IndexNotFound.yml' diff --git a/specs/search/spec.yml b/specs/search/spec.yml index 1656fbd377..9ccb79a464 100644 --- a/specs/search/spec.yml +++ b/specs/search/spec.yml @@ -89,9 +89,9 @@ paths: # ### Search Endpoints ### # ######################## /1/indexes/{indexName}/query: - $ref: 'paths/search/search.yml' + $ref: 'paths/search/searchSingleIndex.yml' /1/indexes/*/queries: - $ref: 'paths/search/multipleQueries.yml' + $ref: 'paths/search/search.yml' /1/indexes/{indexName}/facets/{facetName}/query: $ref: 'paths/search/searchForFacetValues.yml' /1/indexes/{indexName}/browse: diff --git a/tests/CTS/client/search/api.json b/tests/CTS/client/search/api.json index 83c38f3fed..daf1358dc0 100644 --- a/tests/CTS/client/search/api.json +++ b/tests/CTS/client/search/api.json @@ -8,8 +8,11 @@ "path": "search", "parameters": [ { - "indexName": "my-index", - "searchParams": {} + "requests": [ + { + "indexName": "my-index" + } + ] } ], "expected": { @@ -31,8 +34,11 @@ "path": "search", "parameters": [ { - "indexName": "my-index", - "searchParams": {} + "requests": [ + { + "indexName": "my-index" + } + ] } ], "expected": { @@ -53,8 +59,11 @@ "path": "search", "parameters": [ { - "indexName": "my-index", - "searchParams": {} + "requests": [ + { + "indexName": "my-index" + } + ] } ], "expected": { diff --git a/tests/CTS/methods/requests/search/multipleQueries.json b/tests/CTS/methods/requests/search/multipleQueries.json deleted file mode 100644 index f73c4713a7..0000000000 --- a/tests/CTS/methods/requests/search/multipleQueries.json +++ /dev/null @@ -1,68 +0,0 @@ -[ - { - "testName": "multipleQueries for a single request with minimal parameters", - "parameters": { - "requests": [ - { - "indexName": "theIndexName" - } - ], - "strategy": "stopIfEnoughMatches" - }, - "request": { - "path": "/1/indexes/*/queries", - "method": "POST", - "body": { - "requests": [ - { - "indexName": "theIndexName" - } - ], - "strategy": "stopIfEnoughMatches" - } - } - }, - { - "testName": "multipleQueries for multiple requests with all parameters", - "parameters": { - "requests": [ - { - "indexName": "theIndexName", - "query": "test", - "type": "facet", - "facet": "theFacet", - "params": "testParam" - }, - { - "indexName": "theIndexName", - "query": "test", - "type": "default", - "params": "testParam" - } - ], - "strategy": "stopIfEnoughMatches" - }, - "request": { - "path": "/1/indexes/*/queries", - "method": "POST", - "body": { - "requests": [ - { - "indexName": "theIndexName", - "query": "test", - "type": "facet", - "facet": "theFacet", - "params": "testParam" - }, - { - "indexName": "theIndexName", - "query": "test", - "type": "default", - "params": "testParam" - } - ], - "strategy": "stopIfEnoughMatches" - } - } - } -] diff --git a/tests/CTS/methods/requests/search/search.json b/tests/CTS/methods/requests/search/search.json index cb550a42d8..57eb132fb8 100644 --- a/tests/CTS/methods/requests/search/search.json +++ b/tests/CTS/methods/requests/search/search.json @@ -1,40 +1,108 @@ [ { - "testName": "search with minimal parameters", + "testName": "search for a single request with minimal parameters", "parameters": { - "indexName": "indexName", - "searchParams": { - "query": "myQuery" - } + "requests": [ + { + "indexName": "theIndexName" + } + ] }, "request": { - "path": "/1/indexes/indexName/query", + "path": "/1/indexes/*/queries", "method": "POST", "body": { - "query": "myQuery" + "requests": [ + { + "indexName": "theIndexName" + } + ] } } }, { - "method": "search", - "testName": "search with facetFilters", + "testName": "search for a single request with all parameters", "parameters": { - "indexName": "indexName", - "searchParams": { - "query": "myQuery", - "facetFilters": [ - "tags:algolia" - ] + "requests": [ + { + "indexName": "theIndexName", + "query": "test", + "type": "facet", + "facet": "theFacet", + "params": { + "hitsPerPage": 50 + } + } + ], + "strategy": "stopIfEnoughMatches" + }, + "request": { + "path": "/1/indexes/*/queries", + "method": "POST", + "body": { + "requests": [ + { + "indexName": "theIndexName", + "query": "test", + "type": "facet", + "facet": "theFacet", + "params": { + "hitsPerPage": 50 + } + } + ], + "strategy": "stopIfEnoughMatches" } + } + }, + { + "testName": "search for multiple requests in multiple indices with all parameters", + "parameters": { + "requests": [ + { + "indexName": "theIndexName", + "query": "test", + "type": "facet", + "facet": "theFacet", + "params": { + "hitsPerPage": 50 + } + }, + { + "indexName": "theIndexName2", + "query": "test", + "type": "default", + "params": { + "hitsPerPage": 100 + } + } + ], + "strategy": "stopIfEnoughMatches" }, "request": { - "path": "/1/indexes/indexName/query", + "path": "/1/indexes/*/queries", "method": "POST", "body": { - "query": "myQuery", - "facetFilters": [ - "tags:algolia" - ] + "requests": [ + { + "indexName": "theIndexName", + "query": "test", + "type": "facet", + "facet": "theFacet", + "params": { + "hitsPerPage": 50 + } + }, + { + "indexName": "theIndexName2", + "query": "test", + "type": "default", + "params": { + "hitsPerPage": 100 + } + } + ], + "strategy": "stopIfEnoughMatches" } } } diff --git a/tests/CTS/methods/requests/search/searchSingleIndex.json b/tests/CTS/methods/requests/search/searchSingleIndex.json new file mode 100644 index 0000000000..cb550a42d8 --- /dev/null +++ b/tests/CTS/methods/requests/search/searchSingleIndex.json @@ -0,0 +1,41 @@ +[ + { + "testName": "search with minimal parameters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "myQuery" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "myQuery" + } + } + }, + { + "method": "search", + "testName": "search with facetFilters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "myQuery", + "facetFilters": [ + "tags:algolia" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "myQuery", + "facetFilters": [ + "tags:algolia" + ] + } + } + } +] diff --git a/website/docs/api-clients/guides/filtering-your-search.mdx b/website/docs/api-clients/guides/filtering-your-search.mdx index 180aff3fed..be3bfdaf31 100644 --- a/website/docs/api-clients/guides/filtering-your-search.mdx +++ b/website/docs/api-clients/guides/filtering-your-search.mdx @@ -45,6 +45,7 @@ $client->setSettings( ['attributesForFaceting' => ['actor', 'filterOnly(category)', 'searchable(publisher)']] ); ``` + @@ -67,29 +68,41 @@ The actual filtering of records is performed at query time, not at indexing time ```js // Only "Scarlett Johansson" actor await client.search({ - indexName: '', - searchParams: { - query: '', - filters: 'actor:Scarlett Johansson', - }, + requests: [ + { + indexName: '', + query: '', + params: { + filters: 'actor:Scarlett Johansson', + }, + }, + ], }); // Only "Tom Cruise" or "Scarlett Johansson" actor await client.search({ - indexName: '', - searchParams: { - query: '', - filters: 'actor:Tom Cruise OR actor:Scarlett Johansson', - }, + requests: [ + { + indexName: '', + query: '', + params: { + filters: 'actor:Tom Cruise OR actor:Scarlett Johansson', + }, + }, + ], }); // Everything but "Nicolas Cage" actor await client.search({ - indexName: '', - searchParams: { - query: '', - filters: 'NOT actor:Nicolas Cage', - }, + requests: [ + { + indexName: '', + query: '', + params: { + filters: 'NOT actor:Nicolas Cage', + }, + }, + ], }); ``` @@ -98,33 +111,39 @@ await client.search({ ```php // Only "Scarlett Johansson" actor -$client->search( - '', - [ - 'query' => '', - 'filters' => 'actor:Scarlett Johansson', - ] -); +$client->search([ + 'requests' => [ + [ + 'indexName' => '', + 'query' => '', + 'params' => ['filters' => 'actor:Scarlett Johansson'], + ], + ], +]); // Only "Tom Cruise" or "Scarlett Johansson" actor -$client->search( - '', - [ - 'query' => '', - 'filters' => 'actor:Tom Cruise OR actor:Scarlett Johansson', - ] -); +$client->search([ + 'requests' => [ + [ + 'indexName' => '', + 'query' => '', + 'params' => ['filters' => 'actor:Tom Cruise OR actor:Scarlett Johansson'], + ], + ], +]); // Everything but "Nicolas Cage" actor -$client->search( - '', - [ - 'query' => '', - 'filters' => 'NOT actor:Nicolas Cage', - ] -); - +$client->search([ + 'requests' => [ + [ + 'indexName' => '', + 'query' => '', + 'params' => ['filters' => 'NOT actor:Nicolas Cage'], + ], + ], +]); ``` + @@ -165,22 +184,27 @@ await client.search({ ```php // Only "Scarlett Johansson" actor -$client->search( - '', - [ - 'query' => '', - 'facetFilters' => ['actor:Scarlett Johansson'], - ] -); +$client->search([ + 'requests' => [ + [ + 'indexName' => '', + 'query' => '', + 'params' => ['facetFilters' => ['actor:Scarlett Johansson']], + ], + ], +]); // Only "Tom Cruise" or "Scarlett Johansson" actor -$client->search( - '', - [ - 'query' => '', - 'facetFilters' => ['actor:Tom Cruise', 'actor:Scarlett Johansson'], - ] -); +$client->search([ + 'requests' => [ + [ + 'indexName' => '', + 'query' => '', + 'params' => ['facetFilters' => ['actor:Tom Cruise', 'actor:Scarlett Johansson']], + ], + ], +]); ``` + diff --git a/website/docs/api-clients/guides/retrieving-facets.mdx b/website/docs/api-clients/guides/retrieving-facets.mdx index 6b54580c84..a69293e799 100644 --- a/website/docs/api-clients/guides/retrieving-facets.mdx +++ b/website/docs/api-clients/guides/retrieving-facets.mdx @@ -23,11 +23,15 @@ For example, you can retrieve your books' facets with the `search` method, and t ```js await client.search({ - indexName: '', - searchParams: { - query: '', - facets: ['author', 'genre'], - }, + requests: [ + { + indexName: '', + query: '', + params: { + facets: ['author', 'genre'], + }, + }, + ], }); ``` @@ -35,11 +39,15 @@ To extract all facet information, you can use a wildcard (`*`). ```js await client.search({ - indexName: '', - searchParams: { - query: '', - facets: ['*'], - }, + requests: [ + { + indexName: '', + query: '', + params: { + facets: ['*'], + }, + }, + ], }); ``` @@ -48,25 +56,29 @@ await client.search({ ```php -$client->search( - '', - [ - 'query' => '', - 'facets' => ['author', 'genre'], - ] -); +$client->search([ + 'requests' => [ + [ + 'indexName' => '', + 'query' => '', + 'params' => ['facets' => ['author', 'genre']], + ], + ], +]); ``` To extract all facet information, you can use a wildcard (`*`). ```php -$client->search( - '', - [ - 'query' => '', - 'facets' => ['*'], - ] -); +$client->search([ + 'requests' => [ + [ + 'indexName' => '', + 'query' => '', + 'params' => ['facets' => ['*']], + ], + ], +]); ``` diff --git a/website/docs/api-clients/installation.mdx b/website/docs/api-clients/installation.mdx index 2a33bbfc4b..1d00e5a500 100644 --- a/website/docs/api-clients/installation.mdx +++ b/website/docs/api-clients/installation.mdx @@ -42,8 +42,71 @@ Add the following JavaScript snippet to the `` of your website: ``` + + + + +First, install Algolia PHP API Client via the composer package manager: + +```bash +composer require algolia/algoliasearch-client-php +``` + + + + + +To get started, add the [algoliasearch-client-java](https://oss.sonatype.org/content/repositories/snapshots/com/algolia/algoliasearch-client-java/0.0.1-SNAPSHOT/) dependency to your project, either with [Maven](https://maven.apache.org/): + +```xml + + + oss.sonatype.org-snapshot + https://oss.sonatype.org/content/repositories/snapshots + + false + + + true + + + + + + com.algolia + algoliasearch-client-java + 0.0.1-SNAPSHOT + +``` + +or [Gradle](https://gradle.org/): + +```groovy +repositories() { + maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } +} + +dependencies { + testImplementation 'com.algolia:algoliasearch-client-java:0.0.1-SNAPSHOT' +} +``` + + + + ## Using the client + + + Then you need to import the correct package: ```js @@ -60,12 +123,16 @@ const personalizationClient = client.initPersonalization( ); const searchRes = await client.search({ - indexName: '', - searchParams: { query: searchQuery }, + requests: [ + { + indexName: '', + query: '', + }, + ], }); const analyticsRes = await analyticsClient.getTopFilterForAttribute({ attribute: 'myAttribute1,myAttribute2', - index: '', + index: '', }); console.log('[Results]', searchRes, analyticsRes); @@ -96,8 +163,12 @@ Once the client is setup, you can play with the Algolia API! ```js const res = await client.search({ - indexName: '', - searchParams: { query: 'words to query' }, + requests: [ + { + indexName: '', + query: '', + }, + ], }); console.log('[Results]', res); @@ -117,14 +188,6 @@ console.log('[Results]', res); -First, install Algolia PHP API Client via the composer package manager: - -```bash -composer require algolia/algoliasearch-client-php -``` - -## Using the client - Then, create objects on your index: ```php @@ -133,13 +196,17 @@ $client = Algolia\AlgoliaSearch\Api\SearchClient::create( '' ); -$client->saveObject('', ['objectID' => 1, 'name' => 'Foo']); +$client->saveObject('', ['objectID' => 1, 'name' => 'Foo']); ``` Finally, you may begin searching an object using the `search` method: ```php -$objects = $client->search('', ['query' => 'Foo']); +$client->search([ + 'requests' => [ + ['indexName' => '', 'query' => ''], + ], +]) ``` Another example with the personalization client: @@ -157,41 +224,6 @@ $res = $client->getUserTokenProfile(''); -To get started, add the [algoliasearch-client-java](https://oss.sonatype.org/content/repositories/snapshots/com/algolia/algoliasearch-client-java/0.0.1-SNAPSHOT/) dependency to your project, either with [Maven](https://maven.apache.org/): -```xml - - - oss.sonatype.org-snapshot - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - - - com.algolia - algoliasearch-client-java - 0.0.1-SNAPSHOT - -``` - -or [Gradle](https://gradle.org/): -```groovy -repositories() { - maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } -} - -dependencies { - testImplementation 'com.algolia:algoliasearch-client-java:0.0.1-SNAPSHOT' -} -``` - -## Using the client - The package is divided into multiples API Clients, you can find the list [here](https://github.com/algolia/algoliasearch-client-java-2/tree/next/algoliasearch-core/src/main/java/com/algolia/api). To instanciate a client, prepare your credentials and follow this example: @@ -199,37 +231,42 @@ To instanciate a client, prepare your credentials and follow this example: import com.algolia.api.SearchClient; public class AlgoliaTest { + public static void main(String[] args) { SearchClient client = new SearchClient("", ""); } } + ``` You can add segments to the `User Agent`: + ```java import com.algolia.utils.AlgoliaAgent; SearchClient client = new SearchClient( - "", + "", "", - new AlgoliaAgent.Segment[] { - new AlgoliaAgent.Segment("tracker", "8.0.0") + new AlgoliaAgent.Segment[] { + new AlgoliaAgent.Segment("tracker", "8.0.0") } ); ``` And also specify a custom `Requester`: + ```java import com.algolia.utils.echo.EchoRequester; SearchClient client = new SearchClient( - "", + "", "", new EchoRequester() ); ``` Or use a completely different client (some clients might require a `region` parameter): + ```java import com.algolia.api.AbtestingClient; @@ -241,13 +278,15 @@ Once the client is setup, you can play with the Algolia API! ```java import com.algolia.model.search.*; -SearchParamsObject params = new SearchParamsObject(); -params.setQuery("your query"); +SearchMethodParams searchMethodParams = new SearchMethodParams(); +SearchQueries requests = new SearchQueries(); +requests.setIndexName(""); +requests.setQuery(""); +searchMethodParams.setRequests(requests); try { SearchResponse result = client.search( - "the index name", - SearchParams.ofSearchParamsObject(params) + searchMethodParams ); System.out.println(result); } catch (AlgoliaRuntimeException e) { diff --git a/website/docs/api-clients/migration-guide.mdx b/website/docs/api-clients/migration-guide.mdx index 72d127ddc0..0f652533b4 100644 --- a/website/docs/api-clients/migration-guide.mdx +++ b/website/docs/api-clients/migration-guide.mdx @@ -38,11 +38,11 @@ For informations regarding the installation of the package, please see [the inst }> -| Previous | Latest | Description | -| -------------------- | :------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `@algolia` | `@experimental-api-clients-automation` | **During the beta phase**, the clients are available under the NPM `@experimental-api-clients-automation` namespace, you can find a full list [here](https://www.npmjs.com/org/experimental-api-clients-automation). | -| `algoliasearch/lite` | `algoliasearch-lite` | The lite version of the client now have [its own package](https://www.npmjs.com/package/@experimental-api-clients-automation/algoliasearch-lite). | -| `search` | `searchClient` | Exported clients are suffixed by `Client`. | +| Previous | Latest | Impacted clients | Description | +| -------------------- | :------------------------------------- | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `@algolia` | `@experimental-api-clients-automation` | JavaScript | **During the beta phase**, the clients are available under the NPM `@experimental-api-clients-automation` namespace, you can find a full list [here](https://www.npmjs.com/org/experimental-api-clients-automation). | +| `algoliasearch/lite` | `algoliasearch-lite` | JavaScript | The lite version of the client now have [its own package](https://www.npmjs.com/package/@experimental-api-clients-automation/algoliasearch-lite). | +| `search` | `searchClient` | all | Exported clients are suffixed by `Client`. | @@ -51,9 +51,9 @@ For informations regarding the installation of the package, please see [the inst @@ -95,9 +95,9 @@ You can continue this guide on [our installation page](/docs/api-clients/install @@ -111,18 +111,26 @@ const client = algoliasearch('', ''); // only query string const searchResults = await client.search({ - indexName: '', - searchParams: { query: 'myQuery' }, + requests: [ + { + indexName: '', + query: '', + }, + ], }); // with params const searchResults2 = await client.search({ - indexName: '', - searchParams: { - query: 'myQuery', - attributesToRetrieve: ['firstname', 'lastname'], - hitsPerPage: 50, - }, + requests: [ + { + indexName: '', + query: '', + params: { + attributesToRetrieve: ['firstname', 'lastname'], + hitsPerPage: 50, + }, + }, + ], }); ```