From 2a0eef2cf0672fc62168ad995f87c3f0bc167280 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Fri, 15 Nov 2024 14:47:10 +0000 Subject: [PATCH] fix(specs): make the searchParams compatible with v4 [skip-bc] (generated) https://github.com/algolia/api-clients-automation/pull/4108 Co-authored-by: algolia-bot Co-authored-by: Pierre Millot --- .../model/recommend/FallbackParams.java | 96 +++++---------- .../model/recommend/InsideBoundingBox.java | 111 ++++++++++++++++++ .../model/recommend/OptionalWords.java | 111 ++++++++++++++++++ .../recommend/RecommendSearchParams.java | 96 +++++---------- .../model/search/BrowseParamsObject.java | 75 ++---------- .../model/search/ConsequenceParams.java | 75 ++---------- .../algolia/model/search/DeleteByParams.java | 22 +--- .../algolia/model/search/IndexSettings.java | 74 ++++-------- .../model/search/InsideBoundingBox.java | 111 ++++++++++++++++++ .../algolia/model/search/OptionalWords.java | 111 ++++++++++++++++++ .../algolia/model/search/SearchForFacets.java | 96 +++++---------- .../algolia/model/search/SearchForHits.java | 75 ++---------- .../model/search/SearchParamsObject.java | 75 ++---------- .../model/search/SettingsResponse.java | 74 ++++-------- 14 files changed, 617 insertions(+), 585 deletions(-) create mode 100644 algoliasearch/src/main/java/com/algolia/model/recommend/InsideBoundingBox.java create mode 100644 algoliasearch/src/main/java/com/algolia/model/recommend/OptionalWords.java create mode 100644 algoliasearch/src/main/java/com/algolia/model/search/InsideBoundingBox.java create mode 100644 algoliasearch/src/main/java/com/algolia/model/search/OptionalWords.java diff --git a/algoliasearch/src/main/java/com/algolia/model/recommend/FallbackParams.java b/algoliasearch/src/main/java/com/algolia/model/recommend/FallbackParams.java index 6bd33fe7..aeb54c62 100644 --- a/algoliasearch/src/main/java/com/algolia/model/recommend/FallbackParams.java +++ b/algoliasearch/src/main/java/com/algolia/model/recommend/FallbackParams.java @@ -60,7 +60,7 @@ public class FallbackParams { private Integer minimumAroundRadius; @JsonProperty("insideBoundingBox") - private List> insideBoundingBox; + private InsideBoundingBox insideBoundingBox; @JsonProperty("insidePolygon") private List> insidePolygon; @@ -152,6 +152,9 @@ public class FallbackParams { @JsonProperty("attributeForDistinct") private String attributeForDistinct; + @JsonProperty("maxFacetHits") + private Integer maxFacetHits; + @JsonProperty("attributesToRetrieve") private List attributesToRetrieve; @@ -222,7 +225,7 @@ public class FallbackParams { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -248,9 +251,6 @@ public class FallbackParams { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -500,28 +500,14 @@ public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public FallbackParams setInsideBoundingBox(List> insideBoundingBox) { + public FallbackParams setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; return this; } - public FallbackParams addInsideBoundingBox(List insideBoundingBoxItem) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Coordinates for a rectangular area in which to search. Each bounding box is defined by the two - * opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 - * long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more - * information, see [rectangular - * area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). - */ + /** Get insideBoundingBox */ @javax.annotation.Nullable - public List> getInsideBoundingBox() { + public InsideBoundingBox getInsideBoundingBox() { return insideBoundingBox; } @@ -1120,6 +1106,21 @@ public String getAttributeForDistinct() { return attributeForDistinct; } + public FallbackParams setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet values to return when [searching for facet + * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + * maximum: 100 + */ + @javax.annotation.Nullable + public Integer getMaxFacetHits() { + return maxFacetHits; + } + public FallbackParams setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; return this; @@ -1507,38 +1508,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public FallbackParams setOptionalWords(List optionalWords) { + public FallbackParams setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public FallbackParams addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1705,21 +1682,6 @@ public List getResponseFields() { return responseFields; } - public FallbackParams setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public FallbackParams setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1858,6 +1820,7 @@ public boolean equals(Object o) { Objects.equals(this.userData, fallbackParams.userData) && Objects.equals(this.customNormalization, fallbackParams.customNormalization) && Objects.equals(this.attributeForDistinct, fallbackParams.attributeForDistinct) && + Objects.equals(this.maxFacetHits, fallbackParams.maxFacetHits) && Objects.equals(this.attributesToRetrieve, fallbackParams.attributesToRetrieve) && Objects.equals(this.ranking, fallbackParams.ranking) && Objects.equals(this.relevancyStrictness, fallbackParams.relevancyStrictness) && @@ -1890,7 +1853,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, fallbackParams.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, fallbackParams.minProximity) && Objects.equals(this.responseFields, fallbackParams.responseFields) && - Objects.equals(this.maxFacetHits, fallbackParams.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, fallbackParams.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, fallbackParams.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, fallbackParams.attributeCriteriaComputedByMinProximity) && @@ -1949,6 +1911,7 @@ public int hashCode() { userData, customNormalization, attributeForDistinct, + maxFacetHits, attributesToRetrieve, ranking, relevancyStrictness, @@ -1981,7 +1944,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -2041,6 +2003,7 @@ public String toString() { sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append(" customNormalization: ").append(toIndentedString(customNormalization)).append("\n"); sb.append(" attributeForDistinct: ").append(toIndentedString(attributeForDistinct)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); @@ -2073,7 +2036,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb diff --git a/algoliasearch/src/main/java/com/algolia/model/recommend/InsideBoundingBox.java b/algoliasearch/src/main/java/com/algolia/model/recommend/InsideBoundingBox.java new file mode 100644 index 00000000..3d24d861 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/recommend/InsideBoundingBox.java @@ -0,0 +1,111 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.recommend; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** InsideBoundingBox */ +@JsonDeserialize(using = InsideBoundingBox.Deserializer.class) +public interface InsideBoundingBox { + // InsideBoundingBox as String wrapper. + static InsideBoundingBox of(String value) { + return new StringWrapper(value); + } + + // InsideBoundingBox as List> wrapper. + static InsideBoundingBox of(List> value) { + return new ListOfListOfDoubleWrapper(value); + } + + // InsideBoundingBox as String wrapper. + @JsonSerialize(using = StringWrapper.Serializer.class) + class StringWrapper implements InsideBoundingBox { + + private final String value; + + StringWrapper(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(StringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // InsideBoundingBox as List> wrapper. + @JsonSerialize(using = ListOfListOfDoubleWrapper.Serializer.class) + class ListOfListOfDoubleWrapper implements InsideBoundingBox { + + private final List> value; + + ListOfListOfDoubleWrapper(List> value) { + this.value = value; + } + + public List> getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfListOfDoubleWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public InsideBoundingBox deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize String + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + String value = parser.readValueAs(String.class); + return new InsideBoundingBox.StringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf String (error: " + e.getMessage() + ") (type: String)"); + } + } + // deserialize List> + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List> value = parser.readValueAs(new TypeReference>>() {}); + return new InsideBoundingBox.ListOfListOfDoubleWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List> (error: " + e.getMessage() + ") (type: List>)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public InsideBoundingBox getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/recommend/OptionalWords.java b/algoliasearch/src/main/java/com/algolia/model/recommend/OptionalWords.java new file mode 100644 index 00000000..67612bc7 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/recommend/OptionalWords.java @@ -0,0 +1,111 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.recommend; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** OptionalWords */ +@JsonDeserialize(using = OptionalWords.Deserializer.class) +public interface OptionalWords { + // OptionalWords as String wrapper. + static OptionalWords of(String value) { + return new StringWrapper(value); + } + + // OptionalWords as List wrapper. + static OptionalWords of(List value) { + return new ListOfStringWrapper(value); + } + + // OptionalWords as String wrapper. + @JsonSerialize(using = StringWrapper.Serializer.class) + class StringWrapper implements OptionalWords { + + private final String value; + + StringWrapper(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(StringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // OptionalWords as List wrapper. + @JsonSerialize(using = ListOfStringWrapper.Serializer.class) + class ListOfStringWrapper implements OptionalWords { + + private final List value; + + ListOfStringWrapper(List value) { + this.value = value; + } + + public List getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfStringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public OptionalWords deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize String + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + String value = parser.readValueAs(String.class); + return new OptionalWords.StringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf String (error: " + e.getMessage() + ") (type: String)"); + } + } + // deserialize List + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List value = parser.readValueAs(new TypeReference>() {}); + return new OptionalWords.ListOfStringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public OptionalWords getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/recommend/RecommendSearchParams.java b/algoliasearch/src/main/java/com/algolia/model/recommend/RecommendSearchParams.java index d74beea4..49e066f2 100644 --- a/algoliasearch/src/main/java/com/algolia/model/recommend/RecommendSearchParams.java +++ b/algoliasearch/src/main/java/com/algolia/model/recommend/RecommendSearchParams.java @@ -60,7 +60,7 @@ public class RecommendSearchParams { private Integer minimumAroundRadius; @JsonProperty("insideBoundingBox") - private List> insideBoundingBox; + private InsideBoundingBox insideBoundingBox; @JsonProperty("insidePolygon") private List> insidePolygon; @@ -152,6 +152,9 @@ public class RecommendSearchParams { @JsonProperty("attributeForDistinct") private String attributeForDistinct; + @JsonProperty("maxFacetHits") + private Integer maxFacetHits; + @JsonProperty("attributesToRetrieve") private List attributesToRetrieve; @@ -222,7 +225,7 @@ public class RecommendSearchParams { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -248,9 +251,6 @@ public class RecommendSearchParams { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -500,28 +500,14 @@ public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public RecommendSearchParams setInsideBoundingBox(List> insideBoundingBox) { + public RecommendSearchParams setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; return this; } - public RecommendSearchParams addInsideBoundingBox(List insideBoundingBoxItem) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Coordinates for a rectangular area in which to search. Each bounding box is defined by the two - * opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 - * long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more - * information, see [rectangular - * area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). - */ + /** Get insideBoundingBox */ @javax.annotation.Nullable - public List> getInsideBoundingBox() { + public InsideBoundingBox getInsideBoundingBox() { return insideBoundingBox; } @@ -1120,6 +1106,21 @@ public String getAttributeForDistinct() { return attributeForDistinct; } + public RecommendSearchParams setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet values to return when [searching for facet + * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + * maximum: 100 + */ + @javax.annotation.Nullable + public Integer getMaxFacetHits() { + return maxFacetHits; + } + public RecommendSearchParams setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; return this; @@ -1507,38 +1508,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public RecommendSearchParams setOptionalWords(List optionalWords) { + public RecommendSearchParams setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public RecommendSearchParams addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1705,21 +1682,6 @@ public List getResponseFields() { return responseFields; } - public RecommendSearchParams setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public RecommendSearchParams setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1858,6 +1820,7 @@ public boolean equals(Object o) { Objects.equals(this.userData, recommendSearchParams.userData) && Objects.equals(this.customNormalization, recommendSearchParams.customNormalization) && Objects.equals(this.attributeForDistinct, recommendSearchParams.attributeForDistinct) && + Objects.equals(this.maxFacetHits, recommendSearchParams.maxFacetHits) && Objects.equals(this.attributesToRetrieve, recommendSearchParams.attributesToRetrieve) && Objects.equals(this.ranking, recommendSearchParams.ranking) && Objects.equals(this.relevancyStrictness, recommendSearchParams.relevancyStrictness) && @@ -1890,7 +1853,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, recommendSearchParams.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, recommendSearchParams.minProximity) && Objects.equals(this.responseFields, recommendSearchParams.responseFields) && - Objects.equals(this.maxFacetHits, recommendSearchParams.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, recommendSearchParams.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, recommendSearchParams.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, recommendSearchParams.attributeCriteriaComputedByMinProximity) && @@ -1949,6 +1911,7 @@ public int hashCode() { userData, customNormalization, attributeForDistinct, + maxFacetHits, attributesToRetrieve, ranking, relevancyStrictness, @@ -1981,7 +1944,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -2041,6 +2003,7 @@ public String toString() { sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append(" customNormalization: ").append(toIndentedString(customNormalization)).append("\n"); sb.append(" attributeForDistinct: ").append(toIndentedString(attributeForDistinct)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); @@ -2073,7 +2036,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb diff --git a/algoliasearch/src/main/java/com/algolia/model/search/BrowseParamsObject.java b/algoliasearch/src/main/java/com/algolia/model/search/BrowseParamsObject.java index f63981fa..064fb2b7 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/BrowseParamsObject.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/BrowseParamsObject.java @@ -71,7 +71,7 @@ public class BrowseParamsObject implements BrowseParams { private Integer minimumAroundRadius; @JsonProperty("insideBoundingBox") - private List> insideBoundingBox; + private InsideBoundingBox insideBoundingBox; @JsonProperty("insidePolygon") private List> insidePolygon; @@ -194,7 +194,7 @@ public class BrowseParamsObject implements BrowseParams { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -220,9 +220,6 @@ public class BrowseParamsObject implements BrowseParams { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -519,28 +516,14 @@ public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public BrowseParamsObject setInsideBoundingBox(List> insideBoundingBox) { + public BrowseParamsObject setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; return this; } - public BrowseParamsObject addInsideBoundingBox(List insideBoundingBoxItem) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Coordinates for a rectangular area in which to search. Each bounding box is defined by the two - * opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 - * long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more - * information, see [rectangular - * area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). - */ + /** Get insideBoundingBox */ @javax.annotation.Nullable - public List> getInsideBoundingBox() { + public InsideBoundingBox getInsideBoundingBox() { return insideBoundingBox; } @@ -1205,38 +1188,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public BrowseParamsObject setOptionalWords(List optionalWords) { + public BrowseParamsObject setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public BrowseParamsObject addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1403,21 +1362,6 @@ public List getResponseFields() { return responseFields; } - public BrowseParamsObject setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public BrowseParamsObject setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1594,7 +1538,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, browseParamsObject.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, browseParamsObject.minProximity) && Objects.equals(this.responseFields, browseParamsObject.responseFields) && - Objects.equals(this.maxFacetHits, browseParamsObject.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, browseParamsObject.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, browseParamsObject.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, browseParamsObject.attributeCriteriaComputedByMinProximity) && @@ -1677,7 +1620,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -1761,7 +1703,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb diff --git a/algoliasearch/src/main/java/com/algolia/model/search/ConsequenceParams.java b/algoliasearch/src/main/java/com/algolia/model/search/ConsequenceParams.java index 517c0e40..f0fa96ce 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/ConsequenceParams.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/ConsequenceParams.java @@ -67,7 +67,7 @@ public class ConsequenceParams { private Integer minimumAroundRadius; @JsonProperty("insideBoundingBox") - private List> insideBoundingBox; + private InsideBoundingBox insideBoundingBox; @JsonProperty("insidePolygon") private List> insidePolygon; @@ -190,7 +190,7 @@ public class ConsequenceParams { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -216,9 +216,6 @@ public class ConsequenceParams { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -510,28 +507,14 @@ public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public ConsequenceParams setInsideBoundingBox(List> insideBoundingBox) { + public ConsequenceParams setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; return this; } - public ConsequenceParams addInsideBoundingBox(List insideBoundingBoxItem) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Coordinates for a rectangular area in which to search. Each bounding box is defined by the two - * opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 - * long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more - * information, see [rectangular - * area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). - */ + /** Get insideBoundingBox */ @javax.annotation.Nullable - public List> getInsideBoundingBox() { + public InsideBoundingBox getInsideBoundingBox() { return insideBoundingBox; } @@ -1196,38 +1179,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public ConsequenceParams setOptionalWords(List optionalWords) { + public ConsequenceParams setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public ConsequenceParams addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1394,21 +1353,6 @@ public List getResponseFields() { return responseFields; } - public ConsequenceParams setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public ConsequenceParams setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1602,7 +1546,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, consequenceParams.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, consequenceParams.minProximity) && Objects.equals(this.responseFields, consequenceParams.responseFields) && - Objects.equals(this.maxFacetHits, consequenceParams.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, consequenceParams.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, consequenceParams.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, consequenceParams.attributeCriteriaComputedByMinProximity) && @@ -1686,7 +1629,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -1771,7 +1713,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb diff --git a/algoliasearch/src/main/java/com/algolia/model/search/DeleteByParams.java b/algoliasearch/src/main/java/com/algolia/model/search/DeleteByParams.java index 8c2648e9..029e8e53 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/DeleteByParams.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/DeleteByParams.java @@ -31,7 +31,7 @@ public class DeleteByParams { private AroundRadius aroundRadius; @JsonProperty("insideBoundingBox") - private List> insideBoundingBox; + private InsideBoundingBox insideBoundingBox; @JsonProperty("insidePolygon") private List> insidePolygon; @@ -124,28 +124,14 @@ public AroundRadius getAroundRadius() { return aroundRadius; } - public DeleteByParams setInsideBoundingBox(List> insideBoundingBox) { + public DeleteByParams setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; return this; } - public DeleteByParams addInsideBoundingBox(List insideBoundingBoxItem) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Coordinates for a rectangular area in which to search. Each bounding box is defined by the two - * opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 - * long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more - * information, see [rectangular - * area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). - */ + /** Get insideBoundingBox */ @javax.annotation.Nullable - public List> getInsideBoundingBox() { + public InsideBoundingBox getInsideBoundingBox() { return insideBoundingBox; } diff --git a/algoliasearch/src/main/java/com/algolia/model/search/IndexSettings.java b/algoliasearch/src/main/java/com/algolia/model/search/IndexSettings.java index 4974996b..efc4f6ab 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/IndexSettings.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/IndexSettings.java @@ -65,6 +65,9 @@ public class IndexSettings { @JsonProperty("attributeForDistinct") private String attributeForDistinct; + @JsonProperty("maxFacetHits") + private Integer maxFacetHits; + @JsonProperty("attributesToRetrieve") private List attributesToRetrieve; @@ -150,7 +153,7 @@ public class IndexSettings { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -176,9 +179,6 @@ public class IndexSettings { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -585,6 +585,21 @@ public String getAttributeForDistinct() { return attributeForDistinct; } + public IndexSettings setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet values to return when [searching for facet + * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + * maximum: 100 + */ + @javax.annotation.Nullable + public Integer getMaxFacetHits() { + return maxFacetHits; + } + public IndexSettings setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; return this; @@ -1050,38 +1065,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public IndexSettings setOptionalWords(List optionalWords) { + public IndexSettings setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public IndexSettings addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1248,21 +1239,6 @@ public List getResponseFields() { return responseFields; } - public IndexSettings setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public IndexSettings setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1372,6 +1348,7 @@ public boolean equals(Object o) { Objects.equals(this.userData, indexSettings.userData) && Objects.equals(this.customNormalization, indexSettings.customNormalization) && Objects.equals(this.attributeForDistinct, indexSettings.attributeForDistinct) && + Objects.equals(this.maxFacetHits, indexSettings.maxFacetHits) && Objects.equals(this.attributesToRetrieve, indexSettings.attributesToRetrieve) && Objects.equals(this.ranking, indexSettings.ranking) && Objects.equals(this.customRanking, indexSettings.customRanking) && @@ -1409,7 +1386,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, indexSettings.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, indexSettings.minProximity) && Objects.equals(this.responseFields, indexSettings.responseFields) && - Objects.equals(this.maxFacetHits, indexSettings.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, indexSettings.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, indexSettings.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, indexSettings.attributeCriteriaComputedByMinProximity) && @@ -1439,6 +1415,7 @@ public int hashCode() { userData, customNormalization, attributeForDistinct, + maxFacetHits, attributesToRetrieve, ranking, customRanking, @@ -1476,7 +1453,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -1507,6 +1483,7 @@ public String toString() { sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append(" customNormalization: ").append(toIndentedString(customNormalization)).append("\n"); sb.append(" attributeForDistinct: ").append(toIndentedString(attributeForDistinct)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); sb.append(" customRanking: ").append(toIndentedString(customRanking)).append("\n"); @@ -1544,7 +1521,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb diff --git a/algoliasearch/src/main/java/com/algolia/model/search/InsideBoundingBox.java b/algoliasearch/src/main/java/com/algolia/model/search/InsideBoundingBox.java new file mode 100644 index 00000000..bb0b74c5 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/search/InsideBoundingBox.java @@ -0,0 +1,111 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.search; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** InsideBoundingBox */ +@JsonDeserialize(using = InsideBoundingBox.Deserializer.class) +public interface InsideBoundingBox { + // InsideBoundingBox as String wrapper. + static InsideBoundingBox of(String value) { + return new StringWrapper(value); + } + + // InsideBoundingBox as List> wrapper. + static InsideBoundingBox of(List> value) { + return new ListOfListOfDoubleWrapper(value); + } + + // InsideBoundingBox as String wrapper. + @JsonSerialize(using = StringWrapper.Serializer.class) + class StringWrapper implements InsideBoundingBox { + + private final String value; + + StringWrapper(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(StringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // InsideBoundingBox as List> wrapper. + @JsonSerialize(using = ListOfListOfDoubleWrapper.Serializer.class) + class ListOfListOfDoubleWrapper implements InsideBoundingBox { + + private final List> value; + + ListOfListOfDoubleWrapper(List> value) { + this.value = value; + } + + public List> getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfListOfDoubleWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public InsideBoundingBox deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize String + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + String value = parser.readValueAs(String.class); + return new InsideBoundingBox.StringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf String (error: " + e.getMessage() + ") (type: String)"); + } + } + // deserialize List> + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List> value = parser.readValueAs(new TypeReference>>() {}); + return new InsideBoundingBox.ListOfListOfDoubleWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List> (error: " + e.getMessage() + ") (type: List>)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public InsideBoundingBox getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/search/OptionalWords.java b/algoliasearch/src/main/java/com/algolia/model/search/OptionalWords.java new file mode 100644 index 00000000..994a9702 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/search/OptionalWords.java @@ -0,0 +1,111 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.search; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** OptionalWords */ +@JsonDeserialize(using = OptionalWords.Deserializer.class) +public interface OptionalWords { + // OptionalWords as String wrapper. + static OptionalWords of(String value) { + return new StringWrapper(value); + } + + // OptionalWords as List wrapper. + static OptionalWords of(List value) { + return new ListOfStringWrapper(value); + } + + // OptionalWords as String wrapper. + @JsonSerialize(using = StringWrapper.Serializer.class) + class StringWrapper implements OptionalWords { + + private final String value; + + StringWrapper(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(StringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // OptionalWords as List wrapper. + @JsonSerialize(using = ListOfStringWrapper.Serializer.class) + class ListOfStringWrapper implements OptionalWords { + + private final List value; + + ListOfStringWrapper(List value) { + this.value = value; + } + + public List getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfStringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public OptionalWords deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize String + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + String value = parser.readValueAs(String.class); + return new OptionalWords.StringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf String (error: " + e.getMessage() + ") (type: String)"); + } + } + // deserialize List + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List value = parser.readValueAs(new TypeReference>() {}); + return new OptionalWords.ListOfStringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public OptionalWords getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/search/SearchForFacets.java b/algoliasearch/src/main/java/com/algolia/model/search/SearchForFacets.java index 129e68a5..4dedde99 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/SearchForFacets.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/SearchForFacets.java @@ -74,7 +74,7 @@ public class SearchForFacets implements SearchQuery { private Integer minimumAroundRadius; @JsonProperty("insideBoundingBox") - private List> insideBoundingBox; + private InsideBoundingBox insideBoundingBox; @JsonProperty("insidePolygon") private List> insidePolygon; @@ -197,7 +197,7 @@ public class SearchForFacets implements SearchQuery { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -223,9 +223,6 @@ public class SearchForFacets implements SearchQuery { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -253,6 +250,9 @@ public class SearchForFacets implements SearchQuery { @JsonProperty("facetQuery") private String facetQuery; + @JsonProperty("maxFacetHits") + private Integer maxFacetHits; + @JsonProperty("type") private SearchTypeFacet type; @@ -542,28 +542,14 @@ public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public SearchForFacets setInsideBoundingBox(List> insideBoundingBox) { + public SearchForFacets setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; return this; } - public SearchForFacets addInsideBoundingBox(List insideBoundingBoxItem) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Coordinates for a rectangular area in which to search. Each bounding box is defined by the two - * opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 - * long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more - * information, see [rectangular - * area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). - */ + /** Get insideBoundingBox */ @javax.annotation.Nullable - public List> getInsideBoundingBox() { + public InsideBoundingBox getInsideBoundingBox() { return insideBoundingBox; } @@ -1228,38 +1214,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public SearchForFacets setOptionalWords(List optionalWords) { + public SearchForFacets setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public SearchForFacets addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1426,21 +1388,6 @@ public List getResponseFields() { return responseFields; } - public SearchForFacets setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public SearchForFacets setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1556,6 +1503,21 @@ public String getFacetQuery() { return facetQuery; } + public SearchForFacets setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet values to return when [searching for facet + * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + * maximum: 100 + */ + @javax.annotation.Nullable + public Integer getMaxFacetHits() { + return maxFacetHits; + } + public SearchForFacets setType(SearchTypeFacet type) { this.type = type; return this; @@ -1647,7 +1609,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, searchForFacets.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, searchForFacets.minProximity) && Objects.equals(this.responseFields, searchForFacets.responseFields) && - Objects.equals(this.maxFacetHits, searchForFacets.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, searchForFacets.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, searchForFacets.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, searchForFacets.attributeCriteriaComputedByMinProximity) && @@ -1657,6 +1618,7 @@ public boolean equals(Object o) { Objects.equals(this.facet, searchForFacets.facet) && Objects.equals(this.indexName, searchForFacets.indexName) && Objects.equals(this.facetQuery, searchForFacets.facetQuery) && + Objects.equals(this.maxFacetHits, searchForFacets.maxFacetHits) && Objects.equals(this.type, searchForFacets.type) ); } @@ -1734,7 +1696,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -1744,6 +1705,7 @@ public int hashCode() { facet, indexName, facetQuery, + maxFacetHits, type ); } @@ -1822,7 +1784,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb @@ -1835,6 +1796,7 @@ public String toString() { sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); sb.append(" indexName: ").append(toIndentedString(indexName)).append("\n"); sb.append(" facetQuery: ").append(toIndentedString(facetQuery)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/algoliasearch/src/main/java/com/algolia/model/search/SearchForHits.java b/algoliasearch/src/main/java/com/algolia/model/search/SearchForHits.java index 1cf2c190..b6267de8 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/SearchForHits.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/SearchForHits.java @@ -74,7 +74,7 @@ public class SearchForHits implements SearchQuery { private Integer minimumAroundRadius; @JsonProperty("insideBoundingBox") - private List> insideBoundingBox; + private InsideBoundingBox insideBoundingBox; @JsonProperty("insidePolygon") private List> insidePolygon; @@ -197,7 +197,7 @@ public class SearchForHits implements SearchQuery { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -223,9 +223,6 @@ public class SearchForHits implements SearchQuery { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -536,28 +533,14 @@ public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public SearchForHits setInsideBoundingBox(List> insideBoundingBox) { + public SearchForHits setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; return this; } - public SearchForHits addInsideBoundingBox(List insideBoundingBoxItem) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Coordinates for a rectangular area in which to search. Each bounding box is defined by the two - * opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 - * long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more - * information, see [rectangular - * area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). - */ + /** Get insideBoundingBox */ @javax.annotation.Nullable - public List> getInsideBoundingBox() { + public InsideBoundingBox getInsideBoundingBox() { return insideBoundingBox; } @@ -1222,38 +1205,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public SearchForHits setOptionalWords(List optionalWords) { + public SearchForHits setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public SearchForHits addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1420,21 +1379,6 @@ public List getResponseFields() { return responseFields; } - public SearchForHits setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public SearchForHits setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1619,7 +1563,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, searchForHits.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, searchForHits.minProximity) && Objects.equals(this.responseFields, searchForHits.responseFields) && - Objects.equals(this.maxFacetHits, searchForHits.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, searchForHits.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, searchForHits.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, searchForHits.attributeCriteriaComputedByMinProximity) && @@ -1704,7 +1647,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -1790,7 +1732,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb diff --git a/algoliasearch/src/main/java/com/algolia/model/search/SearchParamsObject.java b/algoliasearch/src/main/java/com/algolia/model/search/SearchParamsObject.java index 4cff0705..be6c9e49 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/SearchParamsObject.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/SearchParamsObject.java @@ -71,7 +71,7 @@ public class SearchParamsObject implements SearchParams { private Integer minimumAroundRadius; @JsonProperty("insideBoundingBox") - private List> insideBoundingBox; + private InsideBoundingBox insideBoundingBox; @JsonProperty("insidePolygon") private List> insidePolygon; @@ -194,7 +194,7 @@ public class SearchParamsObject implements SearchParams { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -220,9 +220,6 @@ public class SearchParamsObject implements SearchParams { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -516,28 +513,14 @@ public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public SearchParamsObject setInsideBoundingBox(List> insideBoundingBox) { + public SearchParamsObject setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; return this; } - public SearchParamsObject addInsideBoundingBox(List insideBoundingBoxItem) { - if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList<>(); - } - this.insideBoundingBox.add(insideBoundingBoxItem); - return this; - } - - /** - * Coordinates for a rectangular area in which to search. Each bounding box is defined by the two - * opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 - * long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more - * information, see [rectangular - * area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). - */ + /** Get insideBoundingBox */ @javax.annotation.Nullable - public List> getInsideBoundingBox() { + public InsideBoundingBox getInsideBoundingBox() { return insideBoundingBox; } @@ -1202,38 +1185,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public SearchParamsObject setOptionalWords(List optionalWords) { + public SearchParamsObject setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public SearchParamsObject addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1400,21 +1359,6 @@ public List getResponseFields() { return responseFields; } - public SearchParamsObject setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public SearchParamsObject setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1576,7 +1520,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, searchParamsObject.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, searchParamsObject.minProximity) && Objects.equals(this.responseFields, searchParamsObject.responseFields) && - Objects.equals(this.maxFacetHits, searchParamsObject.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, searchParamsObject.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, searchParamsObject.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, searchParamsObject.attributeCriteriaComputedByMinProximity) && @@ -1658,7 +1601,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -1741,7 +1683,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb diff --git a/algoliasearch/src/main/java/com/algolia/model/search/SettingsResponse.java b/algoliasearch/src/main/java/com/algolia/model/search/SettingsResponse.java index 54f7761e..afcc2cdb 100644 --- a/algoliasearch/src/main/java/com/algolia/model/search/SettingsResponse.java +++ b/algoliasearch/src/main/java/com/algolia/model/search/SettingsResponse.java @@ -65,6 +65,9 @@ public class SettingsResponse { @JsonProperty("attributeForDistinct") private String attributeForDistinct; + @JsonProperty("maxFacetHits") + private Integer maxFacetHits; + @JsonProperty("attributesToRetrieve") private List attributesToRetrieve; @@ -150,7 +153,7 @@ public class SettingsResponse { private Boolean advancedSyntax; @JsonProperty("optionalWords") - private List optionalWords; + private OptionalWords optionalWords; @JsonProperty("disableExactOnAttributes") private List disableExactOnAttributes; @@ -176,9 +179,6 @@ public class SettingsResponse { @JsonProperty("responseFields") private List responseFields; - @JsonProperty("maxFacetHits") - private Integer maxFacetHits; - @JsonProperty("maxValuesPerFacet") private Integer maxValuesPerFacet; @@ -588,6 +588,21 @@ public String getAttributeForDistinct() { return attributeForDistinct; } + public SettingsResponse setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet values to return when [searching for facet + * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + * maximum: 100 + */ + @javax.annotation.Nullable + public Integer getMaxFacetHits() { + return maxFacetHits; + } + public SettingsResponse setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; return this; @@ -1053,38 +1068,14 @@ public Boolean getAdvancedSyntax() { return advancedSyntax; } - public SettingsResponse setOptionalWords(List optionalWords) { + public SettingsResponse setOptionalWords(OptionalWords optionalWords) { this.optionalWords = optionalWords; return this; } - public SettingsResponse addOptionalWords(String optionalWordsItem) { - if (this.optionalWords == null) { - this.optionalWords = new ArrayList<>(); - } - this.optionalWords.add(optionalWordsItem); - return this; - } - - /** - * Words that should be considered optional when found in the query. By default, records must - * match all words in the search query to be included in the search results. Adding optional words - * can help to increase the number of search results by running an additional search query that - * doesn't include the optional words. For example, if the search query is \"action video\" and - * \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and - * one for \"action\". Records that match all words are ranked higher. For a search query with 4 - * or more words **and** all its words are optional, the number of matched words required for a - * record to be included in the search results increases for every 1,000 records: - If - * `optionalWords` has less than 10 words, the required number of matched words increases by 1: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If - * `optionalWords` has 10 or more words, the number of required matched words increases by the - * number of optional words divided by 5 (rounded down). For example, with 18 optional words: - * results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more - * information, see [Optional - * words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - */ + /** Get optionalWords */ @javax.annotation.Nullable - public List getOptionalWords() { + public OptionalWords getOptionalWords() { return optionalWords; } @@ -1251,21 +1242,6 @@ public List getResponseFields() { return responseFields; } - public SettingsResponse setMaxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; - return this; - } - - /** - * Maximum number of facet values to return when [searching for facet - * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). - * maximum: 100 - */ - @javax.annotation.Nullable - public Integer getMaxFacetHits() { - return maxFacetHits; - } - public SettingsResponse setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; return this; @@ -1386,6 +1362,7 @@ public boolean equals(Object o) { Objects.equals(this.userData, settingsResponse.userData) && Objects.equals(this.customNormalization, settingsResponse.customNormalization) && Objects.equals(this.attributeForDistinct, settingsResponse.attributeForDistinct) && + Objects.equals(this.maxFacetHits, settingsResponse.maxFacetHits) && Objects.equals(this.attributesToRetrieve, settingsResponse.attributesToRetrieve) && Objects.equals(this.ranking, settingsResponse.ranking) && Objects.equals(this.customRanking, settingsResponse.customRanking) && @@ -1423,7 +1400,6 @@ public boolean equals(Object o) { Objects.equals(this.replaceSynonymsInHighlight, settingsResponse.replaceSynonymsInHighlight) && Objects.equals(this.minProximity, settingsResponse.minProximity) && Objects.equals(this.responseFields, settingsResponse.responseFields) && - Objects.equals(this.maxFacetHits, settingsResponse.maxFacetHits) && Objects.equals(this.maxValuesPerFacet, settingsResponse.maxValuesPerFacet) && Objects.equals(this.sortFacetValuesBy, settingsResponse.sortFacetValuesBy) && Objects.equals(this.attributeCriteriaComputedByMinProximity, settingsResponse.attributeCriteriaComputedByMinProximity) && @@ -1454,6 +1430,7 @@ public int hashCode() { userData, customNormalization, attributeForDistinct, + maxFacetHits, attributesToRetrieve, ranking, customRanking, @@ -1491,7 +1468,6 @@ public int hashCode() { replaceSynonymsInHighlight, minProximity, responseFields, - maxFacetHits, maxValuesPerFacet, sortFacetValuesBy, attributeCriteriaComputedByMinProximity, @@ -1523,6 +1499,7 @@ public String toString() { sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append(" customNormalization: ").append(toIndentedString(customNormalization)).append("\n"); sb.append(" attributeForDistinct: ").append(toIndentedString(attributeForDistinct)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); sb.append(" customRanking: ").append(toIndentedString(customRanking)).append("\n"); @@ -1560,7 +1537,6 @@ public String toString() { sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); sb