diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java index 7c8ed535cc..cbe3be160b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java @@ -9,9 +9,6 @@ /** BaseSearchParams */ public class BaseSearchParams { - @SerializedName("query") - private String query = ""; - @SerializedName("similarQuery") private String similarQuery = ""; @@ -108,25 +105,6 @@ public class BaseSearchParams { @SerializedName("enableReRanking") private Boolean enableReRanking = true; - public BaseSearchParams query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - public BaseSearchParams similarQuery(String similarQuery) { this.similarQuery = similarQuery; return this; @@ -836,7 +814,6 @@ public boolean equals(Object o) { } BaseSearchParams baseSearchParams = (BaseSearchParams) o; return ( - Objects.equals(this.query, baseSearchParams.query) && Objects.equals(this.similarQuery, baseSearchParams.similarQuery) && Objects.equals(this.filters, baseSearchParams.filters) && Objects.equals(this.facetFilters, baseSearchParams.facetFilters) && @@ -905,7 +882,6 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - query, similarQuery, filters, facetFilters, @@ -945,7 +921,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BaseSearchParams {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb .append(" similarQuery: ") .append(toIndentedString(similarQuery)) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Consequence.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Consequence.java index 25c2b70c9d..0a28491f5e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Consequence.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Consequence.java @@ -11,7 +11,7 @@ public class Consequence { @SerializedName("params") - private Params params; + private ConsequenceParams params; @SerializedName("promote") private List promote = null; @@ -25,7 +25,7 @@ public class Consequence { @SerializedName("userData") private Map userData = null; - public Consequence params(Params params) { + public Consequence params(ConsequenceParams params) { this.params = params; return this; } @@ -36,11 +36,11 @@ public Consequence params(Params params) { * @return params */ @javax.annotation.Nullable - public Params getParams() { + public ConsequenceParams getParams() { return params; } - public void setParams(Params params) { + public void setParams(ConsequenceParams params) { this.params = params; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceParams.java new file mode 100644 index 0000000000..2fd6c440a6 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ConsequenceParams.java @@ -0,0 +1,3018 @@ +package com.algolia.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** ConsequenceParams */ +public class ConsequenceParams { + + @SerializedName("query") + private String query; + + @SerializedName("automaticFacetFilters") + private List automaticFacetFilters = null; + + @SerializedName("automaticOptionalFacetFilters") + private List automaticOptionalFacetFilters = null; + + @SerializedName("similarQuery") + private String similarQuery = ""; + + @SerializedName("filters") + private String filters = ""; + + @SerializedName("facetFilters") + private List facetFilters = null; + + @SerializedName("optionalFilters") + private List optionalFilters = null; + + @SerializedName("numericFilters") + private List numericFilters = null; + + @SerializedName("tagFilters") + private List tagFilters = null; + + @SerializedName("sumOrFiltersScores") + private Boolean sumOrFiltersScores = false; + + @SerializedName("facets") + private List facets = null; + + @SerializedName("maxValuesPerFacet") + private Integer maxValuesPerFacet = 100; + + @SerializedName("facetingAfterDistinct") + private Boolean facetingAfterDistinct = false; + + @SerializedName("sortFacetValuesBy") + private String sortFacetValuesBy = "count"; + + @SerializedName("page") + private Integer page = 0; + + @SerializedName("offset") + private Integer offset; + + @SerializedName("length") + private Integer length; + + @SerializedName("aroundLatLng") + private String aroundLatLng = ""; + + @SerializedName("aroundLatLngViaIP") + private Boolean aroundLatLngViaIP = false; + + @SerializedName("aroundRadius") + private OneOfintegerstring aroundRadius; + + @SerializedName("aroundPrecision") + private Integer aroundPrecision = 10; + + @SerializedName("minimumAroundRadius") + private Integer minimumAroundRadius; + + @SerializedName("insideBoundingBox") + private List insideBoundingBox = null; + + @SerializedName("insidePolygon") + private List insidePolygon = null; + + @SerializedName("naturalLanguages") + private List naturalLanguages = null; + + @SerializedName("ruleContexts") + private List ruleContexts = null; + + @SerializedName("personalizationImpact") + private Integer personalizationImpact = 100; + + @SerializedName("userToken") + private String userToken; + + @SerializedName("getRankingInfo") + private Boolean getRankingInfo = false; + + @SerializedName("clickAnalytics") + private Boolean clickAnalytics = false; + + @SerializedName("analytics") + private Boolean analytics = true; + + @SerializedName("analyticsTags") + private List analyticsTags = null; + + @SerializedName("percentileComputation") + private Boolean percentileComputation = true; + + @SerializedName("enableABTest") + private Boolean enableABTest = true; + + @SerializedName("enableReRanking") + private Boolean enableReRanking = true; + + @SerializedName("searchableAttributes") + private List searchableAttributes = null; + + @SerializedName("attributesForFaceting") + private List attributesForFaceting = null; + + @SerializedName("unretrievableAttributes") + private List unretrievableAttributes = null; + + @SerializedName("attributesToRetrieve") + private List attributesToRetrieve = null; + + @SerializedName("restrictSearchableAttributes") + private List restrictSearchableAttributes = null; + + @SerializedName("ranking") + private List ranking = null; + + @SerializedName("customRanking") + private List customRanking = null; + + @SerializedName("relevancyStrictness") + private Integer relevancyStrictness = 100; + + @SerializedName("attributesToHighlight") + private List attributesToHighlight = null; + + @SerializedName("attributesToSnippet") + private List attributesToSnippet = null; + + @SerializedName("highlightPreTag") + private String highlightPreTag = ""; + + @SerializedName("highlightPostTag") + private String highlightPostTag = ""; + + @SerializedName("snippetEllipsisText") + private String snippetEllipsisText = "…"; + + @SerializedName("restrictHighlightAndSnippetArrays") + private Boolean restrictHighlightAndSnippetArrays = false; + + @SerializedName("hitsPerPage") + private Integer hitsPerPage = 20; + + @SerializedName("minWordSizefor1Typo") + private Integer minWordSizefor1Typo = 4; + + @SerializedName("minWordSizefor2Typos") + private Integer minWordSizefor2Typos = 8; + + /** Controls whether typo tolerance is enabled and how it is applied. */ + @JsonAdapter(TypoToleranceEnum.Adapter.class) + public enum TypoToleranceEnum { + TRUE("true"), + + FALSE("false"), + + MIN("min"), + + STRICT("strict"); + + private String value; + + TypoToleranceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypoToleranceEnum fromValue(String value) { + for (TypoToleranceEnum b : TypoToleranceEnum.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 TypoToleranceEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypoToleranceEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return TypoToleranceEnum.fromValue(value); + } + } + } + + @SerializedName("typoTolerance") + private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; + + @SerializedName("allowTyposOnNumericTokens") + private Boolean allowTyposOnNumericTokens = true; + + @SerializedName("disableTypoToleranceOnAttributes") + private List disableTypoToleranceOnAttributes = null; + + @SerializedName("separatorsToIndex") + private String separatorsToIndex = ""; + + @SerializedName("ignorePlurals") + private String ignorePlurals = "false"; + + @SerializedName("removeStopWords") + private String removeStopWords = "false"; + + @SerializedName("keepDiacriticsOnCharacters") + private String keepDiacriticsOnCharacters = ""; + + @SerializedName("queryLanguages") + private List queryLanguages = null; + + @SerializedName("decompoundQuery") + private Boolean decompoundQuery = true; + + @SerializedName("enableRules") + private Boolean enableRules = true; + + @SerializedName("enablePersonalization") + private Boolean enablePersonalization = false; + + /** Controls if and how query words are interpreted as prefixes. */ + @JsonAdapter(QueryTypeEnum.Adapter.class) + public enum QueryTypeEnum { + PREFIXLAST("prefixLast"), + + PREFIXALL("prefixAll"), + + PREFIXNONE("prefixNone"); + + private String value; + + QueryTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static QueryTypeEnum fromValue(String value) { + for (QueryTypeEnum b : QueryTypeEnum.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 QueryTypeEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public QueryTypeEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return QueryTypeEnum.fromValue(value); + } + } + } + + @SerializedName("queryType") + private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; + + /** Selects a strategy to remove words from the query when it doesn't match any hits. */ + @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) + public enum RemoveWordsIfNoResultsEnum { + NONE("none"), + + LASTWORDS("lastWords"), + + FIRSTWORDS("firstWords"), + + ALLOPTIONAL("allOptional"); + + private String value; + + RemoveWordsIfNoResultsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RemoveWordsIfNoResultsEnum fromValue(String value) { + for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.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 RemoveWordsIfNoResultsEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return RemoveWordsIfNoResultsEnum.fromValue(value); + } + } + } + + @SerializedName("removeWordsIfNoResults") + private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = + RemoveWordsIfNoResultsEnum.NONE; + + @SerializedName("advancedSyntax") + private Boolean advancedSyntax = false; + + @SerializedName("optionalWords") + private List optionalWords = null; + + @SerializedName("disableExactOnAttributes") + private List disableExactOnAttributes = null; + + /** Controls how the exact ranking criterion is computed when the query contains only one word. */ + @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) + public enum ExactOnSingleWordQueryEnum { + ATTRIBUTE("attribute"), + + NONE("none"), + + WORD("word"); + + private String value; + + ExactOnSingleWordQueryEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ExactOnSingleWordQueryEnum fromValue(String value) { + for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.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 ExactOnSingleWordQueryEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return ExactOnSingleWordQueryEnum.fromValue(value); + } + } + } + + @SerializedName("exactOnSingleWordQuery") + private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = + ExactOnSingleWordQueryEnum.ATTRIBUTE; + + /** Gets or Sets alternativesAsExact */ + @JsonAdapter(AlternativesAsExactEnum.Adapter.class) + public enum AlternativesAsExactEnum { + IGNOREPLURALS("ignorePlurals"), + + SINGLEWORDSYNONYM("singleWordSynonym"), + + MULTIWORDSSYNONYM("multiWordsSynonym"); + + private String value; + + AlternativesAsExactEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AlternativesAsExactEnum fromValue(String value) { + for (AlternativesAsExactEnum b : AlternativesAsExactEnum.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 AlternativesAsExactEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AlternativesAsExactEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return AlternativesAsExactEnum.fromValue(value); + } + } + } + + @SerializedName("alternativesAsExact") + private List alternativesAsExact = null; + + /** Gets or Sets advancedSyntaxFeatures */ + @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) + public enum AdvancedSyntaxFeaturesEnum { + EXACTPHRASE("exactPhrase"), + + EXCLUDEWORDS("excludeWords"); + + private String value; + + AdvancedSyntaxFeaturesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AdvancedSyntaxFeaturesEnum fromValue(String value) { + for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.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 AdvancedSyntaxFeaturesEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return AdvancedSyntaxFeaturesEnum.fromValue(value); + } + } + } + + @SerializedName("advancedSyntaxFeatures") + private List advancedSyntaxFeatures = null; + + @SerializedName("distinct") + private Integer distinct = 0; + + @SerializedName("synonyms") + private Boolean synonyms = true; + + @SerializedName("replaceSynonymsInHighlight") + private Boolean replaceSynonymsInHighlight = false; + + @SerializedName("minProximity") + private Integer minProximity = 1; + + @SerializedName("responseFields") + private List responseFields = null; + + @SerializedName("maxFacetHits") + private Integer maxFacetHits = 10; + + @SerializedName("attributeCriteriaComputedByMinProximity") + private Boolean attributeCriteriaComputedByMinProximity = false; + + @SerializedName("renderingContent") + private Object renderingContent = new Object(); + + public ConsequenceParams query(String query) { + this.query = query; + return this; + } + + /** + * Query string. + * + * @return query + */ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public ConsequenceParams automaticFacetFilters( + List automaticFacetFilters + ) { + this.automaticFacetFilters = automaticFacetFilters; + return this; + } + + public ConsequenceParams addAutomaticFacetFiltersItem( + AutomaticFacetFilter automaticFacetFiltersItem + ) { + if (this.automaticFacetFilters == null) { + this.automaticFacetFilters = new ArrayList<>(); + } + this.automaticFacetFilters.add(automaticFacetFiltersItem); + return this; + } + + /** + * Names of facets to which automatic filtering must be applied; they must match the facet name of + * a facet value placeholder in the query pattern. + * + * @return automaticFacetFilters + */ + @javax.annotation.Nullable + public List getAutomaticFacetFilters() { + return automaticFacetFilters; + } + + public void setAutomaticFacetFilters( + List automaticFacetFilters + ) { + this.automaticFacetFilters = automaticFacetFilters; + } + + public ConsequenceParams automaticOptionalFacetFilters( + List automaticOptionalFacetFilters + ) { + this.automaticOptionalFacetFilters = automaticOptionalFacetFilters; + return this; + } + + public ConsequenceParams addAutomaticOptionalFacetFiltersItem( + AutomaticFacetFilter automaticOptionalFacetFiltersItem + ) { + if (this.automaticOptionalFacetFilters == null) { + this.automaticOptionalFacetFilters = new ArrayList<>(); + } + this.automaticOptionalFacetFilters.add(automaticOptionalFacetFiltersItem); + return this; + } + + /** + * Same syntax as automaticFacetFilters, but the engine treats the filters as optional. + * + * @return automaticOptionalFacetFilters + */ + @javax.annotation.Nullable + public List getAutomaticOptionalFacetFilters() { + return automaticOptionalFacetFilters; + } + + public void setAutomaticOptionalFacetFilters( + List automaticOptionalFacetFilters + ) { + this.automaticOptionalFacetFilters = automaticOptionalFacetFilters; + } + + public ConsequenceParams similarQuery(String similarQuery) { + this.similarQuery = similarQuery; + return this; + } + + /** + * Overrides the query parameter and performs a more generic search that can be used to find + * \"similar\" results. + * + * @return similarQuery + */ + @javax.annotation.Nullable + public String getSimilarQuery() { + return similarQuery; + } + + public void setSimilarQuery(String similarQuery) { + this.similarQuery = similarQuery; + } + + public ConsequenceParams filters(String filters) { + this.filters = filters; + return this; + } + + /** + * Filter the query with numeric, facet and/or tag filters. + * + * @return filters + */ + @javax.annotation.Nullable + public String getFilters() { + return filters; + } + + public void setFilters(String filters) { + this.filters = filters; + } + + public ConsequenceParams facetFilters(List facetFilters) { + this.facetFilters = facetFilters; + return this; + } + + public ConsequenceParams addFacetFiltersItem(String facetFiltersItem) { + if (this.facetFilters == null) { + this.facetFilters = new ArrayList<>(); + } + this.facetFilters.add(facetFiltersItem); + return this; + } + + /** + * Filter hits by facet value. + * + * @return facetFilters + */ + @javax.annotation.Nullable + public List getFacetFilters() { + return facetFilters; + } + + public void setFacetFilters(List facetFilters) { + this.facetFilters = facetFilters; + } + + public ConsequenceParams optionalFilters(List optionalFilters) { + this.optionalFilters = optionalFilters; + return this; + } + + public ConsequenceParams addOptionalFiltersItem(String optionalFiltersItem) { + if (this.optionalFilters == null) { + this.optionalFilters = new ArrayList<>(); + } + this.optionalFilters.add(optionalFiltersItem); + return this; + } + + /** + * Create filters for ranking purposes, where records that match the filter are ranked higher, or + * lower in the case of a negative optional filter. + * + * @return optionalFilters + */ + @javax.annotation.Nullable + public List getOptionalFilters() { + return optionalFilters; + } + + public void setOptionalFilters(List optionalFilters) { + this.optionalFilters = optionalFilters; + } + + public ConsequenceParams numericFilters(List numericFilters) { + this.numericFilters = numericFilters; + return this; + } + + public ConsequenceParams addNumericFiltersItem(String numericFiltersItem) { + if (this.numericFilters == null) { + this.numericFilters = new ArrayList<>(); + } + this.numericFilters.add(numericFiltersItem); + return this; + } + + /** + * Filter on numeric attributes. + * + * @return numericFilters + */ + @javax.annotation.Nullable + public List getNumericFilters() { + return numericFilters; + } + + public void setNumericFilters(List numericFilters) { + this.numericFilters = numericFilters; + } + + public ConsequenceParams tagFilters(List tagFilters) { + this.tagFilters = tagFilters; + return this; + } + + public ConsequenceParams addTagFiltersItem(String tagFiltersItem) { + if (this.tagFilters == null) { + this.tagFilters = new ArrayList<>(); + } + this.tagFilters.add(tagFiltersItem); + return this; + } + + /** + * Filter hits by tags. + * + * @return tagFilters + */ + @javax.annotation.Nullable + public List getTagFilters() { + return tagFilters; + } + + public void setTagFilters(List tagFilters) { + this.tagFilters = tagFilters; + } + + public ConsequenceParams sumOrFiltersScores(Boolean sumOrFiltersScores) { + this.sumOrFiltersScores = sumOrFiltersScores; + return this; + } + + /** + * Determines how to calculate the total score for filtering. + * + * @return sumOrFiltersScores + */ + @javax.annotation.Nullable + public Boolean getSumOrFiltersScores() { + return sumOrFiltersScores; + } + + public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { + this.sumOrFiltersScores = sumOrFiltersScores; + } + + public ConsequenceParams facets(List facets) { + this.facets = facets; + return this; + } + + public ConsequenceParams addFacetsItem(String facetsItem) { + if (this.facets == null) { + this.facets = new ArrayList<>(); + } + this.facets.add(facetsItem); + return this; + } + + /** + * Retrieve facets and their facet values. + * + * @return facets + */ + @javax.annotation.Nullable + public List getFacets() { + return facets; + } + + public void setFacets(List facets) { + this.facets = facets; + } + + public ConsequenceParams maxValuesPerFacet(Integer maxValuesPerFacet) { + this.maxValuesPerFacet = maxValuesPerFacet; + return this; + } + + /** + * Maximum number of facet values to return for each facet during a regular search. + * + * @return maxValuesPerFacet + */ + @javax.annotation.Nullable + public Integer getMaxValuesPerFacet() { + return maxValuesPerFacet; + } + + public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { + this.maxValuesPerFacet = maxValuesPerFacet; + } + + public ConsequenceParams facetingAfterDistinct( + Boolean facetingAfterDistinct + ) { + this.facetingAfterDistinct = facetingAfterDistinct; + return this; + } + + /** + * Force faceting to be applied after de-duplication (via the Distinct setting). + * + * @return facetingAfterDistinct + */ + @javax.annotation.Nullable + public Boolean getFacetingAfterDistinct() { + return facetingAfterDistinct; + } + + public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { + this.facetingAfterDistinct = facetingAfterDistinct; + } + + public ConsequenceParams sortFacetValuesBy(String sortFacetValuesBy) { + this.sortFacetValuesBy = sortFacetValuesBy; + return this; + } + + /** + * Controls how facet values are fetched. + * + * @return sortFacetValuesBy + */ + @javax.annotation.Nullable + public String getSortFacetValuesBy() { + return sortFacetValuesBy; + } + + public void setSortFacetValuesBy(String sortFacetValuesBy) { + this.sortFacetValuesBy = sortFacetValuesBy; + } + + public ConsequenceParams page(Integer page) { + this.page = page; + return this; + } + + /** + * Specify the page to retrieve. + * + * @return page + */ + @javax.annotation.Nullable + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public ConsequenceParams offset(Integer offset) { + this.offset = offset; + return this; + } + + /** + * Specify the offset of the first hit to return. + * + * @return offset + */ + @javax.annotation.Nullable + public Integer getOffset() { + return offset; + } + + public void setOffset(Integer offset) { + this.offset = offset; + } + + public ConsequenceParams length(Integer length) { + this.length = length; + return this; + } + + /** + * Set the number of hits to retrieve (used only with offset). minimum: 1 maximum: 1000 + * + * @return length + */ + @javax.annotation.Nullable + public Integer getLength() { + return length; + } + + public void setLength(Integer length) { + this.length = length; + } + + public ConsequenceParams aroundLatLng(String aroundLatLng) { + this.aroundLatLng = aroundLatLng; + return this; + } + + /** + * Search for entries around a central geolocation, enabling a geo search within a circular area. + * + * @return aroundLatLng + */ + @javax.annotation.Nullable + public String getAroundLatLng() { + return aroundLatLng; + } + + public void setAroundLatLng(String aroundLatLng) { + this.aroundLatLng = aroundLatLng; + } + + public ConsequenceParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { + this.aroundLatLngViaIP = aroundLatLngViaIP; + return this; + } + + /** + * Search for entries around a given location automatically computed from the requester's IP + * address. + * + * @return aroundLatLngViaIP + */ + @javax.annotation.Nullable + public Boolean getAroundLatLngViaIP() { + return aroundLatLngViaIP; + } + + public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { + this.aroundLatLngViaIP = aroundLatLngViaIP; + } + + public ConsequenceParams aroundRadius(OneOfintegerstring aroundRadius) { + this.aroundRadius = aroundRadius; + return this; + } + + /** + * Define the maximum radius for a geo search (in meters). + * + * @return aroundRadius + */ + @javax.annotation.Nullable + public OneOfintegerstring getAroundRadius() { + return aroundRadius; + } + + public void setAroundRadius(OneOfintegerstring aroundRadius) { + this.aroundRadius = aroundRadius; + } + + public ConsequenceParams aroundPrecision(Integer aroundPrecision) { + this.aroundPrecision = aroundPrecision; + return this; + } + + /** + * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. + * + * @return aroundPrecision + */ + @javax.annotation.Nullable + public Integer getAroundPrecision() { + return aroundPrecision; + } + + public void setAroundPrecision(Integer aroundPrecision) { + this.aroundPrecision = aroundPrecision; + } + + public ConsequenceParams minimumAroundRadius(Integer minimumAroundRadius) { + this.minimumAroundRadius = minimumAroundRadius; + return this; + } + + /** + * Minimum radius (in meters) used for a geo search when aroundRadius is not set. minimum: 1 + * + * @return minimumAroundRadius + */ + @javax.annotation.Nullable + public Integer getMinimumAroundRadius() { + return minimumAroundRadius; + } + + public void setMinimumAroundRadius(Integer minimumAroundRadius) { + this.minimumAroundRadius = minimumAroundRadius; + } + + public ConsequenceParams insideBoundingBox( + List insideBoundingBox + ) { + this.insideBoundingBox = insideBoundingBox; + return this; + } + + public ConsequenceParams addInsideBoundingBoxItem( + BigDecimal insideBoundingBoxItem + ) { + if (this.insideBoundingBox == null) { + this.insideBoundingBox = new ArrayList<>(); + } + this.insideBoundingBox.add(insideBoundingBoxItem); + return this; + } + + /** + * Search inside a rectangular area (in geo coordinates). + * + * @return insideBoundingBox + */ + @javax.annotation.Nullable + public List getInsideBoundingBox() { + return insideBoundingBox; + } + + public void setInsideBoundingBox(List insideBoundingBox) { + this.insideBoundingBox = insideBoundingBox; + } + + public ConsequenceParams insidePolygon(List insidePolygon) { + this.insidePolygon = insidePolygon; + return this; + } + + public ConsequenceParams addInsidePolygonItem(BigDecimal insidePolygonItem) { + if (this.insidePolygon == null) { + this.insidePolygon = new ArrayList<>(); + } + this.insidePolygon.add(insidePolygonItem); + return this; + } + + /** + * Search inside a polygon (in geo coordinates). + * + * @return insidePolygon + */ + @javax.annotation.Nullable + public List getInsidePolygon() { + return insidePolygon; + } + + public void setInsidePolygon(List insidePolygon) { + this.insidePolygon = insidePolygon; + } + + public ConsequenceParams naturalLanguages(List naturalLanguages) { + this.naturalLanguages = naturalLanguages; + return this; + } + + public ConsequenceParams addNaturalLanguagesItem( + String naturalLanguagesItem + ) { + if (this.naturalLanguages == null) { + this.naturalLanguages = new ArrayList<>(); + } + this.naturalLanguages.add(naturalLanguagesItem); + return this; + } + + /** + * This parameter changes the default values of certain parameters and settings that work best for + * a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, + * analyticsTags and ruleContexts. These parameters and settings work well together when the query + * is formatted in natural language instead of keywords, for example when your user performs a + * voice search. + * + * @return naturalLanguages + */ + @javax.annotation.Nullable + public List getNaturalLanguages() { + return naturalLanguages; + } + + public void setNaturalLanguages(List naturalLanguages) { + this.naturalLanguages = naturalLanguages; + } + + public ConsequenceParams ruleContexts(List ruleContexts) { + this.ruleContexts = ruleContexts; + return this; + } + + public ConsequenceParams addRuleContextsItem(String ruleContextsItem) { + if (this.ruleContexts == null) { + this.ruleContexts = new ArrayList<>(); + } + this.ruleContexts.add(ruleContextsItem); + return this; + } + + /** + * Enables contextual rules. + * + * @return ruleContexts + */ + @javax.annotation.Nullable + public List getRuleContexts() { + return ruleContexts; + } + + public void setRuleContexts(List ruleContexts) { + this.ruleContexts = ruleContexts; + } + + public ConsequenceParams personalizationImpact( + Integer personalizationImpact + ) { + this.personalizationImpact = personalizationImpact; + return this; + } + + /** + * Define the impact of the Personalization feature. + * + * @return personalizationImpact + */ + @javax.annotation.Nullable + public Integer getPersonalizationImpact() { + return personalizationImpact; + } + + public void setPersonalizationImpact(Integer personalizationImpact) { + this.personalizationImpact = personalizationImpact; + } + + public ConsequenceParams userToken(String userToken) { + this.userToken = userToken; + return this; + } + + /** + * Associates a certain user token with the current search. + * + * @return userToken + */ + @javax.annotation.Nullable + public String getUserToken() { + return userToken; + } + + public void setUserToken(String userToken) { + this.userToken = userToken; + } + + public ConsequenceParams getRankingInfo(Boolean getRankingInfo) { + this.getRankingInfo = getRankingInfo; + return this; + } + + /** + * Retrieve detailed ranking information. + * + * @return getRankingInfo + */ + @javax.annotation.Nullable + public Boolean getGetRankingInfo() { + return getRankingInfo; + } + + public void setGetRankingInfo(Boolean getRankingInfo) { + this.getRankingInfo = getRankingInfo; + } + + public ConsequenceParams clickAnalytics(Boolean clickAnalytics) { + this.clickAnalytics = clickAnalytics; + return this; + } + + /** + * Enable the Click Analytics feature. + * + * @return clickAnalytics + */ + @javax.annotation.Nullable + public Boolean getClickAnalytics() { + return clickAnalytics; + } + + public void setClickAnalytics(Boolean clickAnalytics) { + this.clickAnalytics = clickAnalytics; + } + + public ConsequenceParams analytics(Boolean analytics) { + this.analytics = analytics; + return this; + } + + /** + * Whether the current query will be taken into account in the Analytics. + * + * @return analytics + */ + @javax.annotation.Nullable + public Boolean getAnalytics() { + return analytics; + } + + public void setAnalytics(Boolean analytics) { + this.analytics = analytics; + } + + public ConsequenceParams analyticsTags(List analyticsTags) { + this.analyticsTags = analyticsTags; + return this; + } + + public ConsequenceParams addAnalyticsTagsItem(String analyticsTagsItem) { + if (this.analyticsTags == null) { + this.analyticsTags = new ArrayList<>(); + } + this.analyticsTags.add(analyticsTagsItem); + return this; + } + + /** + * List of tags to apply to the query for analytics purposes. + * + * @return analyticsTags + */ + @javax.annotation.Nullable + public List getAnalyticsTags() { + return analyticsTags; + } + + public void setAnalyticsTags(List analyticsTags) { + this.analyticsTags = analyticsTags; + } + + public ConsequenceParams percentileComputation( + Boolean percentileComputation + ) { + this.percentileComputation = percentileComputation; + return this; + } + + /** + * Whether to include or exclude a query from the processing-time percentile computation. + * + * @return percentileComputation + */ + @javax.annotation.Nullable + public Boolean getPercentileComputation() { + return percentileComputation; + } + + public void setPercentileComputation(Boolean percentileComputation) { + this.percentileComputation = percentileComputation; + } + + public ConsequenceParams enableABTest(Boolean enableABTest) { + this.enableABTest = enableABTest; + return this; + } + + /** + * Whether this search should participate in running AB tests. + * + * @return enableABTest + */ + @javax.annotation.Nullable + public Boolean getEnableABTest() { + return enableABTest; + } + + public void setEnableABTest(Boolean enableABTest) { + this.enableABTest = enableABTest; + } + + public ConsequenceParams enableReRanking(Boolean enableReRanking) { + this.enableReRanking = enableReRanking; + return this; + } + + /** + * Whether this search should use AI Re-Ranking. + * + * @return enableReRanking + */ + @javax.annotation.Nullable + public Boolean getEnableReRanking() { + return enableReRanking; + } + + public void setEnableReRanking(Boolean enableReRanking) { + this.enableReRanking = enableReRanking; + } + + public ConsequenceParams searchableAttributes( + List searchableAttributes + ) { + this.searchableAttributes = searchableAttributes; + return this; + } + + public ConsequenceParams addSearchableAttributesItem( + String searchableAttributesItem + ) { + if (this.searchableAttributes == null) { + this.searchableAttributes = new ArrayList<>(); + } + this.searchableAttributes.add(searchableAttributesItem); + return this; + } + + /** + * The complete list of attributes used for searching. + * + * @return searchableAttributes + */ + @javax.annotation.Nullable + public List getSearchableAttributes() { + return searchableAttributes; + } + + public void setSearchableAttributes(List searchableAttributes) { + this.searchableAttributes = searchableAttributes; + } + + public ConsequenceParams attributesForFaceting( + List attributesForFaceting + ) { + this.attributesForFaceting = attributesForFaceting; + return this; + } + + public ConsequenceParams addAttributesForFacetingItem( + String attributesForFacetingItem + ) { + if (this.attributesForFaceting == null) { + this.attributesForFaceting = new ArrayList<>(); + } + this.attributesForFaceting.add(attributesForFacetingItem); + return this; + } + + /** + * The complete list of attributes that will be used for faceting. + * + * @return attributesForFaceting + */ + @javax.annotation.Nullable + public List getAttributesForFaceting() { + return attributesForFaceting; + } + + public void setAttributesForFaceting(List attributesForFaceting) { + this.attributesForFaceting = attributesForFaceting; + } + + public ConsequenceParams unretrievableAttributes( + List unretrievableAttributes + ) { + this.unretrievableAttributes = unretrievableAttributes; + return this; + } + + public ConsequenceParams addUnretrievableAttributesItem( + String unretrievableAttributesItem + ) { + if (this.unretrievableAttributes == null) { + this.unretrievableAttributes = new ArrayList<>(); + } + this.unretrievableAttributes.add(unretrievableAttributesItem); + return this; + } + + /** + * List of attributes that can't be retrieved at query time. + * + * @return unretrievableAttributes + */ + @javax.annotation.Nullable + public List getUnretrievableAttributes() { + return unretrievableAttributes; + } + + public void setUnretrievableAttributes(List unretrievableAttributes) { + this.unretrievableAttributes = unretrievableAttributes; + } + + public ConsequenceParams attributesToRetrieve( + List attributesToRetrieve + ) { + this.attributesToRetrieve = attributesToRetrieve; + return this; + } + + public ConsequenceParams addAttributesToRetrieveItem( + String attributesToRetrieveItem + ) { + if (this.attributesToRetrieve == null) { + this.attributesToRetrieve = new ArrayList<>(); + } + this.attributesToRetrieve.add(attributesToRetrieveItem); + return this; + } + + /** + * This parameter controls which attributes to retrieve and which not to retrieve. + * + * @return attributesToRetrieve + */ + @javax.annotation.Nullable + public List getAttributesToRetrieve() { + return attributesToRetrieve; + } + + public void setAttributesToRetrieve(List attributesToRetrieve) { + this.attributesToRetrieve = attributesToRetrieve; + } + + public ConsequenceParams restrictSearchableAttributes( + List restrictSearchableAttributes + ) { + this.restrictSearchableAttributes = restrictSearchableAttributes; + return this; + } + + public ConsequenceParams addRestrictSearchableAttributesItem( + String restrictSearchableAttributesItem + ) { + if (this.restrictSearchableAttributes == null) { + this.restrictSearchableAttributes = new ArrayList<>(); + } + this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); + return this; + } + + /** + * Restricts a given query to look in only a subset of your searchable attributes. + * + * @return restrictSearchableAttributes + */ + @javax.annotation.Nullable + public List getRestrictSearchableAttributes() { + return restrictSearchableAttributes; + } + + public void setRestrictSearchableAttributes( + List restrictSearchableAttributes + ) { + this.restrictSearchableAttributes = restrictSearchableAttributes; + } + + public ConsequenceParams ranking(List ranking) { + this.ranking = ranking; + return this; + } + + public ConsequenceParams addRankingItem(String rankingItem) { + if (this.ranking == null) { + this.ranking = new ArrayList<>(); + } + this.ranking.add(rankingItem); + return this; + } + + /** + * Controls how Algolia should sort your results. + * + * @return ranking + */ + @javax.annotation.Nullable + public List getRanking() { + return ranking; + } + + public void setRanking(List ranking) { + this.ranking = ranking; + } + + public ConsequenceParams customRanking(List customRanking) { + this.customRanking = customRanking; + return this; + } + + public ConsequenceParams addCustomRankingItem(String customRankingItem) { + if (this.customRanking == null) { + this.customRanking = new ArrayList<>(); + } + this.customRanking.add(customRankingItem); + return this; + } + + /** + * Specifies the custom ranking criterion. + * + * @return customRanking + */ + @javax.annotation.Nullable + public List getCustomRanking() { + return customRanking; + } + + public void setCustomRanking(List customRanking) { + this.customRanking = customRanking; + } + + public ConsequenceParams relevancyStrictness(Integer relevancyStrictness) { + this.relevancyStrictness = relevancyStrictness; + return this; + } + + /** + * Controls the relevancy threshold below which less relevant results aren't included in the + * results. + * + * @return relevancyStrictness + */ + @javax.annotation.Nullable + public Integer getRelevancyStrictness() { + return relevancyStrictness; + } + + public void setRelevancyStrictness(Integer relevancyStrictness) { + this.relevancyStrictness = relevancyStrictness; + } + + public ConsequenceParams attributesToHighlight( + List attributesToHighlight + ) { + this.attributesToHighlight = attributesToHighlight; + return this; + } + + public ConsequenceParams addAttributesToHighlightItem( + String attributesToHighlightItem + ) { + if (this.attributesToHighlight == null) { + this.attributesToHighlight = new ArrayList<>(); + } + this.attributesToHighlight.add(attributesToHighlightItem); + return this; + } + + /** + * List of attributes to highlight. + * + * @return attributesToHighlight + */ + @javax.annotation.Nullable + public List getAttributesToHighlight() { + return attributesToHighlight; + } + + public void setAttributesToHighlight(List attributesToHighlight) { + this.attributesToHighlight = attributesToHighlight; + } + + public ConsequenceParams attributesToSnippet( + List attributesToSnippet + ) { + this.attributesToSnippet = attributesToSnippet; + return this; + } + + public ConsequenceParams addAttributesToSnippetItem( + String attributesToSnippetItem + ) { + if (this.attributesToSnippet == null) { + this.attributesToSnippet = new ArrayList<>(); + } + this.attributesToSnippet.add(attributesToSnippetItem); + return this; + } + + /** + * List of attributes to snippet, with an optional maximum number of words to snippet. + * + * @return attributesToSnippet + */ + @javax.annotation.Nullable + public List getAttributesToSnippet() { + return attributesToSnippet; + } + + public void setAttributesToSnippet(List attributesToSnippet) { + this.attributesToSnippet = attributesToSnippet; + } + + public ConsequenceParams highlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * The HTML string to insert before the highlighted parts in all highlight and snippet results. + * + * @return highlightPreTag + */ + @javax.annotation.Nullable + public String getHighlightPreTag() { + return highlightPreTag; + } + + public void setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + } + + public ConsequenceParams highlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * The HTML string to insert after the highlighted parts in all highlight and snippet results. + * + * @return highlightPostTag + */ + @javax.annotation.Nullable + public String getHighlightPostTag() { + return highlightPostTag; + } + + public void setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + } + + public ConsequenceParams snippetEllipsisText(String snippetEllipsisText) { + this.snippetEllipsisText = snippetEllipsisText; + return this; + } + + /** + * String used as an ellipsis indicator when a snippet is truncated. + * + * @return snippetEllipsisText + */ + @javax.annotation.Nullable + public String getSnippetEllipsisText() { + return snippetEllipsisText; + } + + public void setSnippetEllipsisText(String snippetEllipsisText) { + this.snippetEllipsisText = snippetEllipsisText; + } + + public ConsequenceParams restrictHighlightAndSnippetArrays( + Boolean restrictHighlightAndSnippetArrays + ) { + this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + return this; + } + + /** + * Restrict highlighting and snippeting to items that matched the query. + * + * @return restrictHighlightAndSnippetArrays + */ + @javax.annotation.Nullable + public Boolean getRestrictHighlightAndSnippetArrays() { + return restrictHighlightAndSnippetArrays; + } + + public void setRestrictHighlightAndSnippetArrays( + Boolean restrictHighlightAndSnippetArrays + ) { + this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + } + + public ConsequenceParams hitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + return this; + } + + /** + * Set the number of hits per page. + * + * @return hitsPerPage + */ + @javax.annotation.Nullable + public Integer getHitsPerPage() { + return hitsPerPage; + } + + public void setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + } + + public ConsequenceParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { + this.minWordSizefor1Typo = minWordSizefor1Typo; + return this; + } + + /** + * Minimum number of characters a word in the query string must contain to accept matches with 1 + * typo. + * + * @return minWordSizefor1Typo + */ + @javax.annotation.Nullable + public Integer getMinWordSizefor1Typo() { + return minWordSizefor1Typo; + } + + public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { + this.minWordSizefor1Typo = minWordSizefor1Typo; + } + + public ConsequenceParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { + this.minWordSizefor2Typos = minWordSizefor2Typos; + return this; + } + + /** + * Minimum number of characters a word in the query string must contain to accept matches with 2 + * typos. + * + * @return minWordSizefor2Typos + */ + @javax.annotation.Nullable + public Integer getMinWordSizefor2Typos() { + return minWordSizefor2Typos; + } + + public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { + this.minWordSizefor2Typos = minWordSizefor2Typos; + } + + public ConsequenceParams typoTolerance(TypoToleranceEnum typoTolerance) { + this.typoTolerance = typoTolerance; + return this; + } + + /** + * Controls whether typo tolerance is enabled and how it is applied. + * + * @return typoTolerance + */ + @javax.annotation.Nullable + public TypoToleranceEnum getTypoTolerance() { + return typoTolerance; + } + + public void setTypoTolerance(TypoToleranceEnum typoTolerance) { + this.typoTolerance = typoTolerance; + } + + public ConsequenceParams allowTyposOnNumericTokens( + Boolean allowTyposOnNumericTokens + ) { + this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; + return this; + } + + /** + * Whether to allow typos on numbers (\"numeric tokens\") in the query string. + * + * @return allowTyposOnNumericTokens + */ + @javax.annotation.Nullable + public Boolean getAllowTyposOnNumericTokens() { + return allowTyposOnNumericTokens; + } + + public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { + this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; + } + + public ConsequenceParams disableTypoToleranceOnAttributes( + List disableTypoToleranceOnAttributes + ) { + this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + return this; + } + + public ConsequenceParams addDisableTypoToleranceOnAttributesItem( + String disableTypoToleranceOnAttributesItem + ) { + if (this.disableTypoToleranceOnAttributes == null) { + this.disableTypoToleranceOnAttributes = new ArrayList<>(); + } + this.disableTypoToleranceOnAttributes.add( + disableTypoToleranceOnAttributesItem + ); + return this; + } + + /** + * List of attributes on which you want to disable typo tolerance. + * + * @return disableTypoToleranceOnAttributes + */ + @javax.annotation.Nullable + public List getDisableTypoToleranceOnAttributes() { + return disableTypoToleranceOnAttributes; + } + + public void setDisableTypoToleranceOnAttributes( + List disableTypoToleranceOnAttributes + ) { + this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + } + + public ConsequenceParams separatorsToIndex(String separatorsToIndex) { + this.separatorsToIndex = separatorsToIndex; + return this; + } + + /** + * Control which separators are indexed. + * + * @return separatorsToIndex + */ + @javax.annotation.Nullable + public String getSeparatorsToIndex() { + return separatorsToIndex; + } + + public void setSeparatorsToIndex(String separatorsToIndex) { + this.separatorsToIndex = separatorsToIndex; + } + + public ConsequenceParams ignorePlurals(String ignorePlurals) { + this.ignorePlurals = ignorePlurals; + return this; + } + + /** + * Treats singular, plurals, and other forms of declensions as matching terms. + * + * @return ignorePlurals + */ + @javax.annotation.Nullable + public String getIgnorePlurals() { + return ignorePlurals; + } + + public void setIgnorePlurals(String ignorePlurals) { + this.ignorePlurals = ignorePlurals; + } + + public ConsequenceParams removeStopWords(String removeStopWords) { + this.removeStopWords = removeStopWords; + return this; + } + + /** + * Removes stop (common) words from the query before executing it. + * + * @return removeStopWords + */ + @javax.annotation.Nullable + public String getRemoveStopWords() { + return removeStopWords; + } + + public void setRemoveStopWords(String removeStopWords) { + this.removeStopWords = removeStopWords; + } + + public ConsequenceParams keepDiacriticsOnCharacters( + String keepDiacriticsOnCharacters + ) { + this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; + return this; + } + + /** + * List of characters that the engine shouldn't automatically normalize. + * + * @return keepDiacriticsOnCharacters + */ + @javax.annotation.Nullable + public String getKeepDiacriticsOnCharacters() { + return keepDiacriticsOnCharacters; + } + + public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { + this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; + } + + public ConsequenceParams queryLanguages(List queryLanguages) { + this.queryLanguages = queryLanguages; + return this; + } + + public ConsequenceParams addQueryLanguagesItem(String queryLanguagesItem) { + if (this.queryLanguages == null) { + this.queryLanguages = new ArrayList<>(); + } + this.queryLanguages.add(queryLanguagesItem); + return this; + } + + /** + * Sets the languages to be used by language-specific settings and functionalities such as + * ignorePlurals, removeStopWords, and CJK word-detection. + * + * @return queryLanguages + */ + @javax.annotation.Nullable + public List getQueryLanguages() { + return queryLanguages; + } + + public void setQueryLanguages(List queryLanguages) { + this.queryLanguages = queryLanguages; + } + + public ConsequenceParams decompoundQuery(Boolean decompoundQuery) { + this.decompoundQuery = decompoundQuery; + return this; + } + + /** + * Splits compound words into their composing atoms in the query. + * + * @return decompoundQuery + */ + @javax.annotation.Nullable + public Boolean getDecompoundQuery() { + return decompoundQuery; + } + + public void setDecompoundQuery(Boolean decompoundQuery) { + this.decompoundQuery = decompoundQuery; + } + + public ConsequenceParams enableRules(Boolean enableRules) { + this.enableRules = enableRules; + return this; + } + + /** + * Whether Rules should be globally enabled. + * + * @return enableRules + */ + @javax.annotation.Nullable + public Boolean getEnableRules() { + return enableRules; + } + + public void setEnableRules(Boolean enableRules) { + this.enableRules = enableRules; + } + + public ConsequenceParams enablePersonalization( + Boolean enablePersonalization + ) { + this.enablePersonalization = enablePersonalization; + return this; + } + + /** + * Enable the Personalization feature. + * + * @return enablePersonalization + */ + @javax.annotation.Nullable + public Boolean getEnablePersonalization() { + return enablePersonalization; + } + + public void setEnablePersonalization(Boolean enablePersonalization) { + this.enablePersonalization = enablePersonalization; + } + + public ConsequenceParams queryType(QueryTypeEnum queryType) { + this.queryType = queryType; + return this; + } + + /** + * Controls if and how query words are interpreted as prefixes. + * + * @return queryType + */ + @javax.annotation.Nullable + public QueryTypeEnum getQueryType() { + return queryType; + } + + public void setQueryType(QueryTypeEnum queryType) { + this.queryType = queryType; + } + + public ConsequenceParams removeWordsIfNoResults( + RemoveWordsIfNoResultsEnum removeWordsIfNoResults + ) { + this.removeWordsIfNoResults = removeWordsIfNoResults; + return this; + } + + /** + * Selects a strategy to remove words from the query when it doesn't match any hits. + * + * @return removeWordsIfNoResults + */ + @javax.annotation.Nullable + public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { + return removeWordsIfNoResults; + } + + public void setRemoveWordsIfNoResults( + RemoveWordsIfNoResultsEnum removeWordsIfNoResults + ) { + this.removeWordsIfNoResults = removeWordsIfNoResults; + } + + public ConsequenceParams advancedSyntax(Boolean advancedSyntax) { + this.advancedSyntax = advancedSyntax; + return this; + } + + /** + * Enables the advanced query syntax. + * + * @return advancedSyntax + */ + @javax.annotation.Nullable + public Boolean getAdvancedSyntax() { + return advancedSyntax; + } + + public void setAdvancedSyntax(Boolean advancedSyntax) { + this.advancedSyntax = advancedSyntax; + } + + public ConsequenceParams optionalWords(List optionalWords) { + this.optionalWords = optionalWords; + return this; + } + + public ConsequenceParams addOptionalWordsItem(String optionalWordsItem) { + if (this.optionalWords == null) { + this.optionalWords = new ArrayList<>(); + } + this.optionalWords.add(optionalWordsItem); + return this; + } + + /** + * A list of words that should be considered as optional when found in the query. + * + * @return optionalWords + */ + @javax.annotation.Nullable + public List getOptionalWords() { + return optionalWords; + } + + public void setOptionalWords(List optionalWords) { + this.optionalWords = optionalWords; + } + + public ConsequenceParams disableExactOnAttributes( + List disableExactOnAttributes + ) { + this.disableExactOnAttributes = disableExactOnAttributes; + return this; + } + + public ConsequenceParams addDisableExactOnAttributesItem( + String disableExactOnAttributesItem + ) { + if (this.disableExactOnAttributes == null) { + this.disableExactOnAttributes = new ArrayList<>(); + } + this.disableExactOnAttributes.add(disableExactOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable the exact ranking criterion. + * + * @return disableExactOnAttributes + */ + @javax.annotation.Nullable + public List getDisableExactOnAttributes() { + return disableExactOnAttributes; + } + + public void setDisableExactOnAttributes( + List disableExactOnAttributes + ) { + this.disableExactOnAttributes = disableExactOnAttributes; + } + + public ConsequenceParams exactOnSingleWordQuery( + ExactOnSingleWordQueryEnum exactOnSingleWordQuery + ) { + this.exactOnSingleWordQuery = exactOnSingleWordQuery; + return this; + } + + /** + * Controls how the exact ranking criterion is computed when the query contains only one word. + * + * @return exactOnSingleWordQuery + */ + @javax.annotation.Nullable + public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { + return exactOnSingleWordQuery; + } + + public void setExactOnSingleWordQuery( + ExactOnSingleWordQueryEnum exactOnSingleWordQuery + ) { + this.exactOnSingleWordQuery = exactOnSingleWordQuery; + } + + public ConsequenceParams alternativesAsExact( + List alternativesAsExact + ) { + this.alternativesAsExact = alternativesAsExact; + return this; + } + + public ConsequenceParams addAlternativesAsExactItem( + AlternativesAsExactEnum alternativesAsExactItem + ) { + if (this.alternativesAsExact == null) { + this.alternativesAsExact = new ArrayList<>(); + } + this.alternativesAsExact.add(alternativesAsExactItem); + return this; + } + + /** + * List of alternatives that should be considered an exact match by the exact ranking criterion. + * + * @return alternativesAsExact + */ + @javax.annotation.Nullable + public List getAlternativesAsExact() { + return alternativesAsExact; + } + + public void setAlternativesAsExact( + List alternativesAsExact + ) { + this.alternativesAsExact = alternativesAsExact; + } + + public ConsequenceParams advancedSyntaxFeatures( + List advancedSyntaxFeatures + ) { + this.advancedSyntaxFeatures = advancedSyntaxFeatures; + return this; + } + + public ConsequenceParams addAdvancedSyntaxFeaturesItem( + AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem + ) { + if (this.advancedSyntaxFeatures == null) { + this.advancedSyntaxFeatures = new ArrayList<>(); + } + this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); + return this; + } + + /** + * Allows you to specify which advanced syntax features are active when ‘advancedSyntax' is + * enabled. + * + * @return advancedSyntaxFeatures + */ + @javax.annotation.Nullable + public List getAdvancedSyntaxFeatures() { + return advancedSyntaxFeatures; + } + + public void setAdvancedSyntaxFeatures( + List advancedSyntaxFeatures + ) { + this.advancedSyntaxFeatures = advancedSyntaxFeatures; + } + + public ConsequenceParams distinct(Integer distinct) { + this.distinct = distinct; + return this; + } + + /** + * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 + * + * @return distinct + */ + @javax.annotation.Nullable + public Integer getDistinct() { + return distinct; + } + + public void setDistinct(Integer distinct) { + this.distinct = distinct; + } + + public ConsequenceParams synonyms(Boolean synonyms) { + this.synonyms = synonyms; + return this; + } + + /** + * Whether to take into account an index's synonyms for a particular search. + * + * @return synonyms + */ + @javax.annotation.Nullable + public Boolean getSynonyms() { + return synonyms; + } + + public void setSynonyms(Boolean synonyms) { + this.synonyms = synonyms; + } + + public ConsequenceParams replaceSynonymsInHighlight( + Boolean replaceSynonymsInHighlight + ) { + this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; + return this; + } + + /** + * Whether to highlight and snippet the original word that matches the synonym or the synonym + * itself. + * + * @return replaceSynonymsInHighlight + */ + @javax.annotation.Nullable + public Boolean getReplaceSynonymsInHighlight() { + return replaceSynonymsInHighlight; + } + + public void setReplaceSynonymsInHighlight( + Boolean replaceSynonymsInHighlight + ) { + this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; + } + + public ConsequenceParams minProximity(Integer minProximity) { + this.minProximity = minProximity; + return this; + } + + /** + * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 + * + * @return minProximity + */ + @javax.annotation.Nullable + public Integer getMinProximity() { + return minProximity; + } + + public void setMinProximity(Integer minProximity) { + this.minProximity = minProximity; + } + + public ConsequenceParams responseFields(List responseFields) { + this.responseFields = responseFields; + return this; + } + + public ConsequenceParams addResponseFieldsItem(String responseFieldsItem) { + if (this.responseFields == null) { + this.responseFields = new ArrayList<>(); + } + this.responseFields.add(responseFieldsItem); + return this; + } + + /** + * Choose which fields to return in the API response. This parameters applies to search and browse + * queries. + * + * @return responseFields + */ + @javax.annotation.Nullable + public List getResponseFields() { + return responseFields; + } + + public void setResponseFields(List responseFields) { + this.responseFields = responseFields; + } + + public ConsequenceParams maxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet hits to return during a search for facet values. For performance + * reasons, the maximum allowed number of returned values is 100. maximum: 100 + * + * @return maxFacetHits + */ + @javax.annotation.Nullable + public Integer getMaxFacetHits() { + return maxFacetHits; + } + + public void setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + } + + public ConsequenceParams attributeCriteriaComputedByMinProximity( + Boolean attributeCriteriaComputedByMinProximity + ) { + this.attributeCriteriaComputedByMinProximity = + attributeCriteriaComputedByMinProximity; + return this; + } + + /** + * When attribute is ranked above proximity in your ranking formula, proximity is used to select + * which searchable attribute is matched in the attribute ranking stage. + * + * @return attributeCriteriaComputedByMinProximity + */ + @javax.annotation.Nullable + public Boolean getAttributeCriteriaComputedByMinProximity() { + return attributeCriteriaComputedByMinProximity; + } + + public void setAttributeCriteriaComputedByMinProximity( + Boolean attributeCriteriaComputedByMinProximity + ) { + this.attributeCriteriaComputedByMinProximity = + attributeCriteriaComputedByMinProximity; + } + + public ConsequenceParams renderingContent(Object renderingContent) { + this.renderingContent = renderingContent; + return this; + } + + /** + * Content defining how the search interface should be rendered. Can be set via the settings for a + * default value and can be overridden via rules. + * + * @return renderingContent + */ + @javax.annotation.Nullable + public Object getRenderingContent() { + return renderingContent; + } + + public void setRenderingContent(Object renderingContent) { + this.renderingContent = renderingContent; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConsequenceParams consequenceParams = (ConsequenceParams) o; + return ( + Objects.equals(this.query, consequenceParams.query) && + Objects.equals( + this.automaticFacetFilters, + consequenceParams.automaticFacetFilters + ) && + Objects.equals( + this.automaticOptionalFacetFilters, + consequenceParams.automaticOptionalFacetFilters + ) && + Objects.equals(this.similarQuery, consequenceParams.similarQuery) && + Objects.equals(this.filters, consequenceParams.filters) && + Objects.equals(this.facetFilters, consequenceParams.facetFilters) && + Objects.equals(this.optionalFilters, consequenceParams.optionalFilters) && + Objects.equals(this.numericFilters, consequenceParams.numericFilters) && + Objects.equals(this.tagFilters, consequenceParams.tagFilters) && + Objects.equals( + this.sumOrFiltersScores, + consequenceParams.sumOrFiltersScores + ) && + Objects.equals(this.facets, consequenceParams.facets) && + Objects.equals( + this.maxValuesPerFacet, + consequenceParams.maxValuesPerFacet + ) && + Objects.equals( + this.facetingAfterDistinct, + consequenceParams.facetingAfterDistinct + ) && + Objects.equals( + this.sortFacetValuesBy, + consequenceParams.sortFacetValuesBy + ) && + Objects.equals(this.page, consequenceParams.page) && + Objects.equals(this.offset, consequenceParams.offset) && + Objects.equals(this.length, consequenceParams.length) && + Objects.equals(this.aroundLatLng, consequenceParams.aroundLatLng) && + Objects.equals( + this.aroundLatLngViaIP, + consequenceParams.aroundLatLngViaIP + ) && + Objects.equals(this.aroundRadius, consequenceParams.aroundRadius) && + Objects.equals(this.aroundPrecision, consequenceParams.aroundPrecision) && + Objects.equals( + this.minimumAroundRadius, + consequenceParams.minimumAroundRadius + ) && + Objects.equals( + this.insideBoundingBox, + consequenceParams.insideBoundingBox + ) && + Objects.equals(this.insidePolygon, consequenceParams.insidePolygon) && + Objects.equals( + this.naturalLanguages, + consequenceParams.naturalLanguages + ) && + Objects.equals(this.ruleContexts, consequenceParams.ruleContexts) && + Objects.equals( + this.personalizationImpact, + consequenceParams.personalizationImpact + ) && + Objects.equals(this.userToken, consequenceParams.userToken) && + Objects.equals(this.getRankingInfo, consequenceParams.getRankingInfo) && + Objects.equals(this.clickAnalytics, consequenceParams.clickAnalytics) && + Objects.equals(this.analytics, consequenceParams.analytics) && + Objects.equals(this.analyticsTags, consequenceParams.analyticsTags) && + Objects.equals( + this.percentileComputation, + consequenceParams.percentileComputation + ) && + Objects.equals(this.enableABTest, consequenceParams.enableABTest) && + Objects.equals(this.enableReRanking, consequenceParams.enableReRanking) && + Objects.equals( + this.searchableAttributes, + consequenceParams.searchableAttributes + ) && + Objects.equals( + this.attributesForFaceting, + consequenceParams.attributesForFaceting + ) && + Objects.equals( + this.unretrievableAttributes, + consequenceParams.unretrievableAttributes + ) && + Objects.equals( + this.attributesToRetrieve, + consequenceParams.attributesToRetrieve + ) && + Objects.equals( + this.restrictSearchableAttributes, + consequenceParams.restrictSearchableAttributes + ) && + Objects.equals(this.ranking, consequenceParams.ranking) && + Objects.equals(this.customRanking, consequenceParams.customRanking) && + Objects.equals( + this.relevancyStrictness, + consequenceParams.relevancyStrictness + ) && + Objects.equals( + this.attributesToHighlight, + consequenceParams.attributesToHighlight + ) && + Objects.equals( + this.attributesToSnippet, + consequenceParams.attributesToSnippet + ) && + Objects.equals(this.highlightPreTag, consequenceParams.highlightPreTag) && + Objects.equals( + this.highlightPostTag, + consequenceParams.highlightPostTag + ) && + Objects.equals( + this.snippetEllipsisText, + consequenceParams.snippetEllipsisText + ) && + Objects.equals( + this.restrictHighlightAndSnippetArrays, + consequenceParams.restrictHighlightAndSnippetArrays + ) && + Objects.equals(this.hitsPerPage, consequenceParams.hitsPerPage) && + Objects.equals( + this.minWordSizefor1Typo, + consequenceParams.minWordSizefor1Typo + ) && + Objects.equals( + this.minWordSizefor2Typos, + consequenceParams.minWordSizefor2Typos + ) && + Objects.equals(this.typoTolerance, consequenceParams.typoTolerance) && + Objects.equals( + this.allowTyposOnNumericTokens, + consequenceParams.allowTyposOnNumericTokens + ) && + Objects.equals( + this.disableTypoToleranceOnAttributes, + consequenceParams.disableTypoToleranceOnAttributes + ) && + Objects.equals( + this.separatorsToIndex, + consequenceParams.separatorsToIndex + ) && + Objects.equals(this.ignorePlurals, consequenceParams.ignorePlurals) && + Objects.equals(this.removeStopWords, consequenceParams.removeStopWords) && + Objects.equals( + this.keepDiacriticsOnCharacters, + consequenceParams.keepDiacriticsOnCharacters + ) && + Objects.equals(this.queryLanguages, consequenceParams.queryLanguages) && + Objects.equals(this.decompoundQuery, consequenceParams.decompoundQuery) && + Objects.equals(this.enableRules, consequenceParams.enableRules) && + Objects.equals( + this.enablePersonalization, + consequenceParams.enablePersonalization + ) && + Objects.equals(this.queryType, consequenceParams.queryType) && + Objects.equals( + this.removeWordsIfNoResults, + consequenceParams.removeWordsIfNoResults + ) && + Objects.equals(this.advancedSyntax, consequenceParams.advancedSyntax) && + Objects.equals(this.optionalWords, consequenceParams.optionalWords) && + Objects.equals( + this.disableExactOnAttributes, + consequenceParams.disableExactOnAttributes + ) && + Objects.equals( + this.exactOnSingleWordQuery, + consequenceParams.exactOnSingleWordQuery + ) && + Objects.equals( + this.alternativesAsExact, + consequenceParams.alternativesAsExact + ) && + Objects.equals( + this.advancedSyntaxFeatures, + consequenceParams.advancedSyntaxFeatures + ) && + Objects.equals(this.distinct, consequenceParams.distinct) && + Objects.equals(this.synonyms, consequenceParams.synonyms) && + 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.attributeCriteriaComputedByMinProximity, + consequenceParams.attributeCriteriaComputedByMinProximity + ) && + Objects.equals(this.renderingContent, consequenceParams.renderingContent) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + query, + automaticFacetFilters, + automaticOptionalFacetFilters, + similarQuery, + filters, + facetFilters, + optionalFilters, + numericFilters, + tagFilters, + sumOrFiltersScores, + facets, + maxValuesPerFacet, + facetingAfterDistinct, + sortFacetValuesBy, + page, + offset, + length, + aroundLatLng, + aroundLatLngViaIP, + aroundRadius, + aroundPrecision, + minimumAroundRadius, + insideBoundingBox, + insidePolygon, + naturalLanguages, + ruleContexts, + personalizationImpact, + userToken, + getRankingInfo, + clickAnalytics, + analytics, + analyticsTags, + percentileComputation, + enableABTest, + enableReRanking, + searchableAttributes, + attributesForFaceting, + unretrievableAttributes, + attributesToRetrieve, + restrictSearchableAttributes, + ranking, + customRanking, + relevancyStrictness, + attributesToHighlight, + attributesToSnippet, + highlightPreTag, + highlightPostTag, + snippetEllipsisText, + restrictHighlightAndSnippetArrays, + hitsPerPage, + minWordSizefor1Typo, + minWordSizefor2Typos, + typoTolerance, + allowTyposOnNumericTokens, + disableTypoToleranceOnAttributes, + separatorsToIndex, + ignorePlurals, + removeStopWords, + keepDiacriticsOnCharacters, + queryLanguages, + decompoundQuery, + enableRules, + enablePersonalization, + queryType, + removeWordsIfNoResults, + advancedSyntax, + optionalWords, + disableExactOnAttributes, + exactOnSingleWordQuery, + alternativesAsExact, + advancedSyntaxFeatures, + distinct, + synonyms, + replaceSynonymsInHighlight, + minProximity, + responseFields, + maxFacetHits, + attributeCriteriaComputedByMinProximity, + renderingContent + ); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConsequenceParams {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb + .append(" automaticFacetFilters: ") + .append(toIndentedString(automaticFacetFilters)) + .append("\n"); + sb + .append(" automaticOptionalFacetFilters: ") + .append(toIndentedString(automaticOptionalFacetFilters)) + .append("\n"); + sb + .append(" similarQuery: ") + .append(toIndentedString(similarQuery)) + .append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb + .append(" facetFilters: ") + .append(toIndentedString(facetFilters)) + .append("\n"); + sb + .append(" optionalFilters: ") + .append(toIndentedString(optionalFilters)) + .append("\n"); + sb + .append(" numericFilters: ") + .append(toIndentedString(numericFilters)) + .append("\n"); + sb + .append(" tagFilters: ") + .append(toIndentedString(tagFilters)) + .append("\n"); + sb + .append(" sumOrFiltersScores: ") + .append(toIndentedString(sumOrFiltersScores)) + .append("\n"); + sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); + sb + .append(" maxValuesPerFacet: ") + .append(toIndentedString(maxValuesPerFacet)) + .append("\n"); + sb + .append(" facetingAfterDistinct: ") + .append(toIndentedString(facetingAfterDistinct)) + .append("\n"); + sb + .append(" sortFacetValuesBy: ") + .append(toIndentedString(sortFacetValuesBy)) + .append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb + .append(" aroundLatLng: ") + .append(toIndentedString(aroundLatLng)) + .append("\n"); + sb + .append(" aroundLatLngViaIP: ") + .append(toIndentedString(aroundLatLngViaIP)) + .append("\n"); + sb + .append(" aroundRadius: ") + .append(toIndentedString(aroundRadius)) + .append("\n"); + sb + .append(" aroundPrecision: ") + .append(toIndentedString(aroundPrecision)) + .append("\n"); + sb + .append(" minimumAroundRadius: ") + .append(toIndentedString(minimumAroundRadius)) + .append("\n"); + sb + .append(" insideBoundingBox: ") + .append(toIndentedString(insideBoundingBox)) + .append("\n"); + sb + .append(" insidePolygon: ") + .append(toIndentedString(insidePolygon)) + .append("\n"); + sb + .append(" naturalLanguages: ") + .append(toIndentedString(naturalLanguages)) + .append("\n"); + sb + .append(" ruleContexts: ") + .append(toIndentedString(ruleContexts)) + .append("\n"); + sb + .append(" personalizationImpact: ") + .append(toIndentedString(personalizationImpact)) + .append("\n"); + sb + .append(" userToken: ") + .append(toIndentedString(userToken)) + .append("\n"); + sb + .append(" getRankingInfo: ") + .append(toIndentedString(getRankingInfo)) + .append("\n"); + sb + .append(" clickAnalytics: ") + .append(toIndentedString(clickAnalytics)) + .append("\n"); + sb + .append(" analytics: ") + .append(toIndentedString(analytics)) + .append("\n"); + sb + .append(" analyticsTags: ") + .append(toIndentedString(analyticsTags)) + .append("\n"); + sb + .append(" percentileComputation: ") + .append(toIndentedString(percentileComputation)) + .append("\n"); + sb + .append(" enableABTest: ") + .append(toIndentedString(enableABTest)) + .append("\n"); + sb + .append(" enableReRanking: ") + .append(toIndentedString(enableReRanking)) + .append("\n"); + sb + .append(" searchableAttributes: ") + .append(toIndentedString(searchableAttributes)) + .append("\n"); + sb + .append(" attributesForFaceting: ") + .append(toIndentedString(attributesForFaceting)) + .append("\n"); + sb + .append(" unretrievableAttributes: ") + .append(toIndentedString(unretrievableAttributes)) + .append("\n"); + sb + .append(" attributesToRetrieve: ") + .append(toIndentedString(attributesToRetrieve)) + .append("\n"); + sb + .append(" restrictSearchableAttributes: ") + .append(toIndentedString(restrictSearchableAttributes)) + .append("\n"); + sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); + sb + .append(" customRanking: ") + .append(toIndentedString(customRanking)) + .append("\n"); + sb + .append(" relevancyStrictness: ") + .append(toIndentedString(relevancyStrictness)) + .append("\n"); + sb + .append(" attributesToHighlight: ") + .append(toIndentedString(attributesToHighlight)) + .append("\n"); + sb + .append(" attributesToSnippet: ") + .append(toIndentedString(attributesToSnippet)) + .append("\n"); + sb + .append(" highlightPreTag: ") + .append(toIndentedString(highlightPreTag)) + .append("\n"); + sb + .append(" highlightPostTag: ") + .append(toIndentedString(highlightPostTag)) + .append("\n"); + sb + .append(" snippetEllipsisText: ") + .append(toIndentedString(snippetEllipsisText)) + .append("\n"); + sb + .append(" restrictHighlightAndSnippetArrays: ") + .append(toIndentedString(restrictHighlightAndSnippetArrays)) + .append("\n"); + sb + .append(" hitsPerPage: ") + .append(toIndentedString(hitsPerPage)) + .append("\n"); + sb + .append(" minWordSizefor1Typo: ") + .append(toIndentedString(minWordSizefor1Typo)) + .append("\n"); + sb + .append(" minWordSizefor2Typos: ") + .append(toIndentedString(minWordSizefor2Typos)) + .append("\n"); + sb + .append(" typoTolerance: ") + .append(toIndentedString(typoTolerance)) + .append("\n"); + sb + .append(" allowTyposOnNumericTokens: ") + .append(toIndentedString(allowTyposOnNumericTokens)) + .append("\n"); + sb + .append(" disableTypoToleranceOnAttributes: ") + .append(toIndentedString(disableTypoToleranceOnAttributes)) + .append("\n"); + sb + .append(" separatorsToIndex: ") + .append(toIndentedString(separatorsToIndex)) + .append("\n"); + sb + .append(" ignorePlurals: ") + .append(toIndentedString(ignorePlurals)) + .append("\n"); + sb + .append(" removeStopWords: ") + .append(toIndentedString(removeStopWords)) + .append("\n"); + sb + .append(" keepDiacriticsOnCharacters: ") + .append(toIndentedString(keepDiacriticsOnCharacters)) + .append("\n"); + sb + .append(" queryLanguages: ") + .append(toIndentedString(queryLanguages)) + .append("\n"); + sb + .append(" decompoundQuery: ") + .append(toIndentedString(decompoundQuery)) + .append("\n"); + sb + .append(" enableRules: ") + .append(toIndentedString(enableRules)) + .append("\n"); + sb + .append(" enablePersonalization: ") + .append(toIndentedString(enablePersonalization)) + .append("\n"); + sb + .append(" queryType: ") + .append(toIndentedString(queryType)) + .append("\n"); + sb + .append(" removeWordsIfNoResults: ") + .append(toIndentedString(removeWordsIfNoResults)) + .append("\n"); + sb + .append(" advancedSyntax: ") + .append(toIndentedString(advancedSyntax)) + .append("\n"); + sb + .append(" optionalWords: ") + .append(toIndentedString(optionalWords)) + .append("\n"); + sb + .append(" disableExactOnAttributes: ") + .append(toIndentedString(disableExactOnAttributes)) + .append("\n"); + sb + .append(" exactOnSingleWordQuery: ") + .append(toIndentedString(exactOnSingleWordQuery)) + .append("\n"); + sb + .append(" alternativesAsExact: ") + .append(toIndentedString(alternativesAsExact)) + .append("\n"); + sb + .append(" advancedSyntaxFeatures: ") + .append(toIndentedString(advancedSyntaxFeatures)) + .append("\n"); + sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); + sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); + 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(" attributeCriteriaComputedByMinProximity: ") + .append(toIndentedString(attributeCriteriaComputedByMinProximity)) + .append("\n"); + sb + .append(" renderingContent: ") + .append(toIndentedString(renderingContent)) + .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/com/algolia/model/RequiredSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RequiredSearchParams.java new file mode 100644 index 0000000000..dd933cb736 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RequiredSearchParams.java @@ -0,0 +1,66 @@ +package com.algolia.model; + +import com.google.gson.annotations.SerializedName; +import java.util.Objects; + +/** RequiredSearchParams */ +public class RequiredSearchParams { + + @SerializedName("query") + private String query = ""; + + public RequiredSearchParams query(String query) { + this.query = query; + return this; + } + + /** + * The text to search in the index. + * + * @return query + */ + @javax.annotation.Nonnull + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = 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/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index 6f1ddeed99..8e6606dd8a 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -17,9 +17,6 @@ public class SearchParams { @SerializedName("params") private String params = ""; - @SerializedName("query") - private String query = ""; - @SerializedName("similarQuery") private String similarQuery = ""; @@ -116,6 +113,9 @@ public class SearchParams { @SerializedName("enableReRanking") private Boolean enableReRanking = true; + @SerializedName("query") + private String query = ""; + @SerializedName("searchableAttributes") private List searchableAttributes = null; @@ -586,25 +586,6 @@ public void setParams(String params) { this.params = params; } - public SearchParams query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - public SearchParams similarQuery(String similarQuery) { this.similarQuery = similarQuery; return this; @@ -1302,6 +1283,25 @@ public void setEnableReRanking(Boolean enableReRanking) { this.enableReRanking = enableReRanking; } + public SearchParams query(String query) { + this.query = query; + return this; + } + + /** + * The text to search in the index. + * + * @return query + */ + @javax.annotation.Nonnull + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + public SearchParams searchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; return this; @@ -2363,7 +2363,6 @@ public boolean equals(Object o) { SearchParams searchParams = (SearchParams) o; return ( Objects.equals(this.params, searchParams.params) && - Objects.equals(this.query, searchParams.query) && Objects.equals(this.similarQuery, searchParams.similarQuery) && Objects.equals(this.filters, searchParams.filters) && Objects.equals(this.facetFilters, searchParams.facetFilters) && @@ -2411,6 +2410,7 @@ public boolean equals(Object o) { ) && Objects.equals(this.enableABTest, searchParams.enableABTest) && Objects.equals(this.enableReRanking, searchParams.enableReRanking) && + Objects.equals(this.query, searchParams.query) && Objects.equals( this.searchableAttributes, searchParams.searchableAttributes @@ -2531,7 +2531,6 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash( params, - query, similarQuery, filters, facetFilters, @@ -2564,6 +2563,7 @@ public int hashCode() { percentileComputation, enableABTest, enableReRanking, + query, searchableAttributes, attributesForFaceting, unretrievableAttributes, @@ -2616,7 +2616,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SearchParams {\n"); sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb .append(" similarQuery: ") .append(toIndentedString(similarQuery)) @@ -2730,6 +2729,7 @@ public String toString() { .append(" enableReRanking: ") .append(toIndentedString(enableReRanking)) .append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb .append(" searchableAttributes: ") .append(toIndentedString(searchableAttributes)) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java index 37138d4502..cd5ed538b5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsObject.java @@ -14,9 +14,6 @@ /** SearchParamsObject */ public class SearchParamsObject { - @SerializedName("query") - private String query = ""; - @SerializedName("similarQuery") private String similarQuery = ""; @@ -113,6 +110,9 @@ public class SearchParamsObject { @SerializedName("enableReRanking") private Boolean enableReRanking = true; + @SerializedName("query") + private String query = ""; + @SerializedName("searchableAttributes") private List searchableAttributes = null; @@ -564,25 +564,6 @@ public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) @SerializedName("renderingContent") private Object renderingContent = new Object(); - public SearchParamsObject query(String query) { - this.query = query; - return this; - } - - /** - * The text to search in the index. - * - * @return query - */ - @javax.annotation.Nonnull - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - public SearchParamsObject similarQuery(String similarQuery) { this.similarQuery = similarQuery; return this; @@ -1290,6 +1271,25 @@ public void setEnableReRanking(Boolean enableReRanking) { this.enableReRanking = enableReRanking; } + public SearchParamsObject query(String query) { + this.query = query; + return this; + } + + /** + * The text to search in the index. + * + * @return query + */ + @javax.annotation.Nonnull + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + public SearchParamsObject searchableAttributes( List searchableAttributes ) { @@ -2358,7 +2358,6 @@ public boolean equals(Object o) { } SearchParamsObject searchParamsObject = (SearchParamsObject) o; return ( - Objects.equals(this.query, searchParamsObject.query) && Objects.equals(this.similarQuery, searchParamsObject.similarQuery) && Objects.equals(this.filters, searchParamsObject.filters) && Objects.equals(this.facetFilters, searchParamsObject.facetFilters) && @@ -2430,6 +2429,7 @@ public boolean equals(Object o) { this.enableReRanking, searchParamsObject.enableReRanking ) && + Objects.equals(this.query, searchParamsObject.query) && Objects.equals( this.searchableAttributes, searchParamsObject.searchableAttributes @@ -2564,7 +2564,6 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - query, similarQuery, filters, facetFilters, @@ -2597,6 +2596,7 @@ public int hashCode() { percentileComputation, enableABTest, enableReRanking, + query, searchableAttributes, attributesForFaceting, unretrievableAttributes, @@ -2648,7 +2648,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SearchParamsObject {\n"); - sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb .append(" similarQuery: ") .append(toIndentedString(similarQuery)) @@ -2762,6 +2761,7 @@ public String toString() { .append(" enableReRanking: ") .append(toIndentedString(enableReRanking)) .append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb .append(" searchableAttributes: ") .append(toIndentedString(searchableAttributes)) diff --git a/clients/algoliasearch-client-javascript/client-insights/model/insightEvent.ts b/clients/algoliasearch-client-javascript/client-insights/model/insightEvent.ts index fde9c5580c..9260226fba 100644 --- a/clients/algoliasearch-client-javascript/client-insights/model/insightEvent.ts +++ b/clients/algoliasearch-client-javascript/client-insights/model/insightEvent.ts @@ -5,7 +5,7 @@ export type InsightEvent = { /** * An eventType can be a click, a conversion, or a view. */ - eventType: InsightEvent.EventTypeEnum; + eventType: InsightEventEventType; /** * A user-defined string used to categorize events. */ @@ -40,10 +40,4 @@ export type InsightEvent = { positions?: number[]; }; -export namespace InsightEvent { - export enum EventTypeEnum { - Click = 'click', - Conversion = 'conversion', - View = 'view', - } -} +export type InsightEventEventType = 'click' | 'conversion' | 'view'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/action.ts b/clients/algoliasearch-client-javascript/client-search/model/action.ts index 49e679e3ce..7f1a4fb16b 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/action.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/action.ts @@ -1,12 +1,12 @@ /** * Type of operation. */ -export enum Action { - AddObject = 'addObject', - UpdateObject = 'updateObject', - PartialUpdateObject = 'partialUpdateObject', - PartialUpdateObjectNoCreate = 'partialUpdateObjectNoCreate', - DeleteObject = 'deleteObject', - Delete = 'delete', - Clear = 'clear', -} + +export type Action = + | 'addObject' + | 'clear' + | 'delete' + | 'deleteObject' + | 'partialUpdateObject' + | 'partialUpdateObjectNoCreate' + | 'updateObject'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/anchoring.ts b/clients/algoliasearch-client-javascript/client-search/model/anchoring.ts index 46fd248e5a..80d51f78be 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/anchoring.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/anchoring.ts @@ -1,9 +1,5 @@ /** * Whether the pattern parameter must match the beginning or the end of the query string, or both, or none. */ -export enum Anchoring { - Is = 'is', - StartsWith = 'startsWith', - EndsWith = 'endsWith', - Contains = 'contains', -} + +export type Anchoring = 'contains' | 'endsWith' | 'is' | 'startsWith'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/apiKey.ts b/clients/algoliasearch-client-javascript/client-search/model/apiKey.ts index b514ca853a..4dff62ed0e 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/apiKey.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/apiKey.ts @@ -5,7 +5,7 @@ export type ApiKey = { /** * Set of permissions associated with the key. */ - acl: ApiKey.AclEnum[]; + acl: ApiKeyAcl[]; /** * A comment used to identify a key more easily in the dashboard. It is not interpreted by the API. */ @@ -36,21 +36,18 @@ export type ApiKey = { validity?: number; }; -export namespace ApiKey { - export enum AclEnum { - AddObject = 'addObject', - Analytics = 'analytics', - Browse = 'browse', - DeleteObject = 'deleteObject', - DeleteIndex = 'deleteIndex', - EditSettings = 'editSettings', - ListIndexes = 'listIndexes', - Logs = 'logs', - Personalization = 'personalization', - Recommendation = 'recommendation', - Search = 'search', - SeeUnretrievableAttributes = 'seeUnretrievableAttributes', - Settings = 'settings', - Usage = 'usage', - } -} +export type ApiKeyAcl = + | 'addObject' + | 'analytics' + | 'browse' + | 'deleteIndex' + | 'deleteObject' + | 'editSettings' + | 'listIndexes' + | 'logs' + | 'personalization' + | 'recommendation' + | 'search' + | 'seeUnretrievableAttributes' + | 'settings' + | 'usage'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts index 57083d9194..8bf1730be7 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts @@ -1,8 +1,4 @@ export type BaseSearchParams = { - /** - * The text to search in the index. - */ - query: string; /** * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. */ diff --git a/clients/algoliasearch-client-javascript/client-search/model/batchDictionaryEntriesRequest.ts b/clients/algoliasearch-client-javascript/client-search/model/batchDictionaryEntriesRequest.ts index db04c502ad..86c96f303d 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/batchDictionaryEntriesRequest.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/batchDictionaryEntriesRequest.ts @@ -4,13 +4,8 @@ export type BatchDictionaryEntriesRequest = { /** * Actions to perform. */ - action: BatchDictionaryEntriesRequest.ActionEnum; + action: BatchDictionaryEntriesRequestAction; body: DictionaryEntry; }; -export namespace BatchDictionaryEntriesRequest { - export enum ActionEnum { - AddEntry = 'addEntry', - DeleteEntry = 'deleteEntry', - } -} +export type BatchDictionaryEntriesRequestAction = 'addEntry' | 'deleteEntry'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/buildInOperation.ts b/clients/algoliasearch-client-javascript/client-search/model/buildInOperation.ts index e933587441..aece8eb00d 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/buildInOperation.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/buildInOperation.ts @@ -5,21 +5,18 @@ export type BuildInOperation = { /** * The operation to apply on the attribute. */ - _operation: BuildInOperation.OperationEnum; + _operation: BuildInOperationOperation; /** * The right-hand side argument to the operation, for example, increment or decrement step, value to add or remove. */ value: string; }; -export namespace BuildInOperation { - export enum OperationEnum { - Increment = 'Increment', - Decrement = 'Decrement', - Add = 'Add', - Remove = 'Remove', - AddUnique = 'AddUnique', - IncrementFrom = 'IncrementFrom', - IncrementSet = 'IncrementSet', - } -} +export type BuildInOperationOperation = + | 'Add' + | 'AddUnique' + | 'Decrement' + | 'Increment' + | 'IncrementFrom' + | 'IncrementSet' + | 'Remove'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/consequence.ts b/clients/algoliasearch-client-javascript/client-search/model/consequence.ts index 8daa8b2c90..827a33bcb5 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/consequence.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/consequence.ts @@ -1,12 +1,12 @@ import type { ConsequenceHide } from './consequenceHide'; -import type { Params } from './params'; +import type { ConsequenceParams } from './consequenceParams'; import type { Promote } from './promote'; /** * Consequence of the Rule. */ export type Consequence = { - params?: Params; + params?: ConsequenceParams; /** * Objects to promote as hits. */ diff --git a/clients/algoliasearch-client-javascript/client-search/model/consequenceParams.ts b/clients/algoliasearch-client-javascript/client-search/model/consequenceParams.ts new file mode 100644 index 0000000000..af531bb25a --- /dev/null +++ b/clients/algoliasearch-client-javascript/client-search/model/consequenceParams.ts @@ -0,0 +1,7 @@ +import type { BaseSearchParams } from './baseSearchParams'; +import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; +import type { Params } from './params'; + +export type ConsequenceParams = BaseSearchParams & + IndexSettingsAsSearchParams & + Params; diff --git a/clients/algoliasearch-client-javascript/client-search/model/dictionaryEntry.ts b/clients/algoliasearch-client-javascript/client-search/model/dictionaryEntry.ts index a8ef96eca9..dd8bd81417 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/dictionaryEntry.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/dictionaryEntry.ts @@ -25,12 +25,7 @@ export type DictionaryEntry = { /** * The state of the dictionary entry. */ - state?: DictionaryEntry.StateEnum; + state?: DictionaryEntryState; }; -export namespace DictionaryEntry { - export enum StateEnum { - Enabled = 'enabled', - Disabled = 'disabled', - } -} +export type DictionaryEntryState = 'disabled' | 'enabled'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/getTaskResponse.ts b/clients/algoliasearch-client-javascript/client-search/model/getTaskResponse.ts index 037e2d8d51..a08aabf7a1 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/getTaskResponse.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/getTaskResponse.ts @@ -1,10 +1,5 @@ export type GetTaskResponse = { - status: GetTaskResponse.StatusEnum; + status: GetTaskResponseStatus; }; -export namespace GetTaskResponse { - export enum StatusEnum { - Published = 'published', - NotPublished = 'notPublished', - } -} +export type GetTaskResponseStatus = 'notPublished' | 'published'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/highlightResult.ts b/clients/algoliasearch-client-javascript/client-search/model/highlightResult.ts index e184f528ca..a878792c6d 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/highlightResult.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/highlightResult.ts @@ -9,7 +9,7 @@ export type HighlightResult = { /** * Indicates how well the attribute matched the search query. */ - matchLevel?: HighlightResult.MatchLevelEnum; + matchLevel?: HighlightResultMatchLevel; /** * List of words from the query that matched the object. */ @@ -20,10 +20,4 @@ export type HighlightResult = { fullyHighlighted?: boolean; }; -export namespace HighlightResult { - export enum MatchLevelEnum { - None = 'none', - Partial = 'partial', - Full = 'full', - } -} +export type HighlightResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/indexSettingsAsSearchParams.ts b/clients/algoliasearch-client-javascript/client-search/model/indexSettingsAsSearchParams.ts index 85cea282b5..00a227aa03 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/indexSettingsAsSearchParams.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/indexSettingsAsSearchParams.ts @@ -70,7 +70,7 @@ export type IndexSettingsAsSearchParams = { /** * Controls whether typo tolerance is enabled and how it is applied. */ - typoTolerance?: IndexSettingsAsSearchParams.TypoToleranceEnum; + typoTolerance?: IndexSettingsAsSearchParamsTypoTolerance; /** * Whether to allow typos on numbers (\"numeric tokens\") in the query string. */ @@ -114,11 +114,11 @@ export type IndexSettingsAsSearchParams = { /** * Controls if and how query words are interpreted as prefixes. */ - queryType?: IndexSettingsAsSearchParams.QueryTypeEnum; + queryType?: IndexSettingsAsSearchParamsQueryType; /** * Selects a strategy to remove words from the query when it doesn\'t match any hits. */ - removeWordsIfNoResults?: IndexSettingsAsSearchParams.RemoveWordsIfNoResultsEnum; + removeWordsIfNoResults?: IndexSettingsAsSearchParamsRemoveWordsIfNoResults; /** * Enables the advanced query syntax. */ @@ -134,15 +134,15 @@ export type IndexSettingsAsSearchParams = { /** * Controls how the exact ranking criterion is computed when the query contains only one word. */ - exactOnSingleWordQuery?: IndexSettingsAsSearchParams.ExactOnSingleWordQueryEnum; + exactOnSingleWordQuery?: IndexSettingsAsSearchParamsExactOnSingleWordQuery; /** * List of alternatives that should be considered an exact match by the exact ranking criterion. */ - alternativesAsExact?: IndexSettingsAsSearchParams.AlternativesAsExactEnum[]; + alternativesAsExact?: IndexSettingsAsSearchParamsAlternativesAsExact[]; /** * Allows you to specify which advanced syntax features are active when ‘advancedSyntax\' is enabled. */ - advancedSyntaxFeatures?: IndexSettingsAsSearchParams.AdvancedSyntaxFeaturesEnum[]; + advancedSyntaxFeatures?: IndexSettingsAsSearchParamsAdvancedSyntaxFeatures[]; /** * Enables de-duplication or grouping of results. */ @@ -177,36 +177,33 @@ export type IndexSettingsAsSearchParams = { renderingContent?: Record; }; -export namespace IndexSettingsAsSearchParams { - export enum TypoToleranceEnum { - True = 'true', - False = 'false', - Min = 'min', - Strict = 'strict', - } - export enum QueryTypeEnum { - PrefixLast = 'prefixLast', - PrefixAll = 'prefixAll', - PrefixNone = 'prefixNone', - } - export enum RemoveWordsIfNoResultsEnum { - None = 'none', - LastWords = 'lastWords', - FirstWords = 'firstWords', - AllOptional = 'allOptional', - } - export enum ExactOnSingleWordQueryEnum { - Attribute = 'attribute', - None = 'none', - Word = 'word', - } - export enum AlternativesAsExactEnum { - IgnorePlurals = 'ignorePlurals', - SingleWordSynonym = 'singleWordSynonym', - MultiWordsSynonym = 'multiWordsSynonym', - } - export enum AdvancedSyntaxFeaturesEnum { - ExactPhrase = 'exactPhrase', - ExcludeWords = 'excludeWords', - } -} +export type IndexSettingsAsSearchParamsTypoTolerance = + | 'false' + | 'min' + | 'strict' + | 'true'; + +export type IndexSettingsAsSearchParamsQueryType = + | 'prefixAll' + | 'prefixLast' + | 'prefixNone'; + +export type IndexSettingsAsSearchParamsRemoveWordsIfNoResults = + | 'allOptional' + | 'firstWords' + | 'lastWords' + | 'none'; + +export type IndexSettingsAsSearchParamsExactOnSingleWordQuery = + | 'attribute' + | 'none' + | 'word'; + +export type IndexSettingsAsSearchParamsAlternativesAsExact = + | 'ignorePlurals' + | 'multiWordsSynonym' + | 'singleWordSynonym'; + +export type IndexSettingsAsSearchParamsAdvancedSyntaxFeatures = + | 'exactPhrase' + | 'excludeWords'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/models.ts b/clients/algoliasearch-client-javascript/client-search/model/models.ts index f16aa3e5f4..fd07b0f208 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/models.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/models.ts @@ -24,6 +24,7 @@ export * from './buildInOperation'; export * from './condition'; export * from './consequence'; export * from './consequenceHide'; +export * from './consequenceParams'; export * from './createdAtObject'; export * from './createdAtResponse'; export * from './deleteApiKeyResponse'; @@ -65,6 +66,7 @@ export * from './rankingInfoMatchedGeoLocation'; export * from './record'; export * from './removeUserIdResponse'; export * from './replaceSourceResponse'; +export * from './requiredSearchParams'; export * from './rule'; export * from './saveObjectResponse'; export * from './saveSynonymResponse'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/multipleQueries.ts b/clients/algoliasearch-client-javascript/client-search/model/multipleQueries.ts index 4e1db9f448..42931f8578 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/multipleQueries.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/multipleQueries.ts @@ -10,7 +10,7 @@ export type MultipleQueries = { /** * Perform a search query with `default`, will search for facet values if `facet` is given. */ - type?: MultipleQueries.TypeEnum; + type?: MultipleQueriesType; /** * The `facet` name. */ @@ -21,9 +21,4 @@ export type MultipleQueries = { params?: string; }; -export namespace MultipleQueries { - export enum TypeEnum { - Default = 'default', - Facet = 'facet', - } -} +export type MultipleQueriesType = 'default' | 'facet'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/multipleQueriesObject.ts b/clients/algoliasearch-client-javascript/client-search/model/multipleQueriesObject.ts index 10fc4127e1..cf2d35ac7d 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/multipleQueriesObject.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/multipleQueriesObject.ts @@ -2,12 +2,7 @@ import type { MultipleQueries } from './multipleQueries'; export type MultipleQueriesObject = { requests: MultipleQueries[]; - strategy?: MultipleQueriesObject.StrategyEnum; + strategy?: MultipleQueriesObjectStrategy; }; -export namespace MultipleQueriesObject { - export enum StrategyEnum { - None = 'none', - StopIfEnoughMatches = 'stopIfEnoughMatches', - } -} +export type MultipleQueriesObjectStrategy = 'none' | 'stopIfEnoughMatches'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/operationIndexObject.ts b/clients/algoliasearch-client-javascript/client-search/model/operationIndexObject.ts index b9e51d1194..c7a19c0c6b 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/operationIndexObject.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/operationIndexObject.ts @@ -2,7 +2,7 @@ export type OperationIndexObject = { /** * Type of operation to perform (move or copy). */ - operation: OperationIndexObject.OperationEnum; + operation: OperationIndexObjectOperation; /** * The Algolia index name. */ @@ -10,17 +10,9 @@ export type OperationIndexObject = { /** * Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied. */ - scope?: OperationIndexObject.ScopeEnum[]; + scope?: OperationIndexObjectScope[]; }; -export namespace OperationIndexObject { - export enum OperationEnum { - Move = 'move', - Copy = 'copy', - } - export enum ScopeEnum { - Settings = 'settings', - Synonyms = 'synonyms', - Rules = 'rules', - } -} +export type OperationIndexObjectOperation = 'copy' | 'move'; + +export type OperationIndexObjectScope = 'rules' | 'settings' | 'synonyms'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/client-search/model/requiredSearchParams.ts new file mode 100644 index 0000000000..411ca99b94 --- /dev/null +++ b/clients/algoliasearch-client-javascript/client-search/model/requiredSearchParams.ts @@ -0,0 +1,6 @@ +export type RequiredSearchParams = { + /** + * The text to search in the index. + */ + query: string; +}; diff --git a/clients/algoliasearch-client-javascript/client-search/model/searchParamsObject.ts b/clients/algoliasearch-client-javascript/client-search/model/searchParamsObject.ts index 626a977f7b..ad8f80c073 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/searchParamsObject.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/searchParamsObject.ts @@ -1,4 +1,7 @@ import type { BaseSearchParams } from './baseSearchParams'; import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; +import type { RequiredSearchParams } from './requiredSearchParams'; -export type SearchParamsObject = BaseSearchParams & IndexSettingsAsSearchParams; +export type SearchParamsObject = BaseSearchParams & + IndexSettingsAsSearchParams & + RequiredSearchParams; diff --git a/clients/algoliasearch-client-javascript/client-search/model/snippetResult.ts b/clients/algoliasearch-client-javascript/client-search/model/snippetResult.ts index d4fd65bce0..0f8d17bc3d 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/snippetResult.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/snippetResult.ts @@ -6,13 +6,7 @@ export type SnippetResult = { /** * Indicates how well the attribute matched the search query. */ - matchLevel?: SnippetResult.MatchLevelEnum; + matchLevel?: SnippetResultMatchLevel; }; -export namespace SnippetResult { - export enum MatchLevelEnum { - None = 'none', - Partial = 'partial', - Full = 'full', - } -} +export type SnippetResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/client-search/model/synonymHit.ts b/clients/algoliasearch-client-javascript/client-search/model/synonymHit.ts index 990865f1ca..becd50b026 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/synonymHit.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/synonymHit.ts @@ -11,7 +11,7 @@ export type SynonymHit = { /** * Type of the synonym object. */ - type: SynonymHit.TypeEnum; + type: SynonymHitType; /** * Words or phrases to be considered equivalent. */ @@ -39,12 +39,9 @@ export type SynonymHit = { _highlightResult?: SynonymHitHighlightResult; }; -export namespace SynonymHit { - export enum TypeEnum { - Synonym = 'synonym', - Onewaysynonym = 'onewaysynonym', - Altcorrection1 = 'altcorrection1', - Altcorrection2 = 'altcorrection2', - Placeholder = 'placeholder', - } -} +export type SynonymHitType = + | 'altcorrection1' + | 'altcorrection2' + | 'onewaysynonym' + | 'placeholder' + | 'synonym'; diff --git a/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts index 57083d9194..8bf1730be7 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts @@ -1,8 +1,4 @@ export type BaseSearchParams = { - /** - * The text to search in the index. - */ - query: string; /** * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. */ diff --git a/clients/algoliasearch-client-javascript/recommend/model/highlightResult.ts b/clients/algoliasearch-client-javascript/recommend/model/highlightResult.ts index e184f528ca..a878792c6d 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/highlightResult.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/highlightResult.ts @@ -9,7 +9,7 @@ export type HighlightResult = { /** * Indicates how well the attribute matched the search query. */ - matchLevel?: HighlightResult.MatchLevelEnum; + matchLevel?: HighlightResultMatchLevel; /** * List of words from the query that matched the object. */ @@ -20,10 +20,4 @@ export type HighlightResult = { fullyHighlighted?: boolean; }; -export namespace HighlightResult { - export enum MatchLevelEnum { - None = 'none', - Partial = 'partial', - Full = 'full', - } -} +export type HighlightResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/clients/algoliasearch-client-javascript/recommend/model/indexSettingsAsSearchParams.ts b/clients/algoliasearch-client-javascript/recommend/model/indexSettingsAsSearchParams.ts index 85cea282b5..00a227aa03 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/indexSettingsAsSearchParams.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/indexSettingsAsSearchParams.ts @@ -70,7 +70,7 @@ export type IndexSettingsAsSearchParams = { /** * Controls whether typo tolerance is enabled and how it is applied. */ - typoTolerance?: IndexSettingsAsSearchParams.TypoToleranceEnum; + typoTolerance?: IndexSettingsAsSearchParamsTypoTolerance; /** * Whether to allow typos on numbers (\"numeric tokens\") in the query string. */ @@ -114,11 +114,11 @@ export type IndexSettingsAsSearchParams = { /** * Controls if and how query words are interpreted as prefixes. */ - queryType?: IndexSettingsAsSearchParams.QueryTypeEnum; + queryType?: IndexSettingsAsSearchParamsQueryType; /** * Selects a strategy to remove words from the query when it doesn\'t match any hits. */ - removeWordsIfNoResults?: IndexSettingsAsSearchParams.RemoveWordsIfNoResultsEnum; + removeWordsIfNoResults?: IndexSettingsAsSearchParamsRemoveWordsIfNoResults; /** * Enables the advanced query syntax. */ @@ -134,15 +134,15 @@ export type IndexSettingsAsSearchParams = { /** * Controls how the exact ranking criterion is computed when the query contains only one word. */ - exactOnSingleWordQuery?: IndexSettingsAsSearchParams.ExactOnSingleWordQueryEnum; + exactOnSingleWordQuery?: IndexSettingsAsSearchParamsExactOnSingleWordQuery; /** * List of alternatives that should be considered an exact match by the exact ranking criterion. */ - alternativesAsExact?: IndexSettingsAsSearchParams.AlternativesAsExactEnum[]; + alternativesAsExact?: IndexSettingsAsSearchParamsAlternativesAsExact[]; /** * Allows you to specify which advanced syntax features are active when ‘advancedSyntax\' is enabled. */ - advancedSyntaxFeatures?: IndexSettingsAsSearchParams.AdvancedSyntaxFeaturesEnum[]; + advancedSyntaxFeatures?: IndexSettingsAsSearchParamsAdvancedSyntaxFeatures[]; /** * Enables de-duplication or grouping of results. */ @@ -177,36 +177,33 @@ export type IndexSettingsAsSearchParams = { renderingContent?: Record; }; -export namespace IndexSettingsAsSearchParams { - export enum TypoToleranceEnum { - True = 'true', - False = 'false', - Min = 'min', - Strict = 'strict', - } - export enum QueryTypeEnum { - PrefixLast = 'prefixLast', - PrefixAll = 'prefixAll', - PrefixNone = 'prefixNone', - } - export enum RemoveWordsIfNoResultsEnum { - None = 'none', - LastWords = 'lastWords', - FirstWords = 'firstWords', - AllOptional = 'allOptional', - } - export enum ExactOnSingleWordQueryEnum { - Attribute = 'attribute', - None = 'none', - Word = 'word', - } - export enum AlternativesAsExactEnum { - IgnorePlurals = 'ignorePlurals', - SingleWordSynonym = 'singleWordSynonym', - MultiWordsSynonym = 'multiWordsSynonym', - } - export enum AdvancedSyntaxFeaturesEnum { - ExactPhrase = 'exactPhrase', - ExcludeWords = 'excludeWords', - } -} +export type IndexSettingsAsSearchParamsTypoTolerance = + | 'false' + | 'min' + | 'strict' + | 'true'; + +export type IndexSettingsAsSearchParamsQueryType = + | 'prefixAll' + | 'prefixLast' + | 'prefixNone'; + +export type IndexSettingsAsSearchParamsRemoveWordsIfNoResults = + | 'allOptional' + | 'firstWords' + | 'lastWords' + | 'none'; + +export type IndexSettingsAsSearchParamsExactOnSingleWordQuery = + | 'attribute' + | 'none' + | 'word'; + +export type IndexSettingsAsSearchParamsAlternativesAsExact = + | 'ignorePlurals' + | 'multiWordsSynonym' + | 'singleWordSynonym'; + +export type IndexSettingsAsSearchParamsAdvancedSyntaxFeatures = + | 'exactPhrase' + | 'excludeWords'; diff --git a/clients/algoliasearch-client-javascript/recommend/model/models.ts b/clients/algoliasearch-client-javascript/recommend/model/models.ts index 6d519ccfb5..f1ceaba6b7 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/models.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/models.ts @@ -15,6 +15,8 @@ export * from './recommendHits'; export * from './recommendRecord'; export * from './recommendationRequest'; export * from './recommendationsResponse'; +export * from './requiredSearchParams'; +export * from './searchParams'; export * from './snippetResult'; export interface Authentication { diff --git a/clients/algoliasearch-client-javascript/recommend/model/recommendationRequest.ts b/clients/algoliasearch-client-javascript/recommend/model/recommendationRequest.ts index b87f44b999..9faca27372 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/recommendationRequest.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/recommendationRequest.ts @@ -1,5 +1,4 @@ -import type { BaseSearchParams } from './baseSearchParams'; -import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; +import type { SearchParams } from './searchParams'; export type RecommendationRequest = { /** @@ -13,7 +12,7 @@ export type RecommendationRequest = { /** * The recommendation model to use. */ - model: RecommendationRequest.ModelEnum; + model: RecommendationRequestModel; /** * The threshold to use when filtering recommendations by their score. */ @@ -22,19 +21,8 @@ export type RecommendationRequest = { * The max number of recommendations to retrieve. If it\'s set to 0, all the recommendations of the objectID may be returned. */ maxRecommendations?: number; - /** - * The Algolia search parameters. - */ - queryParameters?: (BaseSearchParams & IndexSettingsAsSearchParams) | null; - /** - * The Algolia search parameters when there are no recommendations. - */ - fallbackParameters?: (BaseSearchParams & IndexSettingsAsSearchParams) | null; + queryParameters?: SearchParams; + fallbackParameters?: SearchParams; }; -export namespace RecommendationRequest { - export enum ModelEnum { - RelatedProducts = 'related-products', - BoughtTogether = 'bought-together', - } -} +export type RecommendationRequestModel = 'bought-together' | 'related-products'; diff --git a/clients/algoliasearch-client-javascript/recommend/model/requiredSearchParams.ts b/clients/algoliasearch-client-javascript/recommend/model/requiredSearchParams.ts new file mode 100644 index 0000000000..411ca99b94 --- /dev/null +++ b/clients/algoliasearch-client-javascript/recommend/model/requiredSearchParams.ts @@ -0,0 +1,6 @@ +export type RequiredSearchParams = { + /** + * The text to search in the index. + */ + query: string; +}; diff --git a/clients/algoliasearch-client-javascript/recommend/model/searchParams.ts b/clients/algoliasearch-client-javascript/recommend/model/searchParams.ts new file mode 100644 index 0000000000..127265c98f --- /dev/null +++ b/clients/algoliasearch-client-javascript/recommend/model/searchParams.ts @@ -0,0 +1,7 @@ +import type { BaseSearchParams } from './baseSearchParams'; +import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams'; +import type { RequiredSearchParams } from './requiredSearchParams'; + +export type SearchParams = BaseSearchParams & + IndexSettingsAsSearchParams & + RequiredSearchParams; diff --git a/clients/algoliasearch-client-javascript/recommend/model/snippetResult.ts b/clients/algoliasearch-client-javascript/recommend/model/snippetResult.ts index d4fd65bce0..0f8d17bc3d 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/snippetResult.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/snippetResult.ts @@ -6,13 +6,7 @@ export type SnippetResult = { /** * Indicates how well the attribute matched the search query. */ - matchLevel?: SnippetResult.MatchLevelEnum; + matchLevel?: SnippetResultMatchLevel; }; -export namespace SnippetResult { - export enum MatchLevelEnum { - None = 'none', - Partial = 'partial', - Full = 'full', - } -} +export type SnippetResultMatchLevel = 'full' | 'none' | 'partial'; diff --git a/specs/recommend/common/schemas/SearchParams.yml b/specs/recommend/common/schemas/SearchParams.yml new file mode 100644 index 0000000000..fc53838b64 --- /dev/null +++ b/specs/recommend/common/schemas/SearchParams.yml @@ -0,0 +1,14 @@ +searchParams: + allOf: + - $ref: '#/baseSearchParams' + - $ref: '#/requiredSearchParams' + - $ref: '#/indexSettingsAsSearchParams' + +baseSearchParams: + $ref: '../../../search/common/schemas/SearchParams.yml#/baseSearchParams' + +requiredSearchParams: + $ref: '../../../search/common/schemas/SearchParams.yml#/requiredSearchParams' + +indexSettingsAsSearchParams: + $ref: '../../../search/common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams' diff --git a/specs/recommend/paths/getRecommendations.yml b/specs/recommend/paths/getRecommendations.yml index a6c265e356..9339ba5f3e 100644 --- a/specs/recommend/paths/getRecommendations.yml +++ b/specs/recommend/paths/getRecommendations.yml @@ -39,15 +39,9 @@ post: default: 0 description: The max number of recommendations to retrieve. If it's set to 0, all the recommendations of the objectID may be returned. queryParameters: - description: The Algolia search parameters. - allOf: - - $ref: '../../search/common/schemas/SearchParams.yml#/baseSearchParams' - - $ref: '../../search/common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams' + $ref: '../common/schemas/SearchParams.yml#/searchParams' fallbackParameters: - description: The Algolia search parameters when there are no recommendations. - allOf: - - $ref: '../../search/common/schemas/SearchParams.yml#/baseSearchParams' - - $ref: '../../search/common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams' + $ref: '../common/schemas/SearchParams.yml#/searchParams' required: - model - indexName diff --git a/specs/search/common/schemas/SearchParams.yml b/specs/search/common/schemas/SearchParams.yml index 0b71956c95..77da247bd7 100644 --- a/specs/search/common/schemas/SearchParams.yml +++ b/specs/search/common/schemas/SearchParams.yml @@ -5,10 +5,11 @@ searchParams: searchParamsObject: allOf: - - $ref: '../../common/schemas/SearchParams.yml#/baseSearchParams' + - $ref: '#/baseSearchParams' + - $ref: '#/requiredSearchParams' - $ref: '../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams' -baseSearchParams: +requiredSearchParams: type: object additionalProperties: false required: @@ -16,6 +17,11 @@ baseSearchParams: 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/paths/rules/common/schemas.yml b/specs/search/paths/rules/common/schemas.yml index 215fc635fa..71b7dc9d4e 100644 --- a/specs/search/paths/rules/common/schemas.yml +++ b/specs/search/paths/rules/common/schemas.yml @@ -56,7 +56,7 @@ consequence: additionalProperties: false properties: params: - $ref: '#/params' + $ref: '#/consequenceParams' promote: type: array description: Objects to promote as hits. @@ -83,6 +83,12 @@ consequence: description: Custom JSON object that will be appended to the userData array in the response. This object isn't interpreted by the API. It's limited to 1kB of minified JSON. additionalProperties: true +consequenceParams: + allOf: + - $ref: '#/params' + - $ref: '../../../common/schemas/SearchParams.yml#/baseSearchParams' + - $ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams' + promote: type: object description: Object to promote as hits. diff --git a/templates/javascript/model.mustache b/templates/javascript/model.mustache index 13d2a34c83..6abed90791 100644 --- a/templates/javascript/model.mustache +++ b/templates/javascript/model.mustache @@ -26,35 +26,25 @@ export type {{classname}} = { * {{{description}}} */ {{/description}} - {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; + {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{classname}}{{{nameInCamelCase}}}{{#isArray}}[]{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; {{/vars}} } {{#hasEnums}} -export namespace {{classname}} { {{#vars}} {{#isEnum}} - export enum {{enumName}} { - {{#allowableValues}} - {{#enumVars}} - {{name}} = {{{value}}}{{^-last}},{{/-last}} - {{/enumVars}} - {{/allowableValues}} - } +export type {{classname}}{{nameInCamelCase}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}|{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/isEnum}} {{/vars}} -} {{/hasEnums}} {{/isEnum}} + {{#isEnum}} -export enum {{classname}} { - {{#allowableValues}} - {{#enumVars}} - {{name}} = {{{value}}}{{^-last}},{{/-last}} - {{/enumVars}} - {{/allowableValues}} -} +export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}|{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/isEnum}} + {{/interfaces}} {{/model}} {{/models}} diff --git a/tests/CTS/clients/recommend/getRecommendations.json b/tests/CTS/clients/recommend/getRecommendations.json index d40432fdbe..ddab8c7c77 100644 --- a/tests/CTS/clients/recommend/getRecommendations.json +++ b/tests/CTS/clients/recommend/getRecommendations.json @@ -41,14 +41,12 @@ "model": "related-products", "threshold": 42, "queryParameters": { - "facetFilters": [ - "query" - ] + "query": "myQuery", + "facetFilters": ["query"] }, "fallbackParameters": { - "facetFilters": [ - "fallback" - ] + "query": "myQuery", + "facetFilters": ["fallback"] } } ] @@ -65,14 +63,12 @@ "model": "related-products", "threshold": 42, "queryParameters": { - "facetFilters": [ - "query" - ] + "query": "myQuery", + "facetFilters": ["query"] }, "fallbackParameters": { - "facetFilters": [ - "fallback" - ] + "query": "myQuery", + "facetFilters": ["fallback"] } } ] @@ -133,14 +129,12 @@ "model": "related-products", "threshold": 21, "queryParameters": { - "facetFilters": [ - "query1" - ] + "query": "myQuery", + "facetFilters": ["query1"] }, "fallbackParameters": { - "facetFilters": [ - "fallback1" - ] + "query": "myQuery", + "facetFilters": ["fallback1"] } }, { @@ -149,14 +143,12 @@ "model": "related-products", "threshold": 21, "queryParameters": { - "facetFilters": [ - "query2" - ] + "query": "myQuery", + "facetFilters": ["query2"] }, "fallbackParameters": { - "facetFilters": [ - "fallback2" - ] + "query": "myQuery", + "facetFilters": ["fallback2"] } } ] @@ -173,14 +165,12 @@ "model": "related-products", "threshold": 21, "queryParameters": { - "facetFilters": [ - "query1" - ] + "query": "myQuery", + "facetFilters": ["query1"] }, "fallbackParameters": { - "facetFilters": [ - "fallback1" - ] + "query": "myQuery", + "facetFilters": ["fallback1"] } }, { @@ -189,14 +179,12 @@ "model": "related-products", "threshold": 21, "queryParameters": { - "facetFilters": [ - "query2" - ] + "query": "myQuery", + "facetFilters": ["query2"] }, "fallbackParameters": { - "facetFilters": [ - "fallback2" - ] + "query": "myQuery", + "facetFilters": ["fallback2"] } } ] diff --git a/tests/CTS/clients/search/batchDictionaryEntries.json b/tests/CTS/clients/search/batchDictionaryEntries.json index 15fb381ef1..689ae8a59c 100644 --- a/tests/CTS/clients/search/batchDictionaryEntries.json +++ b/tests/CTS/clients/search/batchDictionaryEntries.json @@ -3,7 +3,7 @@ "method": "batchDictionaryEntries", "testName": "get batchDictionaryEntries results with minimal parameters", "parameters": { - "dictionaryName": "dictionaryName", + "dictionaryName": "compounds", "batchDictionaryEntries": { "requests": [ { @@ -24,7 +24,7 @@ } }, "request": { - "path": "/1/dictionaries/dictionaryName/batch", + "path": "/1/dictionaries/compounds/batch", "method": "POST", "data": { "requests": [ @@ -50,7 +50,7 @@ "method": "batchDictionaryEntries", "testName": "get batchDictionaryEntries results with all parameters", "parameters": { - "dictionaryName": "dictionaryName", + "dictionaryName": "compounds", "batchDictionaryEntries": { "clearExistingDictionaryEntries": false, "requests": [ @@ -60,14 +60,8 @@ "objectID": "1", "language": "en", "word": "yo", - "words": [ - "yo", - "algolia" - ], - "decomposition": [ - "yo", - "algolia" - ], + "words": ["yo", "algolia"], + "decomposition": ["yo", "algolia"], "state": "enabled" } }, @@ -77,14 +71,8 @@ "objectID": "2", "language": "fr", "word": "salut", - "words": [ - "salut", - "algolia" - ], - "decomposition": [ - "salut", - "algolia" - ], + "words": ["salut", "algolia"], + "decomposition": ["salut", "algolia"], "state": "enabled" } } @@ -92,7 +80,7 @@ } }, "request": { - "path": "/1/dictionaries/dictionaryName/batch", + "path": "/1/dictionaries/compounds/batch", "method": "POST", "data": { "clearExistingDictionaryEntries": false, @@ -103,14 +91,8 @@ "objectID": "1", "language": "en", "word": "yo", - "words": [ - "yo", - "algolia" - ], - "decomposition": [ - "yo", - "algolia" - ], + "words": ["yo", "algolia"], + "decomposition": ["yo", "algolia"], "state": "enabled" } }, @@ -120,14 +102,8 @@ "objectID": "2", "language": "fr", "word": "salut", - "words": [ - "salut", - "algolia" - ], - "decomposition": [ - "salut", - "algolia" - ], + "words": ["salut", "algolia"], + "decomposition": ["salut", "algolia"], "state": "enabled" } } diff --git a/tests/CTS/clients/search/search.json b/tests/CTS/clients/search/search.json index 23f6bfecef..59e762fc6e 100644 --- a/tests/CTS/clients/search/search.json +++ b/tests/CTS/clients/search/search.json @@ -4,15 +4,14 @@ "parameters": { "indexName": "indexName", "searchParams": { - "$objectName": "Query", - "query": "queryString" + "query": "myQuery" } }, "request": { "path": "/1/indexes/indexName/query", "method": "POST", "data": { - "query": "queryString" + "query": "myQuery" } } } diff --git a/tests/CTS/clients/search/searchDictionaryEntries.json b/tests/CTS/clients/search/searchDictionaryEntries.json index 7a4e114fd1..4a93335ce6 100644 --- a/tests/CTS/clients/search/searchDictionaryEntries.json +++ b/tests/CTS/clients/search/searchDictionaryEntries.json @@ -3,13 +3,13 @@ "method": "searchDictionaryEntries", "testName": "get searchDictionaryEntries results with minimal parameters", "parameters": { - "dictionaryName": "dictionaryName", + "dictionaryName": "compounds", "searchDictionaryEntries": { "query": "foo" } }, "request": { - "path": "/1/dictionaries/dictionaryName/search", + "path": "/1/dictionaries/compounds/search", "method": "POST", "data": { "query": "foo" @@ -20,7 +20,7 @@ "method": "searchDictionaryEntries", "testName": "get searchDictionaryEntries results with all parameters", "parameters": { - "dictionaryName": "dictionaryName", + "dictionaryName": "compounds", "searchDictionaryEntries": { "query": "foo", "page": 4, @@ -29,7 +29,7 @@ } }, "request": { - "path": "/1/dictionaries/dictionaryName/search", + "path": "/1/dictionaries/compounds/search", "method": "POST", "data": { "query": "foo", diff --git a/tests/CTS/templates/javascript.mustache b/tests/CTS/templates/javascript.mustache index 1274920d48..49ecdbf777 100644 --- a/tests/CTS/templates/javascript.mustache +++ b/tests/CTS/templates/javascript.mustache @@ -1,7 +1,9 @@ -// @ts-nocheck import { {{client}}, EchoRequester } from '{{{import}}}'; -const client = new {{client}}(process.env.ALGOLIA_APPLICATION_ID, process.env.ALGOLIA_SEARCH_KEY, { requester: new EchoRequester() }); +const appId = process.env.ALGOLIA_APPLICATION_ID || 'test_app_id'; +const apiKey = process.env.ALGOLIA_SEARCH_KEY || 'test_api_key'; + +const client = new {{client}}(appId, apiKey, { requester: new EchoRequester() }); {{#blocks}} describe('{{operationId}}', () => { diff --git a/tests/generateCTS.ts b/tests/generateCTS.ts index 8c945f3748..ad05507708 100644 --- a/tests/generateCTS.ts +++ b/tests/generateCTS.ts @@ -118,6 +118,16 @@ async function loadCTSForClient(client: string): Promise { if (test.testName === undefined) { test.testName = test.method; } + + // stringify request.data too + test.request.data = JSON.stringify(test.request.data); + + if (Object.keys(test.parameters).length === 0) { + test.parameters = undefined; + + continue; + } + if ( typeof test.parameters !== 'object' || Array.isArray(test.parameters) @@ -138,9 +148,6 @@ async function loadCTSForClient(client: string): Promise { '-last': i === arr.length - 1, }) ); - - // stringify request.data too - test.request.data = JSON.stringify(test.request.data); } ctsClient.push({ diff --git a/tests/output/javascript/insights.test.ts b/tests/output/javascript/insights.test.ts index 36fe80cdec..69103eb8f0 100644 --- a/tests/output/javascript/insights.test.ts +++ b/tests/output/javascript/insights.test.ts @@ -1,11 +1,11 @@ -// @ts-nocheck import { InsightsApi, EchoRequester } from '@algolia/client-insights'; -const client = new InsightsApi( - process.env.ALGOLIA_APPLICATION_ID, - process.env.ALGOLIA_SEARCH_KEY, - { requester: new EchoRequester() } -); +const appId = process.env.ALGOLIA_APPLICATION_ID || 'test_app_id'; +const apiKey = process.env.ALGOLIA_SEARCH_KEY || 'test_api_key'; + +const client = new InsightsApi(appId, apiKey, { + requester: new EchoRequester(), +}); describe('pushEvents', () => { test('pushEvents', async () => { diff --git a/tests/output/javascript/recommend.test.ts b/tests/output/javascript/recommend.test.ts index 5b84cb9201..6830ebbd2b 100644 --- a/tests/output/javascript/recommend.test.ts +++ b/tests/output/javascript/recommend.test.ts @@ -1,11 +1,11 @@ -// @ts-nocheck import { RecommendApi, EchoRequester } from '@algolia/recommend'; -const client = new RecommendApi( - process.env.ALGOLIA_APPLICATION_ID, - process.env.ALGOLIA_SEARCH_KEY, - { requester: new EchoRequester() } -); +const appId = process.env.ALGOLIA_APPLICATION_ID || 'test_app_id'; +const apiKey = process.env.ALGOLIA_SEARCH_KEY || 'test_api_key'; + +const client = new RecommendApi(appId, apiKey, { + requester: new EchoRequester(), +}); describe('getRecommendations', () => { test('get recommendations with minimal parameters', async () => { @@ -46,8 +46,11 @@ describe('getRecommendations', () => { objectID: 'objectID', model: 'related-products', threshold: 42, - queryParameters: { facetFilters: ['query'] }, - fallbackParameters: { facetFilters: ['fallback'] }, + queryParameters: { query: 'myQuery', facetFilters: ['query'] }, + fallbackParameters: { + query: 'myQuery', + facetFilters: ['fallback'], + }, }, ], }, @@ -62,8 +65,11 @@ describe('getRecommendations', () => { objectID: 'objectID', model: 'related-products', threshold: 42, - queryParameters: { facetFilters: ['query'] }, - fallbackParameters: { facetFilters: ['fallback'] }, + queryParameters: { query: 'myQuery', facetFilters: ['query'] }, + fallbackParameters: { + query: 'myQuery', + facetFilters: ['fallback'], + }, }, ], }, @@ -120,16 +126,22 @@ describe('getRecommendations', () => { objectID: 'objectID1', model: 'related-products', threshold: 21, - queryParameters: { facetFilters: ['query1'] }, - fallbackParameters: { facetFilters: ['fallback1'] }, + queryParameters: { query: 'myQuery', facetFilters: ['query1'] }, + fallbackParameters: { + query: 'myQuery', + facetFilters: ['fallback1'], + }, }, { indexName: 'indexName2', objectID: 'objectID2', model: 'related-products', threshold: 21, - queryParameters: { facetFilters: ['query2'] }, - fallbackParameters: { facetFilters: ['fallback2'] }, + queryParameters: { query: 'myQuery', facetFilters: ['query2'] }, + fallbackParameters: { + query: 'myQuery', + facetFilters: ['fallback2'], + }, }, ], }, @@ -144,16 +156,22 @@ describe('getRecommendations', () => { objectID: 'objectID1', model: 'related-products', threshold: 21, - queryParameters: { facetFilters: ['query1'] }, - fallbackParameters: { facetFilters: ['fallback1'] }, + queryParameters: { query: 'myQuery', facetFilters: ['query1'] }, + fallbackParameters: { + query: 'myQuery', + facetFilters: ['fallback1'], + }, }, { indexName: 'indexName2', objectID: 'objectID2', model: 'related-products', threshold: 21, - queryParameters: { facetFilters: ['query2'] }, - fallbackParameters: { facetFilters: ['fallback2'] }, + queryParameters: { query: 'myQuery', facetFilters: ['query2'] }, + fallbackParameters: { + query: 'myQuery', + facetFilters: ['fallback2'], + }, }, ], }, diff --git a/tests/output/javascript/search.test.ts b/tests/output/javascript/search.test.ts index ae7cf0befe..394043a922 100644 --- a/tests/output/javascript/search.test.ts +++ b/tests/output/javascript/search.test.ts @@ -1,11 +1,9 @@ -// @ts-nocheck import { SearchApi, EchoRequester } from '@algolia/client-search'; -const client = new SearchApi( - process.env.ALGOLIA_APPLICATION_ID, - process.env.ALGOLIA_SEARCH_KEY, - { requester: new EchoRequester() } -); +const appId = process.env.ALGOLIA_APPLICATION_ID || 'test_app_id'; +const apiKey = process.env.ALGOLIA_SEARCH_KEY || 'test_api_key'; + +const client = new SearchApi(appId, apiKey, { requester: new EchoRequester() }); describe('addApiKey', () => { test('addApiKey', async () => { @@ -35,7 +33,7 @@ describe('addApiKey', () => { describe('batchDictionaryEntries', () => { test('get batchDictionaryEntries results with minimal parameters', async () => { const req = await client.batchDictionaryEntries({ - dictionaryName: 'dictionaryName', + dictionaryName: 'compounds', batchDictionaryEntries: { requests: [ { action: 'addEntry', body: { objectID: '1', language: 'en' } }, @@ -44,7 +42,7 @@ describe('batchDictionaryEntries', () => { }, }); expect(req).toMatchObject({ - path: '/1/dictionaries/dictionaryName/batch', + path: '/1/dictionaries/compounds/batch', method: 'POST', data: { requests: [ @@ -57,7 +55,7 @@ describe('batchDictionaryEntries', () => { test('get batchDictionaryEntries results with all parameters', async () => { const req = await client.batchDictionaryEntries({ - dictionaryName: 'dictionaryName', + dictionaryName: 'compounds', batchDictionaryEntries: { clearExistingDictionaryEntries: false, requests: [ @@ -87,7 +85,7 @@ describe('batchDictionaryEntries', () => { }, }); expect(req).toMatchObject({ - path: '/1/dictionaries/dictionaryName/batch', + path: '/1/dictionaries/compounds/batch', method: 'POST', data: { clearExistingDictionaryEntries: false, @@ -251,7 +249,7 @@ describe('getApiKey', () => { describe('getDictionaryLanguages', () => { test('get getDictionaryLanguages', async () => { - const req = await client.getDictionaryLanguages({}); + const req = await client.getDictionaryLanguages(); expect(req).toMatchObject({ path: '/1/dictionaries/*/languages', method: 'GET', @@ -261,7 +259,7 @@ describe('getDictionaryLanguages', () => { describe('getDictionarySettings', () => { test('get getDictionarySettings results', async () => { - const req = await client.getDictionarySettings({}); + const req = await client.getDictionarySettings(); expect(req).toMatchObject({ path: '/1/dictionaries/*/settings', method: 'GET', @@ -297,7 +295,7 @@ describe('getSynonym', () => { describe('listApiKeys', () => { test('listApiKeys', async () => { - const req = await client.listApiKeys({}); + const req = await client.listApiKeys(); expect(req).toMatchObject({ path: '/1/keys', method: 'GET', @@ -407,12 +405,12 @@ describe('search', () => { test('search', async () => { const req = await client.search({ indexName: 'indexName', - searchParams: { query: 'queryString' }, + searchParams: { query: 'myQuery' }, }); expect(req).toMatchObject({ path: '/1/indexes/indexName/query', method: 'POST', - data: { query: 'queryString' }, + data: { query: 'myQuery' }, }); }); }); @@ -420,11 +418,11 @@ describe('search', () => { describe('searchDictionaryEntries', () => { test('get searchDictionaryEntries results with minimal parameters', async () => { const req = await client.searchDictionaryEntries({ - dictionaryName: 'dictionaryName', + dictionaryName: 'compounds', searchDictionaryEntries: { query: 'foo' }, }); expect(req).toMatchObject({ - path: '/1/dictionaries/dictionaryName/search', + path: '/1/dictionaries/compounds/search', method: 'POST', data: { query: 'foo' }, }); @@ -432,7 +430,7 @@ describe('searchDictionaryEntries', () => { test('get searchDictionaryEntries results with all parameters', async () => { const req = await client.searchDictionaryEntries({ - dictionaryName: 'dictionaryName', + dictionaryName: 'compounds', searchDictionaryEntries: { query: 'foo', page: 4, @@ -441,7 +439,7 @@ describe('searchDictionaryEntries', () => { }, }); expect(req).toMatchObject({ - path: '/1/dictionaries/dictionaryName/search', + path: '/1/dictionaries/compounds/search', method: 'POST', data: { query: 'foo', page: 4, hitsPerPage: 2, language: 'fr' }, }); diff --git a/tests/package.json b/tests/package.json index 57a1eddd51..d49212088b 100644 --- a/tests/package.json +++ b/tests/package.json @@ -8,8 +8,8 @@ "start": "yarn build && node dist/tests/generateCTS.js ${0:-all} && yarn lint:fix" }, "dependencies": { - "@algolia/client-search": "5.0.0", "@algolia/client-insights": "5.0.0", + "@algolia/client-search": "5.0.0", "@algolia/recommend": "5.0.0" }, "devDependencies": { diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 9ecd9c4337..a8aa099920 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -15,7 +15,7 @@ "lib": ["dom", "es6", "es5", "dom.iterable", "scripthost"], "outDir": "dist", "typeRoots": ["../node_modules/@types"], - "types": ["node"], + "types": ["node", "jest"], "resolveJsonModule": true }, "exclude": ["dist", "output"]