diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/BaseSearchParams.java index 66895d09b9..7b619cf475 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/BaseSearchParams.java @@ -16,16 +16,16 @@ public class BaseSearchParams { private String filters = ""; @SerializedName("facetFilters") - private List facetFilters = null; + private FacetFilters facetFilters; @SerializedName("optionalFilters") - private List optionalFilters = null; + private OptionalFilters optionalFilters; @SerializedName("numericFilters") - private List numericFilters = null; + private NumericFilters numericFilters; @SerializedName("tagFilters") - private List tagFilters = null; + private TagFilters tagFilters; @SerializedName("sumOrFiltersScores") private Boolean sumOrFiltersScores = false; @@ -105,6 +105,9 @@ public class BaseSearchParams { @SerializedName("enableReRanking") private Boolean enableReRanking = true; + @SerializedName("reRankingApplyFilter") + private ReRankingApplyFilter reRankingApplyFilter; + public BaseSearchParams setSimilarQuery(String similarQuery) { this.similarQuery = similarQuery; return this; @@ -136,96 +139,63 @@ public String getFilters() { return filters; } - public BaseSearchParams setFacetFilters(List facetFilters) { + public BaseSearchParams setFacetFilters(FacetFilters facetFilters) { this.facetFilters = facetFilters; return this; } - public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { - if (this.facetFilters == null) { - this.facetFilters = new ArrayList<>(); - } - this.facetFilters.add(facetFiltersItem); - return this; - } - /** - * Filter hits by facet value. + * Get facetFilters * * @return facetFilters */ @javax.annotation.Nullable - public List getFacetFilters() { + public FacetFilters getFacetFilters() { return facetFilters; } - public BaseSearchParams setOptionalFilters(List optionalFilters) { + public BaseSearchParams setOptionalFilters(OptionalFilters optionalFilters) { this.optionalFilters = optionalFilters; return this; } - public BaseSearchParams 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. + * Get optionalFilters * * @return optionalFilters */ @javax.annotation.Nullable - public List getOptionalFilters() { + public OptionalFilters getOptionalFilters() { return optionalFilters; } - public BaseSearchParams setNumericFilters(List numericFilters) { + public BaseSearchParams setNumericFilters(NumericFilters numericFilters) { this.numericFilters = numericFilters; return this; } - public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { - if (this.numericFilters == null) { - this.numericFilters = new ArrayList<>(); - } - this.numericFilters.add(numericFiltersItem); - return this; - } - /** - * Filter on numeric attributes. + * Get numericFilters * * @return numericFilters */ @javax.annotation.Nullable - public List getNumericFilters() { + public NumericFilters getNumericFilters() { return numericFilters; } - public BaseSearchParams setTagFilters(List tagFilters) { + public BaseSearchParams setTagFilters(TagFilters tagFilters) { this.tagFilters = tagFilters; return this; } - public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { - if (this.tagFilters == null) { - this.tagFilters = new ArrayList<>(); - } - this.tagFilters.add(tagFiltersItem); - return this; - } - /** - * Filter hits by tags. + * Get tagFilters * * @return tagFilters */ @javax.annotation.Nullable - public List getTagFilters() { + public TagFilters getTagFilters() { return tagFilters; } @@ -682,6 +652,23 @@ public Boolean getEnableReRanking() { return enableReRanking; } + public BaseSearchParams setReRankingApplyFilter( + ReRankingApplyFilter reRankingApplyFilter + ) { + this.reRankingApplyFilter = reRankingApplyFilter; + return this; + } + + /** + * Get reRankingApplyFilter + * + * @return reRankingApplyFilter + */ + @javax.annotation.Nullable + public ReRankingApplyFilter getReRankingApplyFilter() { + return reRankingApplyFilter; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -753,7 +740,11 @@ public boolean equals(Object o) { baseSearchParams.percentileComputation ) && Objects.equals(this.enableABTest, baseSearchParams.enableABTest) && - Objects.equals(this.enableReRanking, baseSearchParams.enableReRanking) + Objects.equals(this.enableReRanking, baseSearchParams.enableReRanking) && + Objects.equals( + this.reRankingApplyFilter, + baseSearchParams.reRankingApplyFilter + ) ); } @@ -791,7 +782,8 @@ public int hashCode() { analyticsTags, percentileComputation, enableABTest, - enableReRanking + enableReRanking, + reRankingApplyFilter ); } @@ -912,6 +904,10 @@ public String toString() { .append(" enableReRanking: ") .append(toIndentedString(enableReRanking)) .append("\n"); + sb + .append(" reRankingApplyFilter: ") + .append(toIndentedString(reRankingApplyFilter)) + .append("\n"); sb.append("}"); return sb.toString(); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/FacetFilters.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/FacetFilters.java new file mode 100644 index 0000000000..efc7003d67 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/FacetFilters.java @@ -0,0 +1,70 @@ +package com.algolia.model.recommend; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(FacetFilters.Adapter.class) +public abstract class FacetFilters implements CompoundType { + + public static FacetFilters ofListListString(List> inside) { + return new FacetFiltersListListString(inside); + } + + public static FacetFilters ofListString(List inside) { + return new FacetFiltersListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final FacetFilters oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public FacetFilters read(final JsonReader jsonReader) throws IOException { + return null; + } + } +} + +@JsonAdapter(FacetFilters.Adapter.class) +class FacetFiltersListListString extends FacetFilters { + + private final List> insideValue; + + FacetFiltersListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(FacetFilters.Adapter.class) +class FacetFiltersListString extends FacetFilters { + + private final List insideValue; + + FacetFiltersListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/MatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/MatchedGeoLocation.java new file mode 100644 index 0000000000..288292e441 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/MatchedGeoLocation.java @@ -0,0 +1,104 @@ +package com.algolia.model.recommend; + +import com.google.gson.annotations.SerializedName; +import java.util.Objects; + +/** MatchedGeoLocation */ +public class MatchedGeoLocation { + + @SerializedName("lat") + private Double lat; + + @SerializedName("lng") + private Double lng; + + @SerializedName("distance") + private Integer distance; + + public MatchedGeoLocation setLat(Double lat) { + this.lat = lat; + return this; + } + + /** + * Latitude of the matched location. + * + * @return lat + */ + @javax.annotation.Nullable + public Double getLat() { + return lat; + } + + public MatchedGeoLocation setLng(Double lng) { + this.lng = lng; + return this; + } + + /** + * Longitude of the matched location. + * + * @return lng + */ + @javax.annotation.Nullable + public Double getLng() { + return lng; + } + + public MatchedGeoLocation setDistance(Integer distance) { + this.distance = distance; + return this; + } + + /** + * Distance between the matched location and the search location (in meters). + * + * @return distance + */ + @javax.annotation.Nullable + public Integer getDistance() { + return distance; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchedGeoLocation matchedGeoLocation = (MatchedGeoLocation) o; + return ( + Objects.equals(this.lat, matchedGeoLocation.lat) && + Objects.equals(this.lng, matchedGeoLocation.lng) && + Objects.equals(this.distance, matchedGeoLocation.distance) + ); + } + + @Override + public int hashCode() { + return Objects.hash(lat, lng, distance); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchedGeoLocation {\n"); + sb.append(" lat: ").append(toIndentedString(lat)).append("\n"); + sb.append(" lng: ").append(toIndentedString(lng)).append("\n"); + sb.append(" distance: ").append(toIndentedString(distance)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/NumericFilters.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/NumericFilters.java new file mode 100644 index 0000000000..c642e56651 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/NumericFilters.java @@ -0,0 +1,70 @@ +package com.algolia.model.recommend; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(NumericFilters.Adapter.class) +public abstract class NumericFilters implements CompoundType { + + public static NumericFilters ofListListString(List> inside) { + return new NumericFiltersListListString(inside); + } + + public static NumericFilters ofListString(List inside) { + return new NumericFiltersListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final NumericFilters oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public NumericFilters read(final JsonReader jsonReader) throws IOException { + return null; + } + } +} + +@JsonAdapter(NumericFilters.Adapter.class) +class NumericFiltersListListString extends NumericFilters { + + private final List> insideValue; + + NumericFiltersListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(NumericFilters.Adapter.class) +class NumericFiltersListString extends NumericFilters { + + private final List insideValue; + + NumericFiltersListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/OptionalFilters.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/OptionalFilters.java new file mode 100644 index 0000000000..aeb20d4778 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/OptionalFilters.java @@ -0,0 +1,71 @@ +package com.algolia.model.recommend; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(OptionalFilters.Adapter.class) +public abstract class OptionalFilters implements CompoundType { + + public static OptionalFilters ofListListString(List> inside) { + return new OptionalFiltersListListString(inside); + } + + public static OptionalFilters ofListString(List inside) { + return new OptionalFiltersListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final OptionalFilters oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public OptionalFilters read(final JsonReader jsonReader) + throws IOException { + return null; + } + } +} + +@JsonAdapter(OptionalFilters.Adapter.class) +class OptionalFiltersListListString extends OptionalFilters { + + private final List> insideValue; + + OptionalFiltersListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(OptionalFilters.Adapter.class) +class OptionalFiltersListString extends OptionalFilters { + + private final List insideValue; + + OptionalFiltersListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/Personalization.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/Personalization.java new file mode 100644 index 0000000000..aa1ce1abbc --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/Personalization.java @@ -0,0 +1,110 @@ +package com.algolia.model.recommend; + +import com.google.gson.annotations.SerializedName; +import java.util.Objects; + +/** Personalization */ +public class Personalization { + + @SerializedName("filtersScore") + private Integer filtersScore; + + @SerializedName("rankingScore") + private Integer rankingScore; + + @SerializedName("score") + private Integer score; + + public Personalization setFiltersScore(Integer filtersScore) { + this.filtersScore = filtersScore; + return this; + } + + /** + * The score of the filters. + * + * @return filtersScore + */ + @javax.annotation.Nullable + public Integer getFiltersScore() { + return filtersScore; + } + + public Personalization setRankingScore(Integer rankingScore) { + this.rankingScore = rankingScore; + return this; + } + + /** + * The score of the ranking. + * + * @return rankingScore + */ + @javax.annotation.Nullable + public Integer getRankingScore() { + return rankingScore; + } + + public Personalization setScore(Integer score) { + this.score = score; + return this; + } + + /** + * The score of the event. + * + * @return score + */ + @javax.annotation.Nullable + public Integer getScore() { + return score; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Personalization personalization = (Personalization) o; + return ( + Objects.equals(this.filtersScore, personalization.filtersScore) && + Objects.equals(this.rankingScore, personalization.rankingScore) && + Objects.equals(this.score, personalization.score) + ); + } + + @Override + public int hashCode() { + return Objects.hash(filtersScore, rankingScore, score); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Personalization {\n"); + sb + .append(" filtersScore: ") + .append(toIndentedString(filtersScore)) + .append("\n"); + sb + .append(" rankingScore: ") + .append(toIndentedString(rankingScore)) + .append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/RankingInfo.java index 5d5f89580a..63b5023bbc 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/RankingInfo.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/RankingInfo.java @@ -1,8 +1,6 @@ package com.algolia.model.recommend; import com.google.gson.annotations.SerializedName; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; /** RankingInfo */ @@ -21,7 +19,10 @@ public class RankingInfo { private Integer geoPrecision; @SerializedName("matchedGeoLocation") - private Map matchedGeoLocation = null; + private MatchedGeoLocation matchedGeoLocation; + + @SerializedName("personalization") + private Personalization personalization; @SerializedName("nbExactWords") private Integer nbExactWords; @@ -38,8 +39,11 @@ public class RankingInfo { @SerializedName("userScore") private Integer userScore; - @SerializedName("word") - private Integer word; + @SerializedName("words") + private Integer words; + + @SerializedName("promotedByReRanking") + private Boolean promotedByReRanking; public RankingInfo setFilters(Integer filters) { this.filters = filters; @@ -51,7 +55,7 @@ public RankingInfo setFilters(Integer filters) { * * @return filters */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getFilters() { return filters; } @@ -66,7 +70,7 @@ public RankingInfo setFirstMatchedWord(Integer firstMatchedWord) { * * @return firstMatchedWord */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getFirstMatchedWord() { return firstMatchedWord; } @@ -82,7 +86,7 @@ public RankingInfo setGeoDistance(Integer geoDistance) { * * @return geoDistance */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getGeoDistance() { return geoDistance; } @@ -103,33 +107,37 @@ public Integer getGeoPrecision() { } public RankingInfo setMatchedGeoLocation( - Map matchedGeoLocation + MatchedGeoLocation matchedGeoLocation ) { this.matchedGeoLocation = matchedGeoLocation; return this; } - public RankingInfo putMatchedGeoLocationItem( - String key, - RankingInfoMatchedGeoLocation matchedGeoLocationItem - ) { - if (this.matchedGeoLocation == null) { - this.matchedGeoLocation = new HashMap<>(); - } - this.matchedGeoLocation.put(key, matchedGeoLocationItem); - return this; - } - /** * Get matchedGeoLocation * * @return matchedGeoLocation */ @javax.annotation.Nullable - public Map getMatchedGeoLocation() { + public MatchedGeoLocation getMatchedGeoLocation() { return matchedGeoLocation; } + public RankingInfo setPersonalization(Personalization personalization) { + this.personalization = personalization; + return this; + } + + /** + * Get personalization + * + * @return personalization + */ + @javax.annotation.Nullable + public Personalization getPersonalization() { + return personalization; + } + public RankingInfo setNbExactWords(Integer nbExactWords) { this.nbExactWords = nbExactWords; return this; @@ -140,7 +148,7 @@ public RankingInfo setNbExactWords(Integer nbExactWords) { * * @return nbExactWords */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getNbExactWords() { return nbExactWords; } @@ -155,7 +163,7 @@ public RankingInfo setNbTypos(Integer nbTypos) { * * @return nbTypos */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getNbTypos() { return nbTypos; } @@ -170,7 +178,7 @@ public RankingInfo setPromoted(Boolean promoted) { * * @return promoted */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Boolean getPromoted() { return promoted; } @@ -201,24 +209,39 @@ public RankingInfo setUserScore(Integer userScore) { * * @return userScore */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getUserScore() { return userScore; } - public RankingInfo setWord(Integer word) { - this.word = word; + public RankingInfo setWords(Integer words) { + this.words = words; return this; } /** * Number of matched words, including prefixes and typos. * - * @return word + * @return words + */ + @javax.annotation.Nonnull + public Integer getWords() { + return words; + } + + public RankingInfo setPromotedByReRanking(Boolean promotedByReRanking) { + this.promotedByReRanking = promotedByReRanking; + return this; + } + + /** + * Wether the record are promoted by the re-ranking strategy. + * + * @return promotedByReRanking */ @javax.annotation.Nullable - public Integer getWord() { - return word; + public Boolean getPromotedByReRanking() { + return promotedByReRanking; } @Override @@ -236,12 +259,14 @@ public boolean equals(Object o) { Objects.equals(this.geoDistance, rankingInfo.geoDistance) && Objects.equals(this.geoPrecision, rankingInfo.geoPrecision) && Objects.equals(this.matchedGeoLocation, rankingInfo.matchedGeoLocation) && + Objects.equals(this.personalization, rankingInfo.personalization) && Objects.equals(this.nbExactWords, rankingInfo.nbExactWords) && Objects.equals(this.nbTypos, rankingInfo.nbTypos) && Objects.equals(this.promoted, rankingInfo.promoted) && Objects.equals(this.proximityDistance, rankingInfo.proximityDistance) && Objects.equals(this.userScore, rankingInfo.userScore) && - Objects.equals(this.word, rankingInfo.word) + Objects.equals(this.words, rankingInfo.words) && + Objects.equals(this.promotedByReRanking, rankingInfo.promotedByReRanking) ); } @@ -253,12 +278,14 @@ public int hashCode() { geoDistance, geoPrecision, matchedGeoLocation, + personalization, nbExactWords, nbTypos, promoted, proximityDistance, userScore, - word + words, + promotedByReRanking ); } @@ -283,6 +310,10 @@ public String toString() { .append(" matchedGeoLocation: ") .append(toIndentedString(matchedGeoLocation)) .append("\n"); + sb + .append(" personalization: ") + .append(toIndentedString(personalization)) + .append("\n"); sb .append(" nbExactWords: ") .append(toIndentedString(nbExactWords)) @@ -297,7 +328,11 @@ public String toString() { .append(" userScore: ") .append(toIndentedString(userScore)) .append("\n"); - sb.append(" word: ").append(toIndentedString(word)).append("\n"); + sb.append(" words: ").append(toIndentedString(words)).append("\n"); + sb + .append(" promotedByReRanking: ") + .append(toIndentedString(promotedByReRanking)) + .append("\n"); sb.append("}"); return sb.toString(); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/ReRankingApplyFilter.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/ReRankingApplyFilter.java new file mode 100644 index 0000000000..6a76e539a2 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/ReRankingApplyFilter.java @@ -0,0 +1,73 @@ +package com.algolia.model.recommend; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(ReRankingApplyFilter.Adapter.class) +public abstract class ReRankingApplyFilter implements CompoundType { + + public static ReRankingApplyFilter ofListListString( + List> inside + ) { + return new ReRankingApplyFilterListListString(inside); + } + + public static ReRankingApplyFilter ofListString(List inside) { + return new ReRankingApplyFilterListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final ReRankingApplyFilter oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public ReRankingApplyFilter read(final JsonReader jsonReader) + throws IOException { + return null; + } + } +} + +@JsonAdapter(ReRankingApplyFilter.Adapter.class) +class ReRankingApplyFilterListListString extends ReRankingApplyFilter { + + private final List> insideValue; + + ReRankingApplyFilterListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(ReRankingApplyFilter.Adapter.class) +class ReRankingApplyFilterListString extends ReRankingApplyFilter { + + private final List insideValue; + + ReRankingApplyFilterListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/SearchParamsObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/SearchParamsObject.java index 01d959d827..ec7037f939 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/SearchParamsObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/SearchParamsObject.java @@ -16,16 +16,16 @@ public class SearchParamsObject { private String filters = ""; @SerializedName("facetFilters") - private List facetFilters = null; + private FacetFilters facetFilters; @SerializedName("optionalFilters") - private List optionalFilters = null; + private OptionalFilters optionalFilters; @SerializedName("numericFilters") - private List numericFilters = null; + private NumericFilters numericFilters; @SerializedName("tagFilters") - private List tagFilters = null; + private TagFilters tagFilters; @SerializedName("sumOrFiltersScores") private Boolean sumOrFiltersScores = false; @@ -105,6 +105,9 @@ public class SearchParamsObject { @SerializedName("enableReRanking") private Boolean enableReRanking = true; + @SerializedName("reRankingApplyFilter") + private ReRankingApplyFilter reRankingApplyFilter; + @SerializedName("query") private String query = ""; @@ -273,96 +276,65 @@ public String getFilters() { return filters; } - public SearchParamsObject setFacetFilters(List facetFilters) { + public SearchParamsObject setFacetFilters(FacetFilters facetFilters) { this.facetFilters = facetFilters; return this; } - public SearchParamsObject addFacetFiltersItem(String facetFiltersItem) { - if (this.facetFilters == null) { - this.facetFilters = new ArrayList<>(); - } - this.facetFilters.add(facetFiltersItem); - return this; - } - /** - * Filter hits by facet value. + * Get facetFilters * * @return facetFilters */ @javax.annotation.Nullable - public List getFacetFilters() { + public FacetFilters getFacetFilters() { return facetFilters; } - public SearchParamsObject setOptionalFilters(List optionalFilters) { + public SearchParamsObject setOptionalFilters( + OptionalFilters optionalFilters + ) { this.optionalFilters = optionalFilters; return this; } - public SearchParamsObject 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. + * Get optionalFilters * * @return optionalFilters */ @javax.annotation.Nullable - public List getOptionalFilters() { + public OptionalFilters getOptionalFilters() { return optionalFilters; } - public SearchParamsObject setNumericFilters(List numericFilters) { + public SearchParamsObject setNumericFilters(NumericFilters numericFilters) { this.numericFilters = numericFilters; return this; } - public SearchParamsObject addNumericFiltersItem(String numericFiltersItem) { - if (this.numericFilters == null) { - this.numericFilters = new ArrayList<>(); - } - this.numericFilters.add(numericFiltersItem); - return this; - } - /** - * Filter on numeric attributes. + * Get numericFilters * * @return numericFilters */ @javax.annotation.Nullable - public List getNumericFilters() { + public NumericFilters getNumericFilters() { return numericFilters; } - public SearchParamsObject setTagFilters(List tagFilters) { + public SearchParamsObject setTagFilters(TagFilters tagFilters) { this.tagFilters = tagFilters; return this; } - public SearchParamsObject addTagFiltersItem(String tagFiltersItem) { - if (this.tagFilters == null) { - this.tagFilters = new ArrayList<>(); - } - this.tagFilters.add(tagFiltersItem); - return this; - } - /** - * Filter hits by tags. + * Get tagFilters * * @return tagFilters */ @javax.annotation.Nullable - public List getTagFilters() { + public TagFilters getTagFilters() { return tagFilters; } @@ -823,6 +795,23 @@ public Boolean getEnableReRanking() { return enableReRanking; } + public SearchParamsObject setReRankingApplyFilter( + ReRankingApplyFilter reRankingApplyFilter + ) { + this.reRankingApplyFilter = reRankingApplyFilter; + return this; + } + + /** + * Get reRankingApplyFilter + * + * @return reRankingApplyFilter + */ + @javax.annotation.Nullable + public ReRankingApplyFilter getReRankingApplyFilter() { + return reRankingApplyFilter; + } + public SearchParamsObject setQuery(String query) { this.query = query; return this; @@ -1786,6 +1775,10 @@ public boolean equals(Object o) { this.enableReRanking, searchParamsObject.enableReRanking ) && + Objects.equals( + this.reRankingApplyFilter, + searchParamsObject.reRankingApplyFilter + ) && Objects.equals(this.query, searchParamsObject.query) && Objects.equals( this.searchableAttributes, @@ -1953,6 +1946,7 @@ public int hashCode() { percentileComputation, enableABTest, enableReRanking, + reRankingApplyFilter, query, searchableAttributes, attributesForFaceting, @@ -2118,6 +2112,10 @@ public String toString() { .append(" enableReRanking: ") .append(toIndentedString(enableReRanking)) .append("\n"); + sb + .append(" reRankingApplyFilter: ") + .append(toIndentedString(reRankingApplyFilter)) + .append("\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb .append(" searchableAttributes: ") diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/TagFilters.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/TagFilters.java new file mode 100644 index 0000000000..359efbeff1 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/recommend/TagFilters.java @@ -0,0 +1,70 @@ +package com.algolia.model.recommend; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(TagFilters.Adapter.class) +public abstract class TagFilters implements CompoundType { + + public static TagFilters ofListListString(List> inside) { + return new TagFiltersListListString(inside); + } + + public static TagFilters ofListString(List inside) { + return new TagFiltersListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final TagFilters oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public TagFilters read(final JsonReader jsonReader) throws IOException { + return null; + } + } +} + +@JsonAdapter(TagFilters.Adapter.class) +class TagFiltersListListString extends TagFilters { + + private final List> insideValue; + + TagFiltersListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(TagFilters.Adapter.class) +class TagFiltersListString extends TagFilters { + + private final List insideValue; + + TagFiltersListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/BaseSearchParams.java index b22685a098..506ca31932 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/BaseSearchParams.java @@ -16,16 +16,16 @@ public class BaseSearchParams { private String filters = ""; @SerializedName("facetFilters") - private List facetFilters = null; + private FacetFilters facetFilters; @SerializedName("optionalFilters") - private List optionalFilters = null; + private OptionalFilters optionalFilters; @SerializedName("numericFilters") - private List numericFilters = null; + private NumericFilters numericFilters; @SerializedName("tagFilters") - private List tagFilters = null; + private TagFilters tagFilters; @SerializedName("sumOrFiltersScores") private Boolean sumOrFiltersScores = false; @@ -105,6 +105,9 @@ public class BaseSearchParams { @SerializedName("enableReRanking") private Boolean enableReRanking = true; + @SerializedName("reRankingApplyFilter") + private ReRankingApplyFilter reRankingApplyFilter; + public BaseSearchParams setSimilarQuery(String similarQuery) { this.similarQuery = similarQuery; return this; @@ -136,96 +139,63 @@ public String getFilters() { return filters; } - public BaseSearchParams setFacetFilters(List facetFilters) { + public BaseSearchParams setFacetFilters(FacetFilters facetFilters) { this.facetFilters = facetFilters; return this; } - public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { - if (this.facetFilters == null) { - this.facetFilters = new ArrayList<>(); - } - this.facetFilters.add(facetFiltersItem); - return this; - } - /** - * Filter hits by facet value. + * Get facetFilters * * @return facetFilters */ @javax.annotation.Nullable - public List getFacetFilters() { + public FacetFilters getFacetFilters() { return facetFilters; } - public BaseSearchParams setOptionalFilters(List optionalFilters) { + public BaseSearchParams setOptionalFilters(OptionalFilters optionalFilters) { this.optionalFilters = optionalFilters; return this; } - public BaseSearchParams 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. + * Get optionalFilters * * @return optionalFilters */ @javax.annotation.Nullable - public List getOptionalFilters() { + public OptionalFilters getOptionalFilters() { return optionalFilters; } - public BaseSearchParams setNumericFilters(List numericFilters) { + public BaseSearchParams setNumericFilters(NumericFilters numericFilters) { this.numericFilters = numericFilters; return this; } - public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { - if (this.numericFilters == null) { - this.numericFilters = new ArrayList<>(); - } - this.numericFilters.add(numericFiltersItem); - return this; - } - /** - * Filter on numeric attributes. + * Get numericFilters * * @return numericFilters */ @javax.annotation.Nullable - public List getNumericFilters() { + public NumericFilters getNumericFilters() { return numericFilters; } - public BaseSearchParams setTagFilters(List tagFilters) { + public BaseSearchParams setTagFilters(TagFilters tagFilters) { this.tagFilters = tagFilters; return this; } - public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { - if (this.tagFilters == null) { - this.tagFilters = new ArrayList<>(); - } - this.tagFilters.add(tagFiltersItem); - return this; - } - /** - * Filter hits by tags. + * Get tagFilters * * @return tagFilters */ @javax.annotation.Nullable - public List getTagFilters() { + public TagFilters getTagFilters() { return tagFilters; } @@ -682,6 +652,23 @@ public Boolean getEnableReRanking() { return enableReRanking; } + public BaseSearchParams setReRankingApplyFilter( + ReRankingApplyFilter reRankingApplyFilter + ) { + this.reRankingApplyFilter = reRankingApplyFilter; + return this; + } + + /** + * Get reRankingApplyFilter + * + * @return reRankingApplyFilter + */ + @javax.annotation.Nullable + public ReRankingApplyFilter getReRankingApplyFilter() { + return reRankingApplyFilter; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -753,7 +740,11 @@ public boolean equals(Object o) { baseSearchParams.percentileComputation ) && Objects.equals(this.enableABTest, baseSearchParams.enableABTest) && - Objects.equals(this.enableReRanking, baseSearchParams.enableReRanking) + Objects.equals(this.enableReRanking, baseSearchParams.enableReRanking) && + Objects.equals( + this.reRankingApplyFilter, + baseSearchParams.reRankingApplyFilter + ) ); } @@ -791,7 +782,8 @@ public int hashCode() { analyticsTags, percentileComputation, enableABTest, - enableReRanking + enableReRanking, + reRankingApplyFilter ); } @@ -912,6 +904,10 @@ public String toString() { .append(" enableReRanking: ") .append(toIndentedString(enableReRanking)) .append("\n"); + sb + .append(" reRankingApplyFilter: ") + .append(toIndentedString(reRankingApplyFilter)) + .append("\n"); sb.append("}"); return sb.toString(); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/ConsequenceParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/ConsequenceParams.java index cdceacce61..4f445b33f1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/ConsequenceParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/ConsequenceParams.java @@ -25,16 +25,16 @@ public class ConsequenceParams { private String filters = ""; @SerializedName("facetFilters") - private List facetFilters = null; + private FacetFilters facetFilters; @SerializedName("optionalFilters") - private List optionalFilters = null; + private OptionalFilters optionalFilters; @SerializedName("numericFilters") - private List numericFilters = null; + private NumericFilters numericFilters; @SerializedName("tagFilters") - private List tagFilters = null; + private TagFilters tagFilters; @SerializedName("sumOrFiltersScores") private Boolean sumOrFiltersScores = false; @@ -114,6 +114,9 @@ public class ConsequenceParams { @SerializedName("enableReRanking") private Boolean enableReRanking = true; + @SerializedName("reRankingApplyFilter") + private ReRankingApplyFilter reRankingApplyFilter; + @SerializedName("searchableAttributes") private List searchableAttributes = null; @@ -349,96 +352,63 @@ public String getFilters() { return filters; } - public ConsequenceParams setFacetFilters(List facetFilters) { + public ConsequenceParams setFacetFilters(FacetFilters 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. + * Get facetFilters * * @return facetFilters */ @javax.annotation.Nullable - public List getFacetFilters() { + public FacetFilters getFacetFilters() { return facetFilters; } - public ConsequenceParams setOptionalFilters(List optionalFilters) { + public ConsequenceParams setOptionalFilters(OptionalFilters 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. + * Get optionalFilters * * @return optionalFilters */ @javax.annotation.Nullable - public List getOptionalFilters() { + public OptionalFilters getOptionalFilters() { return optionalFilters; } - public ConsequenceParams setNumericFilters(List numericFilters) { + public ConsequenceParams setNumericFilters(NumericFilters 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. + * Get numericFilters * * @return numericFilters */ @javax.annotation.Nullable - public List getNumericFilters() { + public NumericFilters getNumericFilters() { return numericFilters; } - public ConsequenceParams setTagFilters(List tagFilters) { + public ConsequenceParams setTagFilters(TagFilters 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. + * Get tagFilters * * @return tagFilters */ @javax.annotation.Nullable - public List getTagFilters() { + public TagFilters getTagFilters() { return tagFilters; } @@ -897,6 +867,23 @@ public Boolean getEnableReRanking() { return enableReRanking; } + public ConsequenceParams setReRankingApplyFilter( + ReRankingApplyFilter reRankingApplyFilter + ) { + this.reRankingApplyFilter = reRankingApplyFilter; + return this; + } + + /** + * Get reRankingApplyFilter + * + * @return reRankingApplyFilter + */ + @javax.annotation.Nullable + public ReRankingApplyFilter getReRankingApplyFilter() { + return reRankingApplyFilter; + } + public ConsequenceParams setSearchableAttributes( List searchableAttributes ) { @@ -1841,6 +1828,10 @@ public boolean equals(Object o) { ) && Objects.equals(this.enableABTest, consequenceParams.enableABTest) && Objects.equals(this.enableReRanking, consequenceParams.enableReRanking) && + Objects.equals( + this.reRankingApplyFilter, + consequenceParams.reRankingApplyFilter + ) && Objects.equals( this.searchableAttributes, consequenceParams.searchableAttributes @@ -2001,6 +1992,7 @@ public int hashCode() { percentileComputation, enableABTest, enableReRanking, + reRankingApplyFilter, searchableAttributes, attributesForFaceting, unretrievableAttributes, @@ -2174,6 +2166,10 @@ public String toString() { .append(" enableReRanking: ") .append(toIndentedString(enableReRanking)) .append("\n"); + sb + .append(" reRankingApplyFilter: ") + .append(toIndentedString(reRankingApplyFilter)) + .append("\n"); sb .append(" searchableAttributes: ") .append(toIndentedString(searchableAttributes)) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/FacetFilters.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/FacetFilters.java new file mode 100644 index 0000000000..f29f7a113b --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/FacetFilters.java @@ -0,0 +1,70 @@ +package com.algolia.model.search; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(FacetFilters.Adapter.class) +public abstract class FacetFilters implements CompoundType { + + public static FacetFilters ofListListString(List> inside) { + return new FacetFiltersListListString(inside); + } + + public static FacetFilters ofListString(List inside) { + return new FacetFiltersListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final FacetFilters oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public FacetFilters read(final JsonReader jsonReader) throws IOException { + return null; + } + } +} + +@JsonAdapter(FacetFilters.Adapter.class) +class FacetFiltersListListString extends FacetFilters { + + private final List> insideValue; + + FacetFiltersListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(FacetFilters.Adapter.class) +class FacetFiltersListString extends FacetFilters { + + private final List insideValue; + + FacetFiltersListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/MatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/MatchedGeoLocation.java new file mode 100644 index 0000000000..af201e5e15 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/MatchedGeoLocation.java @@ -0,0 +1,104 @@ +package com.algolia.model.search; + +import com.google.gson.annotations.SerializedName; +import java.util.Objects; + +/** MatchedGeoLocation */ +public class MatchedGeoLocation { + + @SerializedName("lat") + private Double lat; + + @SerializedName("lng") + private Double lng; + + @SerializedName("distance") + private Integer distance; + + public MatchedGeoLocation setLat(Double lat) { + this.lat = lat; + return this; + } + + /** + * Latitude of the matched location. + * + * @return lat + */ + @javax.annotation.Nullable + public Double getLat() { + return lat; + } + + public MatchedGeoLocation setLng(Double lng) { + this.lng = lng; + return this; + } + + /** + * Longitude of the matched location. + * + * @return lng + */ + @javax.annotation.Nullable + public Double getLng() { + return lng; + } + + public MatchedGeoLocation setDistance(Integer distance) { + this.distance = distance; + return this; + } + + /** + * Distance between the matched location and the search location (in meters). + * + * @return distance + */ + @javax.annotation.Nullable + public Integer getDistance() { + return distance; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchedGeoLocation matchedGeoLocation = (MatchedGeoLocation) o; + return ( + Objects.equals(this.lat, matchedGeoLocation.lat) && + Objects.equals(this.lng, matchedGeoLocation.lng) && + Objects.equals(this.distance, matchedGeoLocation.distance) + ); + } + + @Override + public int hashCode() { + return Objects.hash(lat, lng, distance); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchedGeoLocation {\n"); + sb.append(" lat: ").append(toIndentedString(lat)).append("\n"); + sb.append(" lng: ").append(toIndentedString(lng)).append("\n"); + sb.append(" distance: ").append(toIndentedString(distance)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/NumericFilters.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/NumericFilters.java new file mode 100644 index 0000000000..e1f23de602 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/NumericFilters.java @@ -0,0 +1,70 @@ +package com.algolia.model.search; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(NumericFilters.Adapter.class) +public abstract class NumericFilters implements CompoundType { + + public static NumericFilters ofListListString(List> inside) { + return new NumericFiltersListListString(inside); + } + + public static NumericFilters ofListString(List inside) { + return new NumericFiltersListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final NumericFilters oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public NumericFilters read(final JsonReader jsonReader) throws IOException { + return null; + } + } +} + +@JsonAdapter(NumericFilters.Adapter.class) +class NumericFiltersListListString extends NumericFilters { + + private final List> insideValue; + + NumericFiltersListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(NumericFilters.Adapter.class) +class NumericFiltersListString extends NumericFilters { + + private final List insideValue; + + NumericFiltersListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/OptionalFilters.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/OptionalFilters.java new file mode 100644 index 0000000000..f5f4b5845d --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/OptionalFilters.java @@ -0,0 +1,71 @@ +package com.algolia.model.search; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(OptionalFilters.Adapter.class) +public abstract class OptionalFilters implements CompoundType { + + public static OptionalFilters ofListListString(List> inside) { + return new OptionalFiltersListListString(inside); + } + + public static OptionalFilters ofListString(List inside) { + return new OptionalFiltersListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final OptionalFilters oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public OptionalFilters read(final JsonReader jsonReader) + throws IOException { + return null; + } + } +} + +@JsonAdapter(OptionalFilters.Adapter.class) +class OptionalFiltersListListString extends OptionalFilters { + + private final List> insideValue; + + OptionalFiltersListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(OptionalFilters.Adapter.class) +class OptionalFiltersListString extends OptionalFilters { + + private final List insideValue; + + OptionalFiltersListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/Personalization.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/Personalization.java new file mode 100644 index 0000000000..3d0099c206 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/Personalization.java @@ -0,0 +1,110 @@ +package com.algolia.model.search; + +import com.google.gson.annotations.SerializedName; +import java.util.Objects; + +/** Personalization */ +public class Personalization { + + @SerializedName("filtersScore") + private Integer filtersScore; + + @SerializedName("rankingScore") + private Integer rankingScore; + + @SerializedName("score") + private Integer score; + + public Personalization setFiltersScore(Integer filtersScore) { + this.filtersScore = filtersScore; + return this; + } + + /** + * The score of the filters. + * + * @return filtersScore + */ + @javax.annotation.Nullable + public Integer getFiltersScore() { + return filtersScore; + } + + public Personalization setRankingScore(Integer rankingScore) { + this.rankingScore = rankingScore; + return this; + } + + /** + * The score of the ranking. + * + * @return rankingScore + */ + @javax.annotation.Nullable + public Integer getRankingScore() { + return rankingScore; + } + + public Personalization setScore(Integer score) { + this.score = score; + return this; + } + + /** + * The score of the event. + * + * @return score + */ + @javax.annotation.Nullable + public Integer getScore() { + return score; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Personalization personalization = (Personalization) o; + return ( + Objects.equals(this.filtersScore, personalization.filtersScore) && + Objects.equals(this.rankingScore, personalization.rankingScore) && + Objects.equals(this.score, personalization.score) + ); + } + + @Override + public int hashCode() { + return Objects.hash(filtersScore, rankingScore, score); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Personalization {\n"); + sb + .append(" filtersScore: ") + .append(toIndentedString(filtersScore)) + .append("\n"); + sb + .append(" rankingScore: ") + .append(toIndentedString(rankingScore)) + .append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/RankingInfo.java index f536c4cc11..8d221d2d83 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/RankingInfo.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/RankingInfo.java @@ -1,8 +1,6 @@ package com.algolia.model.search; import com.google.gson.annotations.SerializedName; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; /** RankingInfo */ @@ -21,7 +19,10 @@ public class RankingInfo { private Integer geoPrecision; @SerializedName("matchedGeoLocation") - private Map matchedGeoLocation = null; + private MatchedGeoLocation matchedGeoLocation; + + @SerializedName("personalization") + private Personalization personalization; @SerializedName("nbExactWords") private Integer nbExactWords; @@ -38,8 +39,11 @@ public class RankingInfo { @SerializedName("userScore") private Integer userScore; - @SerializedName("word") - private Integer word; + @SerializedName("words") + private Integer words; + + @SerializedName("promotedByReRanking") + private Boolean promotedByReRanking; public RankingInfo setFilters(Integer filters) { this.filters = filters; @@ -51,7 +55,7 @@ public RankingInfo setFilters(Integer filters) { * * @return filters */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getFilters() { return filters; } @@ -66,7 +70,7 @@ public RankingInfo setFirstMatchedWord(Integer firstMatchedWord) { * * @return firstMatchedWord */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getFirstMatchedWord() { return firstMatchedWord; } @@ -82,7 +86,7 @@ public RankingInfo setGeoDistance(Integer geoDistance) { * * @return geoDistance */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getGeoDistance() { return geoDistance; } @@ -103,33 +107,37 @@ public Integer getGeoPrecision() { } public RankingInfo setMatchedGeoLocation( - Map matchedGeoLocation + MatchedGeoLocation matchedGeoLocation ) { this.matchedGeoLocation = matchedGeoLocation; return this; } - public RankingInfo putMatchedGeoLocationItem( - String key, - RankingInfoMatchedGeoLocation matchedGeoLocationItem - ) { - if (this.matchedGeoLocation == null) { - this.matchedGeoLocation = new HashMap<>(); - } - this.matchedGeoLocation.put(key, matchedGeoLocationItem); - return this; - } - /** * Get matchedGeoLocation * * @return matchedGeoLocation */ @javax.annotation.Nullable - public Map getMatchedGeoLocation() { + public MatchedGeoLocation getMatchedGeoLocation() { return matchedGeoLocation; } + public RankingInfo setPersonalization(Personalization personalization) { + this.personalization = personalization; + return this; + } + + /** + * Get personalization + * + * @return personalization + */ + @javax.annotation.Nullable + public Personalization getPersonalization() { + return personalization; + } + public RankingInfo setNbExactWords(Integer nbExactWords) { this.nbExactWords = nbExactWords; return this; @@ -140,7 +148,7 @@ public RankingInfo setNbExactWords(Integer nbExactWords) { * * @return nbExactWords */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getNbExactWords() { return nbExactWords; } @@ -155,7 +163,7 @@ public RankingInfo setNbTypos(Integer nbTypos) { * * @return nbTypos */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getNbTypos() { return nbTypos; } @@ -170,7 +178,7 @@ public RankingInfo setPromoted(Boolean promoted) { * * @return promoted */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Boolean getPromoted() { return promoted; } @@ -201,24 +209,39 @@ public RankingInfo setUserScore(Integer userScore) { * * @return userScore */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public Integer getUserScore() { return userScore; } - public RankingInfo setWord(Integer word) { - this.word = word; + public RankingInfo setWords(Integer words) { + this.words = words; return this; } /** * Number of matched words, including prefixes and typos. * - * @return word + * @return words + */ + @javax.annotation.Nonnull + public Integer getWords() { + return words; + } + + public RankingInfo setPromotedByReRanking(Boolean promotedByReRanking) { + this.promotedByReRanking = promotedByReRanking; + return this; + } + + /** + * Wether the record are promoted by the re-ranking strategy. + * + * @return promotedByReRanking */ @javax.annotation.Nullable - public Integer getWord() { - return word; + public Boolean getPromotedByReRanking() { + return promotedByReRanking; } @Override @@ -236,12 +259,14 @@ public boolean equals(Object o) { Objects.equals(this.geoDistance, rankingInfo.geoDistance) && Objects.equals(this.geoPrecision, rankingInfo.geoPrecision) && Objects.equals(this.matchedGeoLocation, rankingInfo.matchedGeoLocation) && + Objects.equals(this.personalization, rankingInfo.personalization) && Objects.equals(this.nbExactWords, rankingInfo.nbExactWords) && Objects.equals(this.nbTypos, rankingInfo.nbTypos) && Objects.equals(this.promoted, rankingInfo.promoted) && Objects.equals(this.proximityDistance, rankingInfo.proximityDistance) && Objects.equals(this.userScore, rankingInfo.userScore) && - Objects.equals(this.word, rankingInfo.word) + Objects.equals(this.words, rankingInfo.words) && + Objects.equals(this.promotedByReRanking, rankingInfo.promotedByReRanking) ); } @@ -253,12 +278,14 @@ public int hashCode() { geoDistance, geoPrecision, matchedGeoLocation, + personalization, nbExactWords, nbTypos, promoted, proximityDistance, userScore, - word + words, + promotedByReRanking ); } @@ -283,6 +310,10 @@ public String toString() { .append(" matchedGeoLocation: ") .append(toIndentedString(matchedGeoLocation)) .append("\n"); + sb + .append(" personalization: ") + .append(toIndentedString(personalization)) + .append("\n"); sb .append(" nbExactWords: ") .append(toIndentedString(nbExactWords)) @@ -297,7 +328,11 @@ public String toString() { .append(" userScore: ") .append(toIndentedString(userScore)) .append("\n"); - sb.append(" word: ").append(toIndentedString(word)).append("\n"); + sb.append(" words: ").append(toIndentedString(words)).append("\n"); + sb + .append(" promotedByReRanking: ") + .append(toIndentedString(promotedByReRanking)) + .append("\n"); sb.append("}"); return sb.toString(); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/ReRankingApplyFilter.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/ReRankingApplyFilter.java new file mode 100644 index 0000000000..923fd6fcd3 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/ReRankingApplyFilter.java @@ -0,0 +1,73 @@ +package com.algolia.model.search; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(ReRankingApplyFilter.Adapter.class) +public abstract class ReRankingApplyFilter implements CompoundType { + + public static ReRankingApplyFilter ofListListString( + List> inside + ) { + return new ReRankingApplyFilterListListString(inside); + } + + public static ReRankingApplyFilter ofListString(List inside) { + return new ReRankingApplyFilterListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final ReRankingApplyFilter oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public ReRankingApplyFilter read(final JsonReader jsonReader) + throws IOException { + return null; + } + } +} + +@JsonAdapter(ReRankingApplyFilter.Adapter.class) +class ReRankingApplyFilterListListString extends ReRankingApplyFilter { + + private final List> insideValue; + + ReRankingApplyFilterListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(ReRankingApplyFilter.Adapter.class) +class ReRankingApplyFilterListString extends ReRankingApplyFilter { + + private final List insideValue; + + ReRankingApplyFilterListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/SearchParamsObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/SearchParamsObject.java index 4ae3fc6055..27423d3983 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/SearchParamsObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/SearchParamsObject.java @@ -16,16 +16,16 @@ public class SearchParamsObject { private String filters = ""; @SerializedName("facetFilters") - private List facetFilters = null; + private FacetFilters facetFilters; @SerializedName("optionalFilters") - private List optionalFilters = null; + private OptionalFilters optionalFilters; @SerializedName("numericFilters") - private List numericFilters = null; + private NumericFilters numericFilters; @SerializedName("tagFilters") - private List tagFilters = null; + private TagFilters tagFilters; @SerializedName("sumOrFiltersScores") private Boolean sumOrFiltersScores = false; @@ -105,6 +105,9 @@ public class SearchParamsObject { @SerializedName("enableReRanking") private Boolean enableReRanking = true; + @SerializedName("reRankingApplyFilter") + private ReRankingApplyFilter reRankingApplyFilter; + @SerializedName("query") private String query = ""; @@ -273,96 +276,65 @@ public String getFilters() { return filters; } - public SearchParamsObject setFacetFilters(List facetFilters) { + public SearchParamsObject setFacetFilters(FacetFilters facetFilters) { this.facetFilters = facetFilters; return this; } - public SearchParamsObject addFacetFiltersItem(String facetFiltersItem) { - if (this.facetFilters == null) { - this.facetFilters = new ArrayList<>(); - } - this.facetFilters.add(facetFiltersItem); - return this; - } - /** - * Filter hits by facet value. + * Get facetFilters * * @return facetFilters */ @javax.annotation.Nullable - public List getFacetFilters() { + public FacetFilters getFacetFilters() { return facetFilters; } - public SearchParamsObject setOptionalFilters(List optionalFilters) { + public SearchParamsObject setOptionalFilters( + OptionalFilters optionalFilters + ) { this.optionalFilters = optionalFilters; return this; } - public SearchParamsObject 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. + * Get optionalFilters * * @return optionalFilters */ @javax.annotation.Nullable - public List getOptionalFilters() { + public OptionalFilters getOptionalFilters() { return optionalFilters; } - public SearchParamsObject setNumericFilters(List numericFilters) { + public SearchParamsObject setNumericFilters(NumericFilters numericFilters) { this.numericFilters = numericFilters; return this; } - public SearchParamsObject addNumericFiltersItem(String numericFiltersItem) { - if (this.numericFilters == null) { - this.numericFilters = new ArrayList<>(); - } - this.numericFilters.add(numericFiltersItem); - return this; - } - /** - * Filter on numeric attributes. + * Get numericFilters * * @return numericFilters */ @javax.annotation.Nullable - public List getNumericFilters() { + public NumericFilters getNumericFilters() { return numericFilters; } - public SearchParamsObject setTagFilters(List tagFilters) { + public SearchParamsObject setTagFilters(TagFilters tagFilters) { this.tagFilters = tagFilters; return this; } - public SearchParamsObject addTagFiltersItem(String tagFiltersItem) { - if (this.tagFilters == null) { - this.tagFilters = new ArrayList<>(); - } - this.tagFilters.add(tagFiltersItem); - return this; - } - /** - * Filter hits by tags. + * Get tagFilters * * @return tagFilters */ @javax.annotation.Nullable - public List getTagFilters() { + public TagFilters getTagFilters() { return tagFilters; } @@ -823,6 +795,23 @@ public Boolean getEnableReRanking() { return enableReRanking; } + public SearchParamsObject setReRankingApplyFilter( + ReRankingApplyFilter reRankingApplyFilter + ) { + this.reRankingApplyFilter = reRankingApplyFilter; + return this; + } + + /** + * Get reRankingApplyFilter + * + * @return reRankingApplyFilter + */ + @javax.annotation.Nullable + public ReRankingApplyFilter getReRankingApplyFilter() { + return reRankingApplyFilter; + } + public SearchParamsObject setQuery(String query) { this.query = query; return this; @@ -1786,6 +1775,10 @@ public boolean equals(Object o) { this.enableReRanking, searchParamsObject.enableReRanking ) && + Objects.equals( + this.reRankingApplyFilter, + searchParamsObject.reRankingApplyFilter + ) && Objects.equals(this.query, searchParamsObject.query) && Objects.equals( this.searchableAttributes, @@ -1953,6 +1946,7 @@ public int hashCode() { percentileComputation, enableABTest, enableReRanking, + reRankingApplyFilter, query, searchableAttributes, attributesForFaceting, @@ -2118,6 +2112,10 @@ public String toString() { .append(" enableReRanking: ") .append(toIndentedString(enableReRanking)) .append("\n"); + sb + .append(" reRankingApplyFilter: ") + .append(toIndentedString(reRankingApplyFilter)) + .append("\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb .append(" searchableAttributes: ") diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/TagFilters.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/TagFilters.java new file mode 100644 index 0000000000..e72248355e --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/com/algolia/model/search/TagFilters.java @@ -0,0 +1,70 @@ +package com.algolia.model.search; + +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +@JsonAdapter(TagFilters.Adapter.class) +public abstract class TagFilters implements CompoundType { + + public static TagFilters ofListListString(List> inside) { + return new TagFiltersListListString(inside); + } + + public static TagFilters ofListString(List inside) { + return new TagFiltersListString(inside); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final TagFilters oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } + + @Override + public TagFilters read(final JsonReader jsonReader) throws IOException { + return null; + } + } +} + +@JsonAdapter(TagFilters.Adapter.class) +class TagFiltersListListString extends TagFilters { + + private final List> insideValue; + + TagFiltersListListString(List> insideValue) { + this.insideValue = insideValue; + } + + @Override + public List> getInsideValue() { + return insideValue; + } +} + +@JsonAdapter(TagFilters.Adapter.class) +class TagFiltersListString extends TagFilters { + + private final List insideValue; + + TagFiltersListString(List insideValue) { + this.insideValue = insideValue; + } + + @Override + public List getInsideValue() { + return insideValue; + } +} diff --git a/clients/algoliasearch-client-java-2/gradle.properties b/clients/algoliasearch-client-java-2/gradle.properties new file mode 100644 index 0000000000..ccf653420d --- /dev/null +++ b/clients/algoliasearch-client-java-2/gradle.properties @@ -0,0 +1,2 @@ +GROUP=com.algolia +VERSION_NAME=0.1.0-SNAPSHOT diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/baseSearchParams.ts index 77631535de..ee0468114d 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/baseSearchParams.ts @@ -1,4 +1,9 @@ import type { AroundRadius } from './aroundRadius'; +import type { FacetFilters } from './facetFilters'; +import type { NumericFilters } from './numericFilters'; +import type { OptionalFilters } from './optionalFilters'; +import type { ReRankingApplyFilter } from './reRankingApplyFilter'; +import type { TagFilters } from './tagFilters'; export type BaseSearchParams = { /** @@ -9,22 +14,10 @@ export type BaseSearchParams = { * Filter the query with numeric, facet and/or tag filters. */ filters?: string; - /** - * Filter hits by facet value. - */ - facetFilters?: string[]; - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. - */ - optionalFilters?: string[]; - /** - * Filter on numeric attributes. - */ - numericFilters?: string[]; - /** - * Filter hits by tags. - */ - tagFilters?: string[]; + facetFilters?: FacetFilters; + optionalFilters?: OptionalFilters; + numericFilters?: NumericFilters; + tagFilters?: TagFilters; /** * Determines how to calculate the total score for filtering. */ @@ -126,4 +119,5 @@ export type BaseSearchParams = { * Whether this search should use AI Re-Ranking. */ enableReRanking?: boolean; + reRankingApplyFilter?: ReRankingApplyFilter; }; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/facetFilters.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/facetFilters.ts new file mode 100644 index 0000000000..81c8556498 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/facetFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter hits by facet value. + */ +export type FacetFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/index.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/index.ts index e7fe0cff8f..a89f2f216d 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/index.ts @@ -29,6 +29,7 @@ export * from './dictionaryLanguage'; export * from './dictionaryType'; export * from './errorBase'; export * from './exactOnSingleWordQuery'; +export * from './facetFilters'; export * from './highlightResult'; export * from './hit'; export * from './indexSettings'; @@ -39,17 +40,21 @@ export * from './languages'; export * from './listIndicesResponse'; export * from './logType'; export * from './matchLevel'; +export * from './matchedGeoLocation'; export * from './multipleQueries'; export * from './multipleQueriesParams'; export * from './multipleQueriesResponse'; export * from './multipleQueriesStrategy'; export * from './multipleQueriesType'; +export * from './numericFilters'; export * from './operationType'; +export * from './optionalFilters'; export * from './params'; +export * from './personalization'; export * from './promote'; export * from './queryType'; export * from './rankingInfo'; -export * from './rankingInfoMatchedGeoLocation'; +export * from './reRankingApplyFilter'; export * from './removeWordsIfNoResults'; export * from './requiredSearchParams'; export * from './rule'; @@ -69,6 +74,7 @@ export * from './standardEntries'; export * from './synonymHit'; export * from './synonymHitHighlightResult'; export * from './synonymType'; +export * from './tagFilters'; export * from './taskStatus'; export * from './timeRange'; export * from './typoTolerance'; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/matchedGeoLocation.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/matchedGeoLocation.ts new file mode 100644 index 0000000000..59be433aa9 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/matchedGeoLocation.ts @@ -0,0 +1,14 @@ +export type MatchedGeoLocation = { + /** + * Latitude of the matched location. + */ + lat?: number; + /** + * Longitude of the matched location. + */ + lng?: number; + /** + * Distance between the matched location and the search location (in meters). + */ + distance?: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/numericFilters.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/numericFilters.ts new file mode 100644 index 0000000000..52b919691e --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/numericFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter on numeric attributes. + */ +export type NumericFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/optionalFilters.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/optionalFilters.ts new file mode 100644 index 0000000000..bb42671b8b --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/optionalFilters.ts @@ -0,0 +1,4 @@ +/** + * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. + */ +export type OptionalFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/personalization.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/personalization.ts new file mode 100644 index 0000000000..b19ecf729d --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/personalization.ts @@ -0,0 +1,14 @@ +export type Personalization = { + /** + * The score of the filters. + */ + filtersScore?: number; + /** + * The score of the ranking. + */ + rankingScore?: number; + /** + * The score of the event. + */ + score?: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/rankingInfo.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/rankingInfo.ts index c14a767726..a31c7e91d4 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/rankingInfo.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/rankingInfo.ts @@ -1,35 +1,37 @@ -import type { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; +import type { MatchedGeoLocation } from './matchedGeoLocation'; +import type { Personalization } from './personalization'; export type RankingInfo = { /** * This field is reserved for advanced usage. */ - filters?: number; + filters: number; /** * Position of the most important matched attribute in the attributes to index list. */ - firstMatchedWord?: number; + firstMatchedWord: number; /** * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). */ - geoDistance?: number; + geoDistance: number; /** * Precision used when computing the geo distance, in meters. */ geoPrecision?: number; - matchedGeoLocation?: { [key: string]: RankingInfoMatchedGeoLocation }; + matchedGeoLocation?: MatchedGeoLocation; + personalization?: Personalization; /** * Number of exactly matched words. */ - nbExactWords?: number; + nbExactWords: number; /** * Number of typos encountered when matching the record. */ - nbTypos?: number; + nbTypos: number; /** * Present and set to true if a Rule promoted the hit. */ - promoted?: boolean; + promoted: boolean; /** * When the query contains more than one word, the sum of the distances between matched words (in meters). */ @@ -37,9 +39,13 @@ export type RankingInfo = { /** * Custom ranking for the object, expressed as a single integer value. */ - userScore?: number; + userScore: number; /** * Number of matched words, including prefixes and typos. */ - word?: number; + words: number; + /** + * Wether the record are promoted by the re-ranking strategy. + */ + promotedByReRanking?: boolean; }; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/reRankingApplyFilter.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/reRankingApplyFilter.ts new file mode 100644 index 0000000000..9585c72f2f --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/reRankingApplyFilter.ts @@ -0,0 +1,4 @@ +/** + * When Dynamic Re-Ranking is enabled, only records that match these filters will be impacted by Dynamic Re-Ranking. + */ +export type ReRankingApplyFilter = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/tagFilters.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/tagFilters.ts new file mode 100644 index 0000000000..8478fc40fd --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/model/tagFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter hits by tags. + */ +export type TagFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts index 77631535de..ee0468114d 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/baseSearchParams.ts @@ -1,4 +1,9 @@ import type { AroundRadius } from './aroundRadius'; +import type { FacetFilters } from './facetFilters'; +import type { NumericFilters } from './numericFilters'; +import type { OptionalFilters } from './optionalFilters'; +import type { ReRankingApplyFilter } from './reRankingApplyFilter'; +import type { TagFilters } from './tagFilters'; export type BaseSearchParams = { /** @@ -9,22 +14,10 @@ export type BaseSearchParams = { * Filter the query with numeric, facet and/or tag filters. */ filters?: string; - /** - * Filter hits by facet value. - */ - facetFilters?: string[]; - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. - */ - optionalFilters?: string[]; - /** - * Filter on numeric attributes. - */ - numericFilters?: string[]; - /** - * Filter hits by tags. - */ - tagFilters?: string[]; + facetFilters?: FacetFilters; + optionalFilters?: OptionalFilters; + numericFilters?: NumericFilters; + tagFilters?: TagFilters; /** * Determines how to calculate the total score for filtering. */ @@ -126,4 +119,5 @@ export type BaseSearchParams = { * Whether this search should use AI Re-Ranking. */ enableReRanking?: boolean; + reRankingApplyFilter?: ReRankingApplyFilter; }; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/facetFilters.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/facetFilters.ts new file mode 100644 index 0000000000..81c8556498 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/facetFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter hits by facet value. + */ +export type FacetFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts index d5bfe99fad..5f77472e90 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/index.ts @@ -43,6 +43,7 @@ export * from './dictionarySettingsParams'; export * from './dictionaryType'; export * from './errorBase'; export * from './exactOnSingleWordQuery'; +export * from './facetFilters'; export * from './getDictionarySettingsResponse'; export * from './getLogsResponse'; export * from './getLogsResponseInnerQueries'; @@ -64,6 +65,7 @@ export * from './listIndicesResponse'; export * from './listUserIdsResponse'; export * from './logType'; export * from './matchLevel'; +export * from './matchedGeoLocation'; export * from './multipleBatchOperation'; export * from './multipleBatchResponse'; export * from './multipleGetObjectsParams'; @@ -72,13 +74,16 @@ export * from './multipleQueriesParams'; export * from './multipleQueriesResponse'; export * from './multipleQueriesStrategy'; export * from './multipleQueriesType'; +export * from './numericFilters'; export * from './operationIndexParams'; export * from './operationType'; +export * from './optionalFilters'; export * from './params'; +export * from './personalization'; export * from './promote'; export * from './queryType'; export * from './rankingInfo'; -export * from './rankingInfoMatchedGeoLocation'; +export * from './reRankingApplyFilter'; export * from './removeUserIdResponse'; export * from './removeWordsIfNoResults'; export * from './replaceSourceResponse'; @@ -109,6 +114,7 @@ export * from './standardEntries'; export * from './synonymHit'; export * from './synonymHitHighlightResult'; export * from './synonymType'; +export * from './tagFilters'; export * from './taskStatus'; export * from './timeRange'; export * from './typoTolerance'; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/matchedGeoLocation.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/matchedGeoLocation.ts new file mode 100644 index 0000000000..59be433aa9 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/matchedGeoLocation.ts @@ -0,0 +1,14 @@ +export type MatchedGeoLocation = { + /** + * Latitude of the matched location. + */ + lat?: number; + /** + * Longitude of the matched location. + */ + lng?: number; + /** + * Distance between the matched location and the search location (in meters). + */ + distance?: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/numericFilters.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/numericFilters.ts new file mode 100644 index 0000000000..52b919691e --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/numericFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter on numeric attributes. + */ +export type NumericFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/optionalFilters.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/optionalFilters.ts new file mode 100644 index 0000000000..bb42671b8b --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/optionalFilters.ts @@ -0,0 +1,4 @@ +/** + * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. + */ +export type OptionalFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/personalization.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/personalization.ts new file mode 100644 index 0000000000..b19ecf729d --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/personalization.ts @@ -0,0 +1,14 @@ +export type Personalization = { + /** + * The score of the filters. + */ + filtersScore?: number; + /** + * The score of the ranking. + */ + rankingScore?: number; + /** + * The score of the event. + */ + score?: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts index c14a767726..a31c7e91d4 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/rankingInfo.ts @@ -1,35 +1,37 @@ -import type { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; +import type { MatchedGeoLocation } from './matchedGeoLocation'; +import type { Personalization } from './personalization'; export type RankingInfo = { /** * This field is reserved for advanced usage. */ - filters?: number; + filters: number; /** * Position of the most important matched attribute in the attributes to index list. */ - firstMatchedWord?: number; + firstMatchedWord: number; /** * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). */ - geoDistance?: number; + geoDistance: number; /** * Precision used when computing the geo distance, in meters. */ geoPrecision?: number; - matchedGeoLocation?: { [key: string]: RankingInfoMatchedGeoLocation }; + matchedGeoLocation?: MatchedGeoLocation; + personalization?: Personalization; /** * Number of exactly matched words. */ - nbExactWords?: number; + nbExactWords: number; /** * Number of typos encountered when matching the record. */ - nbTypos?: number; + nbTypos: number; /** * Present and set to true if a Rule promoted the hit. */ - promoted?: boolean; + promoted: boolean; /** * When the query contains more than one word, the sum of the distances between matched words (in meters). */ @@ -37,9 +39,13 @@ export type RankingInfo = { /** * Custom ranking for the object, expressed as a single integer value. */ - userScore?: number; + userScore: number; /** * Number of matched words, including prefixes and typos. */ - word?: number; + words: number; + /** + * Wether the record are promoted by the re-ranking strategy. + */ + promotedByReRanking?: boolean; }; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/reRankingApplyFilter.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/reRankingApplyFilter.ts new file mode 100644 index 0000000000..9585c72f2f --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/reRankingApplyFilter.ts @@ -0,0 +1,4 @@ +/** + * When Dynamic Re-Ranking is enabled, only records that match these filters will be impacted by Dynamic Re-Ranking. + */ +export type ReRankingApplyFilter = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/client-search/model/tagFilters.ts b/clients/algoliasearch-client-javascript/packages/client-search/model/tagFilters.ts new file mode 100644 index 0000000000..8478fc40fd --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-search/model/tagFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter hits by tags. + */ +export type TagFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts index 77631535de..ee0468114d 100644 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/baseSearchParams.ts @@ -1,4 +1,9 @@ import type { AroundRadius } from './aroundRadius'; +import type { FacetFilters } from './facetFilters'; +import type { NumericFilters } from './numericFilters'; +import type { OptionalFilters } from './optionalFilters'; +import type { ReRankingApplyFilter } from './reRankingApplyFilter'; +import type { TagFilters } from './tagFilters'; export type BaseSearchParams = { /** @@ -9,22 +14,10 @@ export type BaseSearchParams = { * Filter the query with numeric, facet and/or tag filters. */ filters?: string; - /** - * Filter hits by facet value. - */ - facetFilters?: string[]; - /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. - */ - optionalFilters?: string[]; - /** - * Filter on numeric attributes. - */ - numericFilters?: string[]; - /** - * Filter hits by tags. - */ - tagFilters?: string[]; + facetFilters?: FacetFilters; + optionalFilters?: OptionalFilters; + numericFilters?: NumericFilters; + tagFilters?: TagFilters; /** * Determines how to calculate the total score for filtering. */ @@ -126,4 +119,5 @@ export type BaseSearchParams = { * Whether this search should use AI Re-Ranking. */ enableReRanking?: boolean; + reRankingApplyFilter?: ReRankingApplyFilter; }; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/facetFilters.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/facetFilters.ts new file mode 100644 index 0000000000..81c8556498 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/facetFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter hits by facet value. + */ +export type FacetFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/index.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/index.ts index c7d68933bc..7a0d0628f2 100644 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/index.ts @@ -10,14 +10,19 @@ export * from './baseSearchResponseFacetsStats'; export * from './baseTrendingRequest'; export * from './errorBase'; export * from './exactOnSingleWordQuery'; +export * from './facetFilters'; export * from './getRecommendationsParams'; export * from './getRecommendationsResponse'; export * from './highlightResult'; export * from './indexSettingsAsSearchParams'; export * from './matchLevel'; +export * from './matchedGeoLocation'; +export * from './numericFilters'; +export * from './optionalFilters'; +export * from './personalization'; export * from './queryType'; export * from './rankingInfo'; -export * from './rankingInfoMatchedGeoLocation'; +export * from './reRankingApplyFilter'; export * from './recommendHit'; export * from './recommendHits'; export * from './recommendationModels'; @@ -28,6 +33,7 @@ export * from './removeWordsIfNoResults'; export * from './requiredSearchParams'; export * from './searchParamsObject'; export * from './snippetResult'; +export * from './tagFilters'; export * from './trendingModels'; export * from './trendingRequest'; export * from './typoTolerance'; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/matchedGeoLocation.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/matchedGeoLocation.ts new file mode 100644 index 0000000000..59be433aa9 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/matchedGeoLocation.ts @@ -0,0 +1,14 @@ +export type MatchedGeoLocation = { + /** + * Latitude of the matched location. + */ + lat?: number; + /** + * Longitude of the matched location. + */ + lng?: number; + /** + * Distance between the matched location and the search location (in meters). + */ + distance?: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/numericFilters.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/numericFilters.ts new file mode 100644 index 0000000000..52b919691e --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/numericFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter on numeric attributes. + */ +export type NumericFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/optionalFilters.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/optionalFilters.ts new file mode 100644 index 0000000000..bb42671b8b --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/optionalFilters.ts @@ -0,0 +1,4 @@ +/** + * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. + */ +export type OptionalFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/personalization.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/personalization.ts new file mode 100644 index 0000000000..b19ecf729d --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/personalization.ts @@ -0,0 +1,14 @@ +export type Personalization = { + /** + * The score of the filters. + */ + filtersScore?: number; + /** + * The score of the ranking. + */ + rankingScore?: number; + /** + * The score of the event. + */ + score?: number; +}; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts index c14a767726..a31c7e91d4 100644 --- a/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/rankingInfo.ts @@ -1,35 +1,37 @@ -import type { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; +import type { MatchedGeoLocation } from './matchedGeoLocation'; +import type { Personalization } from './personalization'; export type RankingInfo = { /** * This field is reserved for advanced usage. */ - filters?: number; + filters: number; /** * Position of the most important matched attribute in the attributes to index list. */ - firstMatchedWord?: number; + firstMatchedWord: number; /** * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). */ - geoDistance?: number; + geoDistance: number; /** * Precision used when computing the geo distance, in meters. */ geoPrecision?: number; - matchedGeoLocation?: { [key: string]: RankingInfoMatchedGeoLocation }; + matchedGeoLocation?: MatchedGeoLocation; + personalization?: Personalization; /** * Number of exactly matched words. */ - nbExactWords?: number; + nbExactWords: number; /** * Number of typos encountered when matching the record. */ - nbTypos?: number; + nbTypos: number; /** * Present and set to true if a Rule promoted the hit. */ - promoted?: boolean; + promoted: boolean; /** * When the query contains more than one word, the sum of the distances between matched words (in meters). */ @@ -37,9 +39,13 @@ export type RankingInfo = { /** * Custom ranking for the object, expressed as a single integer value. */ - userScore?: number; + userScore: number; /** * Number of matched words, including prefixes and typos. */ - word?: number; + words: number; + /** + * Wether the record are promoted by the re-ranking strategy. + */ + promotedByReRanking?: boolean; }; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/reRankingApplyFilter.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/reRankingApplyFilter.ts new file mode 100644 index 0000000000..9585c72f2f --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/reRankingApplyFilter.ts @@ -0,0 +1,4 @@ +/** + * When Dynamic Re-Ranking is enabled, only records that match these filters will be impacted by Dynamic Re-Ranking. + */ +export type ReRankingApplyFilter = string[] | string[][]; diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/tagFilters.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/tagFilters.ts new file mode 100644 index 0000000000..8478fc40fd --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/recommend/model/tagFilters.ts @@ -0,0 +1,4 @@ +/** + * Filter hits by tags. + */ +export type TagFilters = string[] | string[][]; diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchParams.php index 1949f41527..756d219d1c 100644 --- a/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchParams.php +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchParams.php @@ -18,10 +18,10 @@ class BaseSearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implem protected static $modelTypes = [ 'similarQuery' => 'string', 'filters' => 'string', - 'facetFilters' => 'string[]', - 'optionalFilters' => 'string[]', - 'numericFilters' => 'string[]', - 'tagFilters' => 'string[]', + 'facetFilters' => '\Algolia\AlgoliaSearch\Model\Recommend\FacetFilters', + 'optionalFilters' => '\Algolia\AlgoliaSearch\Model\Recommend\OptionalFilters', + 'numericFilters' => '\Algolia\AlgoliaSearch\Model\Recommend\NumericFilters', + 'tagFilters' => '\Algolia\AlgoliaSearch\Model\Recommend\TagFilters', 'sumOrFiltersScores' => 'bool', 'facets' => 'string[]', 'maxValuesPerFacet' => 'int', @@ -48,6 +48,7 @@ class BaseSearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implem 'percentileComputation' => 'bool', 'enableABTest' => 'bool', 'enableReRanking' => 'bool', + 'reRankingApplyFilter' => '\Algolia\AlgoliaSearch\Model\Recommend\ReRankingApplyFilter', ]; /** @@ -88,6 +89,7 @@ class BaseSearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implem 'percentileComputation' => null, 'enableABTest' => null, 'enableReRanking' => null, + 'reRankingApplyFilter' => null, ]; /** @@ -148,6 +150,7 @@ public static function modelFormats() 'percentileComputation' => 'setPercentileComputation', 'enableABTest' => 'setEnableABTest', 'enableReRanking' => 'setEnableReRanking', + 'reRankingApplyFilter' => 'setReRankingApplyFilter', ]; /** @@ -188,6 +191,7 @@ public static function modelFormats() 'percentileComputation' => 'getPercentileComputation', 'enableABTest' => 'getEnableABTest', 'enableReRanking' => 'getEnableReRanking', + 'reRankingApplyFilter' => 'getReRankingApplyFilter', ]; /** @@ -320,6 +324,9 @@ public function __construct(array $data = null) if (isset($data['enableReRanking'])) { $this->container['enableReRanking'] = $data['enableReRanking']; } + if (isset($data['reRankingApplyFilter'])) { + $this->container['reRankingApplyFilter'] = $data['reRankingApplyFilter']; + } } /** @@ -408,7 +415,7 @@ public function setFilters($filters) /** * Gets facetFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\FacetFilters|null */ public function getFacetFilters() { @@ -418,7 +425,7 @@ public function getFacetFilters() /** * Sets facetFilters * - * @param string[]|null $facetFilters filter hits by facet value + * @param \Algolia\AlgoliaSearch\Model\Recommend\FacetFilters|null $facetFilters facetFilters * * @return self */ @@ -432,7 +439,7 @@ public function setFacetFilters($facetFilters) /** * Gets optionalFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\OptionalFilters|null */ public function getOptionalFilters() { @@ -442,7 +449,7 @@ public function getOptionalFilters() /** * Sets optionalFilters * - * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * @param \Algolia\AlgoliaSearch\Model\Recommend\OptionalFilters|null $optionalFilters optionalFilters * * @return self */ @@ -456,7 +463,7 @@ public function setOptionalFilters($optionalFilters) /** * Gets numericFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\NumericFilters|null */ public function getNumericFilters() { @@ -466,7 +473,7 @@ public function getNumericFilters() /** * Sets numericFilters * - * @param string[]|null $numericFilters filter on numeric attributes + * @param \Algolia\AlgoliaSearch\Model\Recommend\NumericFilters|null $numericFilters numericFilters * * @return self */ @@ -480,7 +487,7 @@ public function setNumericFilters($numericFilters) /** * Gets tagFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\TagFilters|null */ public function getTagFilters() { @@ -490,7 +497,7 @@ public function getTagFilters() /** * Sets tagFilters * - * @param string[]|null $tagFilters filter hits by tags + * @param \Algolia\AlgoliaSearch\Model\Recommend\TagFilters|null $tagFilters tagFilters * * @return self */ @@ -1135,6 +1142,30 @@ public function setEnableReRanking($enableReRanking) return $this; } + + /** + * Gets reRankingApplyFilter + * + * @return \Algolia\AlgoliaSearch\Model\Recommend\ReRankingApplyFilter|null + */ + public function getReRankingApplyFilter() + { + return $this->container['reRankingApplyFilter'] ?? null; + } + + /** + * Sets reRankingApplyFilter + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\ReRankingApplyFilter|null $reRankingApplyFilter reRankingApplyFilter + * + * @return self + */ + public function setReRankingApplyFilter($reRankingApplyFilter) + { + $this->container['reRankingApplyFilter'] = $reRankingApplyFilter; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/FacetFilters.php b/clients/algoliasearch-client-php/lib/Model/Recommend/FacetFilters.php new file mode 100644 index 0000000000..191877ee8f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/FacetFilters.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/MatchedGeoLocation.php b/clients/algoliasearch-client-php/lib/Model/Recommend/MatchedGeoLocation.php new file mode 100644 index 0000000000..4e27ae1b0f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/MatchedGeoLocation.php @@ -0,0 +1,269 @@ + 'double', + 'lng' => 'double', + 'distance' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $modelFormats = [ + 'lat' => 'double', + 'lng' => 'double', + 'distance' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function modelTypes() + { + return self::$modelTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function modelFormats() + { + return self::$modelFormats; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'lat' => 'setLat', + 'lng' => 'setLng', + 'distance' => 'setDistance', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'lat' => 'getLat', + 'lng' => 'getLng', + 'distance' => 'getDistance', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + */ + public function __construct(array $data = null) + { + if (isset($data['lat'])) { + $this->container['lat'] = $data['lat']; + } + if (isset($data['lng'])) { + $this->container['lng'] = $data['lng']; + } + if (isset($data['distance'])) { + $this->container['distance'] = $data['distance']; + } + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets lat + * + * @return float|null + */ + public function getLat() + { + return $this->container['lat'] ?? null; + } + + /** + * Sets lat + * + * @param float|null $lat latitude of the matched location + * + * @return self + */ + public function setLat($lat) + { + $this->container['lat'] = $lat; + + return $this; + } + + /** + * Gets lng + * + * @return float|null + */ + public function getLng() + { + return $this->container['lng'] ?? null; + } + + /** + * Sets lng + * + * @param float|null $lng longitude of the matched location + * + * @return self + */ + public function setLng($lng) + { + $this->container['lng'] = $lng; + + return $this; + } + + /** + * Gets distance + * + * @return int|null + */ + public function getDistance() + { + return $this->container['distance'] ?? null; + } + + /** + * Sets distance + * + * @param int|null $distance distance between the matched location and the search location (in meters) + * + * @return self + */ + public function setDistance($distance) + { + $this->container['distance'] = $distance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/NumericFilters.php b/clients/algoliasearch-client-php/lib/Model/Recommend/NumericFilters.php new file mode 100644 index 0000000000..1c992f052f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/NumericFilters.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/OptionalFilters.php b/clients/algoliasearch-client-php/lib/Model/Recommend/OptionalFilters.php new file mode 100644 index 0000000000..3fbad5f1ee --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/OptionalFilters.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/Personalization.php b/clients/algoliasearch-client-php/lib/Model/Recommend/Personalization.php new file mode 100644 index 0000000000..430a58c6bb --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/Personalization.php @@ -0,0 +1,269 @@ + 'int', + 'rankingScore' => 'int', + 'score' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $modelFormats = [ + 'filtersScore' => null, + 'rankingScore' => null, + 'score' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function modelTypes() + { + return self::$modelTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function modelFormats() + { + return self::$modelFormats; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'filtersScore' => 'setFiltersScore', + 'rankingScore' => 'setRankingScore', + 'score' => 'setScore', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'filtersScore' => 'getFiltersScore', + 'rankingScore' => 'getRankingScore', + 'score' => 'getScore', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + */ + public function __construct(array $data = null) + { + if (isset($data['filtersScore'])) { + $this->container['filtersScore'] = $data['filtersScore']; + } + if (isset($data['rankingScore'])) { + $this->container['rankingScore'] = $data['rankingScore']; + } + if (isset($data['score'])) { + $this->container['score'] = $data['score']; + } + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets filtersScore + * + * @return int|null + */ + public function getFiltersScore() + { + return $this->container['filtersScore'] ?? null; + } + + /** + * Sets filtersScore + * + * @param int|null $filtersScore the score of the filters + * + * @return self + */ + public function setFiltersScore($filtersScore) + { + $this->container['filtersScore'] = $filtersScore; + + return $this; + } + + /** + * Gets rankingScore + * + * @return int|null + */ + public function getRankingScore() + { + return $this->container['rankingScore'] ?? null; + } + + /** + * Sets rankingScore + * + * @param int|null $rankingScore the score of the ranking + * + * @return self + */ + public function setRankingScore($rankingScore) + { + $this->container['rankingScore'] = $rankingScore; + + return $this; + } + + /** + * Gets score + * + * @return int|null + */ + public function getScore() + { + return $this->container['score'] ?? null; + } + + /** + * Sets score + * + * @param int|null $score the score of the event + * + * @return self + */ + public function setScore($score) + { + $this->container['score'] = $score; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/RankingInfo.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RankingInfo.php index ca189d3649..ba9f4efc68 100644 --- a/clients/algoliasearch-client-php/lib/Model/Recommend/RankingInfo.php +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/RankingInfo.php @@ -20,13 +20,15 @@ class RankingInfo extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'firstMatchedWord' => 'int', 'geoDistance' => 'int', 'geoPrecision' => 'int', - 'matchedGeoLocation' => 'array', + 'matchedGeoLocation' => '\Algolia\AlgoliaSearch\Model\Recommend\MatchedGeoLocation', + 'personalization' => '\Algolia\AlgoliaSearch\Model\Recommend\Personalization', 'nbExactWords' => 'int', 'nbTypos' => 'int', 'promoted' => 'bool', 'proximityDistance' => 'int', 'userScore' => 'int', - 'word' => 'int', + 'words' => 'int', + 'promotedByReRanking' => 'bool', ]; /** @@ -40,12 +42,14 @@ class RankingInfo extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'geoDistance' => null, 'geoPrecision' => null, 'matchedGeoLocation' => null, + 'personalization' => null, 'nbExactWords' => null, 'nbTypos' => null, 'promoted' => null, 'proximityDistance' => null, 'userScore' => null, - 'word' => null, + 'words' => null, + 'promotedByReRanking' => null, ]; /** @@ -79,12 +83,14 @@ public static function modelFormats() 'geoDistance' => 'setGeoDistance', 'geoPrecision' => 'setGeoPrecision', 'matchedGeoLocation' => 'setMatchedGeoLocation', + 'personalization' => 'setPersonalization', 'nbExactWords' => 'setNbExactWords', 'nbTypos' => 'setNbTypos', 'promoted' => 'setPromoted', 'proximityDistance' => 'setProximityDistance', 'userScore' => 'setUserScore', - 'word' => 'setWord', + 'words' => 'setWords', + 'promotedByReRanking' => 'setPromotedByReRanking', ]; /** @@ -98,12 +104,14 @@ public static function modelFormats() 'geoDistance' => 'getGeoDistance', 'geoPrecision' => 'getGeoPrecision', 'matchedGeoLocation' => 'getMatchedGeoLocation', + 'personalization' => 'getPersonalization', 'nbExactWords' => 'getNbExactWords', 'nbTypos' => 'getNbTypos', 'promoted' => 'getPromoted', 'proximityDistance' => 'getProximityDistance', 'userScore' => 'getUserScore', - 'word' => 'getWord', + 'words' => 'getWords', + 'promotedByReRanking' => 'getPromotedByReRanking', ]; /** @@ -155,6 +163,9 @@ public function __construct(array $data = null) if (isset($data['matchedGeoLocation'])) { $this->container['matchedGeoLocation'] = $data['matchedGeoLocation']; } + if (isset($data['personalization'])) { + $this->container['personalization'] = $data['personalization']; + } if (isset($data['nbExactWords'])) { $this->container['nbExactWords'] = $data['nbExactWords']; } @@ -170,8 +181,11 @@ public function __construct(array $data = null) if (isset($data['userScore'])) { $this->container['userScore'] = $data['userScore']; } - if (isset($data['word'])) { - $this->container['word'] = $data['word']; + if (isset($data['words'])) { + $this->container['words'] = $data['words']; + } + if (isset($data['promotedByReRanking'])) { + $this->container['promotedByReRanking'] = $data['promotedByReRanking']; } } @@ -184,6 +198,31 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!isset($this->container['filters']) || $this->container['filters'] === null) { + $invalidProperties[] = "'filters' can't be null"; + } + if (!isset($this->container['firstMatchedWord']) || $this->container['firstMatchedWord'] === null) { + $invalidProperties[] = "'firstMatchedWord' can't be null"; + } + if (!isset($this->container['geoDistance']) || $this->container['geoDistance'] === null) { + $invalidProperties[] = "'geoDistance' can't be null"; + } + if (!isset($this->container['nbExactWords']) || $this->container['nbExactWords'] === null) { + $invalidProperties[] = "'nbExactWords' can't be null"; + } + if (!isset($this->container['nbTypos']) || $this->container['nbTypos'] === null) { + $invalidProperties[] = "'nbTypos' can't be null"; + } + if (!isset($this->container['promoted']) || $this->container['promoted'] === null) { + $invalidProperties[] = "'promoted' can't be null"; + } + if (!isset($this->container['userScore']) || $this->container['userScore'] === null) { + $invalidProperties[] = "'userScore' can't be null"; + } + if (!isset($this->container['words']) || $this->container['words'] === null) { + $invalidProperties[] = "'words' can't be null"; + } + return $invalidProperties; } @@ -201,7 +240,7 @@ public function valid() /** * Gets filters * - * @return int|null + * @return int */ public function getFilters() { @@ -211,7 +250,7 @@ public function getFilters() /** * Sets filters * - * @param int|null $filters this field is reserved for advanced usage + * @param int $filters this field is reserved for advanced usage * * @return self */ @@ -225,7 +264,7 @@ public function setFilters($filters) /** * Gets firstMatchedWord * - * @return int|null + * @return int */ public function getFirstMatchedWord() { @@ -235,7 +274,7 @@ public function getFirstMatchedWord() /** * Sets firstMatchedWord * - * @param int|null $firstMatchedWord position of the most important matched attribute in the attributes to index list + * @param int $firstMatchedWord position of the most important matched attribute in the attributes to index list * * @return self */ @@ -249,7 +288,7 @@ public function setFirstMatchedWord($firstMatchedWord) /** * Gets geoDistance * - * @return int|null + * @return int */ public function getGeoDistance() { @@ -259,7 +298,7 @@ public function getGeoDistance() /** * Sets geoDistance * - * @param int|null $geoDistance distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters) + * @param int $geoDistance distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters) * * @return self */ @@ -297,7 +336,7 @@ public function setGeoPrecision($geoPrecision) /** * Gets matchedGeoLocation * - * @return array|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\MatchedGeoLocation|null */ public function getMatchedGeoLocation() { @@ -307,7 +346,7 @@ public function getMatchedGeoLocation() /** * Sets matchedGeoLocation * - * @param array|null $matchedGeoLocation matchedGeoLocation + * @param \Algolia\AlgoliaSearch\Model\Recommend\MatchedGeoLocation|null $matchedGeoLocation matchedGeoLocation * * @return self */ @@ -318,10 +357,34 @@ public function setMatchedGeoLocation($matchedGeoLocation) return $this; } + /** + * Gets personalization + * + * @return \Algolia\AlgoliaSearch\Model\Recommend\Personalization|null + */ + public function getPersonalization() + { + return $this->container['personalization'] ?? null; + } + + /** + * Sets personalization + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\Personalization|null $personalization personalization + * + * @return self + */ + public function setPersonalization($personalization) + { + $this->container['personalization'] = $personalization; + + return $this; + } + /** * Gets nbExactWords * - * @return int|null + * @return int */ public function getNbExactWords() { @@ -331,7 +394,7 @@ public function getNbExactWords() /** * Sets nbExactWords * - * @param int|null $nbExactWords number of exactly matched words + * @param int $nbExactWords number of exactly matched words * * @return self */ @@ -345,7 +408,7 @@ public function setNbExactWords($nbExactWords) /** * Gets nbTypos * - * @return int|null + * @return int */ public function getNbTypos() { @@ -355,7 +418,7 @@ public function getNbTypos() /** * Sets nbTypos * - * @param int|null $nbTypos number of typos encountered when matching the record + * @param int $nbTypos number of typos encountered when matching the record * * @return self */ @@ -369,7 +432,7 @@ public function setNbTypos($nbTypos) /** * Gets promoted * - * @return bool|null + * @return bool */ public function getPromoted() { @@ -379,7 +442,7 @@ public function getPromoted() /** * Sets promoted * - * @param bool|null $promoted present and set to true if a Rule promoted the hit + * @param bool $promoted present and set to true if a Rule promoted the hit * * @return self */ @@ -417,7 +480,7 @@ public function setProximityDistance($proximityDistance) /** * Gets userScore * - * @return int|null + * @return int */ public function getUserScore() { @@ -427,7 +490,7 @@ public function getUserScore() /** * Sets userScore * - * @param int|null $userScore custom ranking for the object, expressed as a single integer value + * @param int $userScore custom ranking for the object, expressed as a single integer value * * @return self */ @@ -439,25 +502,49 @@ public function setUserScore($userScore) } /** - * Gets word + * Gets words * - * @return int|null + * @return int + */ + public function getWords() + { + return $this->container['words'] ?? null; + } + + /** + * Sets words + * + * @param int $words number of matched words, including prefixes and typos + * + * @return self + */ + public function setWords($words) + { + $this->container['words'] = $words; + + return $this; + } + + /** + * Gets promotedByReRanking + * + * @return bool|null */ - public function getWord() + public function getPromotedByReRanking() { - return $this->container['word'] ?? null; + return $this->container['promotedByReRanking'] ?? null; } /** - * Sets word + * Sets promotedByReRanking * - * @param int|null $word number of matched words, including prefixes and typos + * @param bool|null $promotedByReRanking wether the record are promoted by the re-ranking strategy * * @return self */ - public function setWord($word) + public function setPromotedByReRanking($promotedByReRanking) { - $this->container['word'] = $word; + $this->container['promotedByReRanking'] = $promotedByReRanking; return $this; } diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/ReRankingApplyFilter.php b/clients/algoliasearch-client-php/lib/Model/Recommend/ReRankingApplyFilter.php new file mode 100644 index 0000000000..217b145262 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/ReRankingApplyFilter.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/SearchParamsObject.php b/clients/algoliasearch-client-php/lib/Model/Recommend/SearchParamsObject.php index 7ad341068a..b393fec4dd 100644 --- a/clients/algoliasearch-client-php/lib/Model/Recommend/SearchParamsObject.php +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/SearchParamsObject.php @@ -18,10 +18,10 @@ class SearchParamsObject extends \Algolia\AlgoliaSearch\Model\AbstractModel impl protected static $modelTypes = [ 'similarQuery' => 'string', 'filters' => 'string', - 'facetFilters' => 'string[]', - 'optionalFilters' => 'string[]', - 'numericFilters' => 'string[]', - 'tagFilters' => 'string[]', + 'facetFilters' => '\Algolia\AlgoliaSearch\Model\Recommend\FacetFilters', + 'optionalFilters' => '\Algolia\AlgoliaSearch\Model\Recommend\OptionalFilters', + 'numericFilters' => '\Algolia\AlgoliaSearch\Model\Recommend\NumericFilters', + 'tagFilters' => '\Algolia\AlgoliaSearch\Model\Recommend\TagFilters', 'sumOrFiltersScores' => 'bool', 'facets' => 'string[]', 'maxValuesPerFacet' => 'int', @@ -48,6 +48,7 @@ class SearchParamsObject extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'percentileComputation' => 'bool', 'enableABTest' => 'bool', 'enableReRanking' => 'bool', + 'reRankingApplyFilter' => '\Algolia\AlgoliaSearch\Model\Recommend\ReRankingApplyFilter', 'query' => 'string', 'searchableAttributes' => 'string[]', 'attributesForFaceting' => 'string[]', @@ -133,6 +134,7 @@ class SearchParamsObject extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'percentileComputation' => null, 'enableABTest' => null, 'enableReRanking' => null, + 'reRankingApplyFilter' => null, 'query' => null, 'searchableAttributes' => null, 'attributesForFaceting' => null, @@ -238,6 +240,7 @@ public static function modelFormats() 'percentileComputation' => 'setPercentileComputation', 'enableABTest' => 'setEnableABTest', 'enableReRanking' => 'setEnableReRanking', + 'reRankingApplyFilter' => 'setReRankingApplyFilter', 'query' => 'setQuery', 'searchableAttributes' => 'setSearchableAttributes', 'attributesForFaceting' => 'setAttributesForFaceting', @@ -323,6 +326,7 @@ public static function modelFormats() 'percentileComputation' => 'getPercentileComputation', 'enableABTest' => 'getEnableABTest', 'enableReRanking' => 'getEnableReRanking', + 'reRankingApplyFilter' => 'getReRankingApplyFilter', 'query' => 'getQuery', 'searchableAttributes' => 'getSearchableAttributes', 'attributesForFaceting' => 'getAttributesForFaceting', @@ -500,6 +504,9 @@ public function __construct(array $data = null) if (isset($data['enableReRanking'])) { $this->container['enableReRanking'] = $data['enableReRanking']; } + if (isset($data['reRankingApplyFilter'])) { + $this->container['reRankingApplyFilter'] = $data['reRankingApplyFilter']; + } if (isset($data['query'])) { $this->container['query'] = $data['query']; } @@ -746,7 +753,7 @@ public function setFilters($filters) /** * Gets facetFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\FacetFilters|null */ public function getFacetFilters() { @@ -756,7 +763,7 @@ public function getFacetFilters() /** * Sets facetFilters * - * @param string[]|null $facetFilters filter hits by facet value + * @param \Algolia\AlgoliaSearch\Model\Recommend\FacetFilters|null $facetFilters facetFilters * * @return self */ @@ -770,7 +777,7 @@ public function setFacetFilters($facetFilters) /** * Gets optionalFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\OptionalFilters|null */ public function getOptionalFilters() { @@ -780,7 +787,7 @@ public function getOptionalFilters() /** * Sets optionalFilters * - * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * @param \Algolia\AlgoliaSearch\Model\Recommend\OptionalFilters|null $optionalFilters optionalFilters * * @return self */ @@ -794,7 +801,7 @@ public function setOptionalFilters($optionalFilters) /** * Gets numericFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\NumericFilters|null */ public function getNumericFilters() { @@ -804,7 +811,7 @@ public function getNumericFilters() /** * Sets numericFilters * - * @param string[]|null $numericFilters filter on numeric attributes + * @param \Algolia\AlgoliaSearch\Model\Recommend\NumericFilters|null $numericFilters numericFilters * * @return self */ @@ -818,7 +825,7 @@ public function setNumericFilters($numericFilters) /** * Gets tagFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Recommend\TagFilters|null */ public function getTagFilters() { @@ -828,7 +835,7 @@ public function getTagFilters() /** * Sets tagFilters * - * @param string[]|null $tagFilters filter hits by tags + * @param \Algolia\AlgoliaSearch\Model\Recommend\TagFilters|null $tagFilters tagFilters * * @return self */ @@ -1474,6 +1481,30 @@ public function setEnableReRanking($enableReRanking) return $this; } + /** + * Gets reRankingApplyFilter + * + * @return \Algolia\AlgoliaSearch\Model\Recommend\ReRankingApplyFilter|null + */ + public function getReRankingApplyFilter() + { + return $this->container['reRankingApplyFilter'] ?? null; + } + + /** + * Sets reRankingApplyFilter + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\ReRankingApplyFilter|null $reRankingApplyFilter reRankingApplyFilter + * + * @return self + */ + public function setReRankingApplyFilter($reRankingApplyFilter) + { + $this->container['reRankingApplyFilter'] = $reRankingApplyFilter; + + return $this; + } + /** * Gets query * diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/TagFilters.php b/clients/algoliasearch-client-php/lib/Model/Recommend/TagFilters.php new file mode 100644 index 0000000000..37cef224a2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/TagFilters.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchParams.php index 317bb33f0d..66f010d748 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchParams.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchParams.php @@ -18,10 +18,10 @@ class BaseSearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implem protected static $modelTypes = [ 'similarQuery' => 'string', 'filters' => 'string', - 'facetFilters' => 'string[]', - 'optionalFilters' => 'string[]', - 'numericFilters' => 'string[]', - 'tagFilters' => 'string[]', + 'facetFilters' => '\Algolia\AlgoliaSearch\Model\Search\FacetFilters', + 'optionalFilters' => '\Algolia\AlgoliaSearch\Model\Search\OptionalFilters', + 'numericFilters' => '\Algolia\AlgoliaSearch\Model\Search\NumericFilters', + 'tagFilters' => '\Algolia\AlgoliaSearch\Model\Search\TagFilters', 'sumOrFiltersScores' => 'bool', 'facets' => 'string[]', 'maxValuesPerFacet' => 'int', @@ -48,6 +48,7 @@ class BaseSearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implem 'percentileComputation' => 'bool', 'enableABTest' => 'bool', 'enableReRanking' => 'bool', + 'reRankingApplyFilter' => '\Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter', ]; /** @@ -88,6 +89,7 @@ class BaseSearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implem 'percentileComputation' => null, 'enableABTest' => null, 'enableReRanking' => null, + 'reRankingApplyFilter' => null, ]; /** @@ -148,6 +150,7 @@ public static function modelFormats() 'percentileComputation' => 'setPercentileComputation', 'enableABTest' => 'setEnableABTest', 'enableReRanking' => 'setEnableReRanking', + 'reRankingApplyFilter' => 'setReRankingApplyFilter', ]; /** @@ -188,6 +191,7 @@ public static function modelFormats() 'percentileComputation' => 'getPercentileComputation', 'enableABTest' => 'getEnableABTest', 'enableReRanking' => 'getEnableReRanking', + 'reRankingApplyFilter' => 'getReRankingApplyFilter', ]; /** @@ -320,6 +324,9 @@ public function __construct(array $data = null) if (isset($data['enableReRanking'])) { $this->container['enableReRanking'] = $data['enableReRanking']; } + if (isset($data['reRankingApplyFilter'])) { + $this->container['reRankingApplyFilter'] = $data['reRankingApplyFilter']; + } } /** @@ -408,7 +415,7 @@ public function setFilters($filters) /** * Gets facetFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\FacetFilters|null */ public function getFacetFilters() { @@ -418,7 +425,7 @@ public function getFacetFilters() /** * Sets facetFilters * - * @param string[]|null $facetFilters filter hits by facet value + * @param \Algolia\AlgoliaSearch\Model\Search\FacetFilters|null $facetFilters facetFilters * * @return self */ @@ -432,7 +439,7 @@ public function setFacetFilters($facetFilters) /** * Gets optionalFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\OptionalFilters|null */ public function getOptionalFilters() { @@ -442,7 +449,7 @@ public function getOptionalFilters() /** * Sets optionalFilters * - * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * @param \Algolia\AlgoliaSearch\Model\Search\OptionalFilters|null $optionalFilters optionalFilters * * @return self */ @@ -456,7 +463,7 @@ public function setOptionalFilters($optionalFilters) /** * Gets numericFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\NumericFilters|null */ public function getNumericFilters() { @@ -466,7 +473,7 @@ public function getNumericFilters() /** * Sets numericFilters * - * @param string[]|null $numericFilters filter on numeric attributes + * @param \Algolia\AlgoliaSearch\Model\Search\NumericFilters|null $numericFilters numericFilters * * @return self */ @@ -480,7 +487,7 @@ public function setNumericFilters($numericFilters) /** * Gets tagFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\TagFilters|null */ public function getTagFilters() { @@ -490,7 +497,7 @@ public function getTagFilters() /** * Sets tagFilters * - * @param string[]|null $tagFilters filter hits by tags + * @param \Algolia\AlgoliaSearch\Model\Search\TagFilters|null $tagFilters tagFilters * * @return self */ @@ -1135,6 +1142,30 @@ public function setEnableReRanking($enableReRanking) return $this; } + + /** + * Gets reRankingApplyFilter + * + * @return \Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter|null + */ + public function getReRankingApplyFilter() + { + return $this->container['reRankingApplyFilter'] ?? null; + } + + /** + * Sets reRankingApplyFilter + * + * @param \Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter|null $reRankingApplyFilter reRankingApplyFilter + * + * @return self + */ + public function setReRankingApplyFilter($reRankingApplyFilter) + { + $this->container['reRankingApplyFilter'] = $reRankingApplyFilter; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/ConsequenceParams.php b/clients/algoliasearch-client-php/lib/Model/Search/ConsequenceParams.php index 191d5ae5e2..a46a04a506 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/ConsequenceParams.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/ConsequenceParams.php @@ -21,10 +21,10 @@ class ConsequenceParams extends \Algolia\AlgoliaSearch\Model\AbstractModel imple 'automaticOptionalFacetFilters' => '\Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]', 'similarQuery' => 'string', 'filters' => 'string', - 'facetFilters' => 'string[]', - 'optionalFilters' => 'string[]', - 'numericFilters' => 'string[]', - 'tagFilters' => 'string[]', + 'facetFilters' => '\Algolia\AlgoliaSearch\Model\Search\FacetFilters', + 'optionalFilters' => '\Algolia\AlgoliaSearch\Model\Search\OptionalFilters', + 'numericFilters' => '\Algolia\AlgoliaSearch\Model\Search\NumericFilters', + 'tagFilters' => '\Algolia\AlgoliaSearch\Model\Search\TagFilters', 'sumOrFiltersScores' => 'bool', 'facets' => 'string[]', 'maxValuesPerFacet' => 'int', @@ -51,6 +51,7 @@ class ConsequenceParams extends \Algolia\AlgoliaSearch\Model\AbstractModel imple 'percentileComputation' => 'bool', 'enableABTest' => 'bool', 'enableReRanking' => 'bool', + 'reRankingApplyFilter' => '\Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter', 'searchableAttributes' => 'string[]', 'attributesForFaceting' => 'string[]', 'unretrievableAttributes' => 'string[]', @@ -138,6 +139,7 @@ class ConsequenceParams extends \Algolia\AlgoliaSearch\Model\AbstractModel imple 'percentileComputation' => null, 'enableABTest' => null, 'enableReRanking' => null, + 'reRankingApplyFilter' => null, 'searchableAttributes' => null, 'attributesForFaceting' => null, 'unretrievableAttributes' => null, @@ -245,6 +247,7 @@ public static function modelFormats() 'percentileComputation' => 'setPercentileComputation', 'enableABTest' => 'setEnableABTest', 'enableReRanking' => 'setEnableReRanking', + 'reRankingApplyFilter' => 'setReRankingApplyFilter', 'searchableAttributes' => 'setSearchableAttributes', 'attributesForFaceting' => 'setAttributesForFaceting', 'unretrievableAttributes' => 'setUnretrievableAttributes', @@ -332,6 +335,7 @@ public static function modelFormats() 'percentileComputation' => 'getPercentileComputation', 'enableABTest' => 'getEnableABTest', 'enableReRanking' => 'getEnableReRanking', + 'reRankingApplyFilter' => 'getReRankingApplyFilter', 'searchableAttributes' => 'getSearchableAttributes', 'attributesForFaceting' => 'getAttributesForFaceting', 'unretrievableAttributes' => 'getUnretrievableAttributes', @@ -517,6 +521,9 @@ public function __construct(array $data = null) if (isset($data['enableReRanking'])) { $this->container['enableReRanking'] = $data['enableReRanking']; } + if (isset($data['reRankingApplyFilter'])) { + $this->container['reRankingApplyFilter'] = $data['reRankingApplyFilter']; + } if (isset($data['searchableAttributes'])) { $this->container['searchableAttributes'] = $data['searchableAttributes']; } @@ -829,7 +836,7 @@ public function setFilters($filters) /** * Gets facetFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\FacetFilters|null */ public function getFacetFilters() { @@ -839,7 +846,7 @@ public function getFacetFilters() /** * Sets facetFilters * - * @param string[]|null $facetFilters filter hits by facet value + * @param \Algolia\AlgoliaSearch\Model\Search\FacetFilters|null $facetFilters facetFilters * * @return self */ @@ -853,7 +860,7 @@ public function setFacetFilters($facetFilters) /** * Gets optionalFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\OptionalFilters|null */ public function getOptionalFilters() { @@ -863,7 +870,7 @@ public function getOptionalFilters() /** * Sets optionalFilters * - * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * @param \Algolia\AlgoliaSearch\Model\Search\OptionalFilters|null $optionalFilters optionalFilters * * @return self */ @@ -877,7 +884,7 @@ public function setOptionalFilters($optionalFilters) /** * Gets numericFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\NumericFilters|null */ public function getNumericFilters() { @@ -887,7 +894,7 @@ public function getNumericFilters() /** * Sets numericFilters * - * @param string[]|null $numericFilters filter on numeric attributes + * @param \Algolia\AlgoliaSearch\Model\Search\NumericFilters|null $numericFilters numericFilters * * @return self */ @@ -901,7 +908,7 @@ public function setNumericFilters($numericFilters) /** * Gets tagFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\TagFilters|null */ public function getTagFilters() { @@ -911,7 +918,7 @@ public function getTagFilters() /** * Sets tagFilters * - * @param string[]|null $tagFilters filter hits by tags + * @param \Algolia\AlgoliaSearch\Model\Search\TagFilters|null $tagFilters tagFilters * * @return self */ @@ -1557,6 +1564,30 @@ public function setEnableReRanking($enableReRanking) return $this; } + /** + * Gets reRankingApplyFilter + * + * @return \Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter|null + */ + public function getReRankingApplyFilter() + { + return $this->container['reRankingApplyFilter'] ?? null; + } + + /** + * Sets reRankingApplyFilter + * + * @param \Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter|null $reRankingApplyFilter reRankingApplyFilter + * + * @return self + */ + public function setReRankingApplyFilter($reRankingApplyFilter) + { + $this->container['reRankingApplyFilter'] = $reRankingApplyFilter; + + return $this; + } + /** * Gets searchableAttributes * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/FacetFilters.php b/clients/algoliasearch-client-php/lib/Model/Search/FacetFilters.php new file mode 100644 index 0000000000..327e69bfac --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/FacetFilters.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Search/MatchedGeoLocation.php b/clients/algoliasearch-client-php/lib/Model/Search/MatchedGeoLocation.php new file mode 100644 index 0000000000..b98e99e9bf --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/MatchedGeoLocation.php @@ -0,0 +1,269 @@ + 'double', + 'lng' => 'double', + 'distance' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $modelFormats = [ + 'lat' => 'double', + 'lng' => 'double', + 'distance' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function modelTypes() + { + return self::$modelTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function modelFormats() + { + return self::$modelFormats; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'lat' => 'setLat', + 'lng' => 'setLng', + 'distance' => 'setDistance', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'lat' => 'getLat', + 'lng' => 'getLng', + 'distance' => 'getDistance', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + */ + public function __construct(array $data = null) + { + if (isset($data['lat'])) { + $this->container['lat'] = $data['lat']; + } + if (isset($data['lng'])) { + $this->container['lng'] = $data['lng']; + } + if (isset($data['distance'])) { + $this->container['distance'] = $data['distance']; + } + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets lat + * + * @return float|null + */ + public function getLat() + { + return $this->container['lat'] ?? null; + } + + /** + * Sets lat + * + * @param float|null $lat latitude of the matched location + * + * @return self + */ + public function setLat($lat) + { + $this->container['lat'] = $lat; + + return $this; + } + + /** + * Gets lng + * + * @return float|null + */ + public function getLng() + { + return $this->container['lng'] ?? null; + } + + /** + * Sets lng + * + * @param float|null $lng longitude of the matched location + * + * @return self + */ + public function setLng($lng) + { + $this->container['lng'] = $lng; + + return $this; + } + + /** + * Gets distance + * + * @return int|null + */ + public function getDistance() + { + return $this->container['distance'] ?? null; + } + + /** + * Sets distance + * + * @param int|null $distance distance between the matched location and the search location (in meters) + * + * @return self + */ + public function setDistance($distance) + { + $this->container['distance'] = $distance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Search/NumericFilters.php b/clients/algoliasearch-client-php/lib/Model/Search/NumericFilters.php new file mode 100644 index 0000000000..5813383a37 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/NumericFilters.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Search/OptionalFilters.php b/clients/algoliasearch-client-php/lib/Model/Search/OptionalFilters.php new file mode 100644 index 0000000000..6eb5acc9c7 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/OptionalFilters.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Search/Personalization.php b/clients/algoliasearch-client-php/lib/Model/Search/Personalization.php new file mode 100644 index 0000000000..fcc80d3e5d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Personalization.php @@ -0,0 +1,269 @@ + 'int', + 'rankingScore' => 'int', + 'score' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $modelFormats = [ + 'filtersScore' => null, + 'rankingScore' => null, + 'score' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function modelTypes() + { + return self::$modelTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function modelFormats() + { + return self::$modelFormats; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'filtersScore' => 'setFiltersScore', + 'rankingScore' => 'setRankingScore', + 'score' => 'setScore', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'filtersScore' => 'getFiltersScore', + 'rankingScore' => 'getRankingScore', + 'score' => 'getScore', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + */ + public function __construct(array $data = null) + { + if (isset($data['filtersScore'])) { + $this->container['filtersScore'] = $data['filtersScore']; + } + if (isset($data['rankingScore'])) { + $this->container['rankingScore'] = $data['rankingScore']; + } + if (isset($data['score'])) { + $this->container['score'] = $data['score']; + } + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets filtersScore + * + * @return int|null + */ + public function getFiltersScore() + { + return $this->container['filtersScore'] ?? null; + } + + /** + * Sets filtersScore + * + * @param int|null $filtersScore the score of the filters + * + * @return self + */ + public function setFiltersScore($filtersScore) + { + $this->container['filtersScore'] = $filtersScore; + + return $this; + } + + /** + * Gets rankingScore + * + * @return int|null + */ + public function getRankingScore() + { + return $this->container['rankingScore'] ?? null; + } + + /** + * Sets rankingScore + * + * @param int|null $rankingScore the score of the ranking + * + * @return self + */ + public function setRankingScore($rankingScore) + { + $this->container['rankingScore'] = $rankingScore; + + return $this; + } + + /** + * Gets score + * + * @return int|null + */ + public function getScore() + { + return $this->container['score'] ?? null; + } + + /** + * Sets score + * + * @param int|null $score the score of the event + * + * @return self + */ + public function setScore($score) + { + $this->container['score'] = $score; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Search/RankingInfo.php b/clients/algoliasearch-client-php/lib/Model/Search/RankingInfo.php index 80425fdc92..cdb116c11c 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/RankingInfo.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/RankingInfo.php @@ -20,13 +20,15 @@ class RankingInfo extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'firstMatchedWord' => 'int', 'geoDistance' => 'int', 'geoPrecision' => 'int', - 'matchedGeoLocation' => 'array', + 'matchedGeoLocation' => '\Algolia\AlgoliaSearch\Model\Search\MatchedGeoLocation', + 'personalization' => '\Algolia\AlgoliaSearch\Model\Search\Personalization', 'nbExactWords' => 'int', 'nbTypos' => 'int', 'promoted' => 'bool', 'proximityDistance' => 'int', 'userScore' => 'int', - 'word' => 'int', + 'words' => 'int', + 'promotedByReRanking' => 'bool', ]; /** @@ -40,12 +42,14 @@ class RankingInfo extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'geoDistance' => null, 'geoPrecision' => null, 'matchedGeoLocation' => null, + 'personalization' => null, 'nbExactWords' => null, 'nbTypos' => null, 'promoted' => null, 'proximityDistance' => null, 'userScore' => null, - 'word' => null, + 'words' => null, + 'promotedByReRanking' => null, ]; /** @@ -79,12 +83,14 @@ public static function modelFormats() 'geoDistance' => 'setGeoDistance', 'geoPrecision' => 'setGeoPrecision', 'matchedGeoLocation' => 'setMatchedGeoLocation', + 'personalization' => 'setPersonalization', 'nbExactWords' => 'setNbExactWords', 'nbTypos' => 'setNbTypos', 'promoted' => 'setPromoted', 'proximityDistance' => 'setProximityDistance', 'userScore' => 'setUserScore', - 'word' => 'setWord', + 'words' => 'setWords', + 'promotedByReRanking' => 'setPromotedByReRanking', ]; /** @@ -98,12 +104,14 @@ public static function modelFormats() 'geoDistance' => 'getGeoDistance', 'geoPrecision' => 'getGeoPrecision', 'matchedGeoLocation' => 'getMatchedGeoLocation', + 'personalization' => 'getPersonalization', 'nbExactWords' => 'getNbExactWords', 'nbTypos' => 'getNbTypos', 'promoted' => 'getPromoted', 'proximityDistance' => 'getProximityDistance', 'userScore' => 'getUserScore', - 'word' => 'getWord', + 'words' => 'getWords', + 'promotedByReRanking' => 'getPromotedByReRanking', ]; /** @@ -155,6 +163,9 @@ public function __construct(array $data = null) if (isset($data['matchedGeoLocation'])) { $this->container['matchedGeoLocation'] = $data['matchedGeoLocation']; } + if (isset($data['personalization'])) { + $this->container['personalization'] = $data['personalization']; + } if (isset($data['nbExactWords'])) { $this->container['nbExactWords'] = $data['nbExactWords']; } @@ -170,8 +181,11 @@ public function __construct(array $data = null) if (isset($data['userScore'])) { $this->container['userScore'] = $data['userScore']; } - if (isset($data['word'])) { - $this->container['word'] = $data['word']; + if (isset($data['words'])) { + $this->container['words'] = $data['words']; + } + if (isset($data['promotedByReRanking'])) { + $this->container['promotedByReRanking'] = $data['promotedByReRanking']; } } @@ -184,6 +198,31 @@ public function listInvalidProperties() { $invalidProperties = []; + if (!isset($this->container['filters']) || $this->container['filters'] === null) { + $invalidProperties[] = "'filters' can't be null"; + } + if (!isset($this->container['firstMatchedWord']) || $this->container['firstMatchedWord'] === null) { + $invalidProperties[] = "'firstMatchedWord' can't be null"; + } + if (!isset($this->container['geoDistance']) || $this->container['geoDistance'] === null) { + $invalidProperties[] = "'geoDistance' can't be null"; + } + if (!isset($this->container['nbExactWords']) || $this->container['nbExactWords'] === null) { + $invalidProperties[] = "'nbExactWords' can't be null"; + } + if (!isset($this->container['nbTypos']) || $this->container['nbTypos'] === null) { + $invalidProperties[] = "'nbTypos' can't be null"; + } + if (!isset($this->container['promoted']) || $this->container['promoted'] === null) { + $invalidProperties[] = "'promoted' can't be null"; + } + if (!isset($this->container['userScore']) || $this->container['userScore'] === null) { + $invalidProperties[] = "'userScore' can't be null"; + } + if (!isset($this->container['words']) || $this->container['words'] === null) { + $invalidProperties[] = "'words' can't be null"; + } + return $invalidProperties; } @@ -201,7 +240,7 @@ public function valid() /** * Gets filters * - * @return int|null + * @return int */ public function getFilters() { @@ -211,7 +250,7 @@ public function getFilters() /** * Sets filters * - * @param int|null $filters this field is reserved for advanced usage + * @param int $filters this field is reserved for advanced usage * * @return self */ @@ -225,7 +264,7 @@ public function setFilters($filters) /** * Gets firstMatchedWord * - * @return int|null + * @return int */ public function getFirstMatchedWord() { @@ -235,7 +274,7 @@ public function getFirstMatchedWord() /** * Sets firstMatchedWord * - * @param int|null $firstMatchedWord position of the most important matched attribute in the attributes to index list + * @param int $firstMatchedWord position of the most important matched attribute in the attributes to index list * * @return self */ @@ -249,7 +288,7 @@ public function setFirstMatchedWord($firstMatchedWord) /** * Gets geoDistance * - * @return int|null + * @return int */ public function getGeoDistance() { @@ -259,7 +298,7 @@ public function getGeoDistance() /** * Sets geoDistance * - * @param int|null $geoDistance distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters) + * @param int $geoDistance distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters) * * @return self */ @@ -297,7 +336,7 @@ public function setGeoPrecision($geoPrecision) /** * Gets matchedGeoLocation * - * @return array|null + * @return \Algolia\AlgoliaSearch\Model\Search\MatchedGeoLocation|null */ public function getMatchedGeoLocation() { @@ -307,7 +346,7 @@ public function getMatchedGeoLocation() /** * Sets matchedGeoLocation * - * @param array|null $matchedGeoLocation matchedGeoLocation + * @param \Algolia\AlgoliaSearch\Model\Search\MatchedGeoLocation|null $matchedGeoLocation matchedGeoLocation * * @return self */ @@ -318,10 +357,34 @@ public function setMatchedGeoLocation($matchedGeoLocation) return $this; } + /** + * Gets personalization + * + * @return \Algolia\AlgoliaSearch\Model\Search\Personalization|null + */ + public function getPersonalization() + { + return $this->container['personalization'] ?? null; + } + + /** + * Sets personalization + * + * @param \Algolia\AlgoliaSearch\Model\Search\Personalization|null $personalization personalization + * + * @return self + */ + public function setPersonalization($personalization) + { + $this->container['personalization'] = $personalization; + + return $this; + } + /** * Gets nbExactWords * - * @return int|null + * @return int */ public function getNbExactWords() { @@ -331,7 +394,7 @@ public function getNbExactWords() /** * Sets nbExactWords * - * @param int|null $nbExactWords number of exactly matched words + * @param int $nbExactWords number of exactly matched words * * @return self */ @@ -345,7 +408,7 @@ public function setNbExactWords($nbExactWords) /** * Gets nbTypos * - * @return int|null + * @return int */ public function getNbTypos() { @@ -355,7 +418,7 @@ public function getNbTypos() /** * Sets nbTypos * - * @param int|null $nbTypos number of typos encountered when matching the record + * @param int $nbTypos number of typos encountered when matching the record * * @return self */ @@ -369,7 +432,7 @@ public function setNbTypos($nbTypos) /** * Gets promoted * - * @return bool|null + * @return bool */ public function getPromoted() { @@ -379,7 +442,7 @@ public function getPromoted() /** * Sets promoted * - * @param bool|null $promoted present and set to true if a Rule promoted the hit + * @param bool $promoted present and set to true if a Rule promoted the hit * * @return self */ @@ -417,7 +480,7 @@ public function setProximityDistance($proximityDistance) /** * Gets userScore * - * @return int|null + * @return int */ public function getUserScore() { @@ -427,7 +490,7 @@ public function getUserScore() /** * Sets userScore * - * @param int|null $userScore custom ranking for the object, expressed as a single integer value + * @param int $userScore custom ranking for the object, expressed as a single integer value * * @return self */ @@ -439,25 +502,49 @@ public function setUserScore($userScore) } /** - * Gets word + * Gets words * - * @return int|null + * @return int + */ + public function getWords() + { + return $this->container['words'] ?? null; + } + + /** + * Sets words + * + * @param int $words number of matched words, including prefixes and typos + * + * @return self + */ + public function setWords($words) + { + $this->container['words'] = $words; + + return $this; + } + + /** + * Gets promotedByReRanking + * + * @return bool|null */ - public function getWord() + public function getPromotedByReRanking() { - return $this->container['word'] ?? null; + return $this->container['promotedByReRanking'] ?? null; } /** - * Sets word + * Sets promotedByReRanking * - * @param int|null $word number of matched words, including prefixes and typos + * @param bool|null $promotedByReRanking wether the record are promoted by the re-ranking strategy * * @return self */ - public function setWord($word) + public function setPromotedByReRanking($promotedByReRanking) { - $this->container['word'] = $word; + $this->container['promotedByReRanking'] = $promotedByReRanking; return $this; } diff --git a/clients/algoliasearch-client-php/lib/Model/Search/ReRankingApplyFilter.php b/clients/algoliasearch-client-php/lib/Model/Search/ReRankingApplyFilter.php new file mode 100644 index 0000000000..fcf17d285d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ReRankingApplyFilter.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Search/SearchParams.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchParams.php index f38cb29430..a2d416cae0 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/SearchParams.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchParams.php @@ -19,10 +19,10 @@ class SearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'params' => 'string', 'similarQuery' => 'string', 'filters' => 'string', - 'facetFilters' => 'string[]', - 'optionalFilters' => 'string[]', - 'numericFilters' => 'string[]', - 'tagFilters' => 'string[]', + 'facetFilters' => '\Algolia\AlgoliaSearch\Model\Search\FacetFilters', + 'optionalFilters' => '\Algolia\AlgoliaSearch\Model\Search\OptionalFilters', + 'numericFilters' => '\Algolia\AlgoliaSearch\Model\Search\NumericFilters', + 'tagFilters' => '\Algolia\AlgoliaSearch\Model\Search\TagFilters', 'sumOrFiltersScores' => 'bool', 'facets' => 'string[]', 'maxValuesPerFacet' => 'int', @@ -49,6 +49,7 @@ class SearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'percentileComputation' => 'bool', 'enableABTest' => 'bool', 'enableReRanking' => 'bool', + 'reRankingApplyFilter' => '\Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter', 'query' => 'string', 'searchableAttributes' => 'string[]', 'attributesForFaceting' => 'string[]', @@ -135,6 +136,7 @@ class SearchParams extends \Algolia\AlgoliaSearch\Model\AbstractModel implements 'percentileComputation' => null, 'enableABTest' => null, 'enableReRanking' => null, + 'reRankingApplyFilter' => null, 'query' => null, 'searchableAttributes' => null, 'attributesForFaceting' => null, @@ -241,6 +243,7 @@ public static function modelFormats() 'percentileComputation' => 'setPercentileComputation', 'enableABTest' => 'setEnableABTest', 'enableReRanking' => 'setEnableReRanking', + 'reRankingApplyFilter' => 'setReRankingApplyFilter', 'query' => 'setQuery', 'searchableAttributes' => 'setSearchableAttributes', 'attributesForFaceting' => 'setAttributesForFaceting', @@ -327,6 +330,7 @@ public static function modelFormats() 'percentileComputation' => 'getPercentileComputation', 'enableABTest' => 'getEnableABTest', 'enableReRanking' => 'getEnableReRanking', + 'reRankingApplyFilter' => 'getReRankingApplyFilter', 'query' => 'getQuery', 'searchableAttributes' => 'getSearchableAttributes', 'attributesForFaceting' => 'getAttributesForFaceting', @@ -507,6 +511,9 @@ public function __construct(array $data = null) if (isset($data['enableReRanking'])) { $this->container['enableReRanking'] = $data['enableReRanking']; } + if (isset($data['reRankingApplyFilter'])) { + $this->container['reRankingApplyFilter'] = $data['reRankingApplyFilter']; + } if (isset($data['query'])) { $this->container['query'] = $data['query']; } @@ -777,7 +784,7 @@ public function setFilters($filters) /** * Gets facetFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\FacetFilters|null */ public function getFacetFilters() { @@ -787,7 +794,7 @@ public function getFacetFilters() /** * Sets facetFilters * - * @param string[]|null $facetFilters filter hits by facet value + * @param \Algolia\AlgoliaSearch\Model\Search\FacetFilters|null $facetFilters facetFilters * * @return self */ @@ -801,7 +808,7 @@ public function setFacetFilters($facetFilters) /** * Gets optionalFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\OptionalFilters|null */ public function getOptionalFilters() { @@ -811,7 +818,7 @@ public function getOptionalFilters() /** * Sets optionalFilters * - * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * @param \Algolia\AlgoliaSearch\Model\Search\OptionalFilters|null $optionalFilters optionalFilters * * @return self */ @@ -825,7 +832,7 @@ public function setOptionalFilters($optionalFilters) /** * Gets numericFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\NumericFilters|null */ public function getNumericFilters() { @@ -835,7 +842,7 @@ public function getNumericFilters() /** * Sets numericFilters * - * @param string[]|null $numericFilters filter on numeric attributes + * @param \Algolia\AlgoliaSearch\Model\Search\NumericFilters|null $numericFilters numericFilters * * @return self */ @@ -849,7 +856,7 @@ public function setNumericFilters($numericFilters) /** * Gets tagFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\TagFilters|null */ public function getTagFilters() { @@ -859,7 +866,7 @@ public function getTagFilters() /** * Sets tagFilters * - * @param string[]|null $tagFilters filter hits by tags + * @param \Algolia\AlgoliaSearch\Model\Search\TagFilters|null $tagFilters tagFilters * * @return self */ @@ -1505,6 +1512,30 @@ public function setEnableReRanking($enableReRanking) return $this; } + /** + * Gets reRankingApplyFilter + * + * @return \Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter|null + */ + public function getReRankingApplyFilter() + { + return $this->container['reRankingApplyFilter'] ?? null; + } + + /** + * Sets reRankingApplyFilter + * + * @param \Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter|null $reRankingApplyFilter reRankingApplyFilter + * + * @return self + */ + public function setReRankingApplyFilter($reRankingApplyFilter) + { + $this->container['reRankingApplyFilter'] = $reRankingApplyFilter; + + return $this; + } + /** * Gets query * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/SearchParamsObject.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchParamsObject.php index d8c8afe4d0..a533439d75 100644 --- a/clients/algoliasearch-client-php/lib/Model/Search/SearchParamsObject.php +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchParamsObject.php @@ -18,10 +18,10 @@ class SearchParamsObject extends \Algolia\AlgoliaSearch\Model\AbstractModel impl protected static $modelTypes = [ 'similarQuery' => 'string', 'filters' => 'string', - 'facetFilters' => 'string[]', - 'optionalFilters' => 'string[]', - 'numericFilters' => 'string[]', - 'tagFilters' => 'string[]', + 'facetFilters' => '\Algolia\AlgoliaSearch\Model\Search\FacetFilters', + 'optionalFilters' => '\Algolia\AlgoliaSearch\Model\Search\OptionalFilters', + 'numericFilters' => '\Algolia\AlgoliaSearch\Model\Search\NumericFilters', + 'tagFilters' => '\Algolia\AlgoliaSearch\Model\Search\TagFilters', 'sumOrFiltersScores' => 'bool', 'facets' => 'string[]', 'maxValuesPerFacet' => 'int', @@ -48,6 +48,7 @@ class SearchParamsObject extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'percentileComputation' => 'bool', 'enableABTest' => 'bool', 'enableReRanking' => 'bool', + 'reRankingApplyFilter' => '\Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter', 'query' => 'string', 'searchableAttributes' => 'string[]', 'attributesForFaceting' => 'string[]', @@ -133,6 +134,7 @@ class SearchParamsObject extends \Algolia\AlgoliaSearch\Model\AbstractModel impl 'percentileComputation' => null, 'enableABTest' => null, 'enableReRanking' => null, + 'reRankingApplyFilter' => null, 'query' => null, 'searchableAttributes' => null, 'attributesForFaceting' => null, @@ -238,6 +240,7 @@ public static function modelFormats() 'percentileComputation' => 'setPercentileComputation', 'enableABTest' => 'setEnableABTest', 'enableReRanking' => 'setEnableReRanking', + 'reRankingApplyFilter' => 'setReRankingApplyFilter', 'query' => 'setQuery', 'searchableAttributes' => 'setSearchableAttributes', 'attributesForFaceting' => 'setAttributesForFaceting', @@ -323,6 +326,7 @@ public static function modelFormats() 'percentileComputation' => 'getPercentileComputation', 'enableABTest' => 'getEnableABTest', 'enableReRanking' => 'getEnableReRanking', + 'reRankingApplyFilter' => 'getReRankingApplyFilter', 'query' => 'getQuery', 'searchableAttributes' => 'getSearchableAttributes', 'attributesForFaceting' => 'getAttributesForFaceting', @@ -500,6 +504,9 @@ public function __construct(array $data = null) if (isset($data['enableReRanking'])) { $this->container['enableReRanking'] = $data['enableReRanking']; } + if (isset($data['reRankingApplyFilter'])) { + $this->container['reRankingApplyFilter'] = $data['reRankingApplyFilter']; + } if (isset($data['query'])) { $this->container['query'] = $data['query']; } @@ -746,7 +753,7 @@ public function setFilters($filters) /** * Gets facetFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\FacetFilters|null */ public function getFacetFilters() { @@ -756,7 +763,7 @@ public function getFacetFilters() /** * Sets facetFilters * - * @param string[]|null $facetFilters filter hits by facet value + * @param \Algolia\AlgoliaSearch\Model\Search\FacetFilters|null $facetFilters facetFilters * * @return self */ @@ -770,7 +777,7 @@ public function setFacetFilters($facetFilters) /** * Gets optionalFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\OptionalFilters|null */ public function getOptionalFilters() { @@ -780,7 +787,7 @@ public function getOptionalFilters() /** * Sets optionalFilters * - * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * @param \Algolia\AlgoliaSearch\Model\Search\OptionalFilters|null $optionalFilters optionalFilters * * @return self */ @@ -794,7 +801,7 @@ public function setOptionalFilters($optionalFilters) /** * Gets numericFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\NumericFilters|null */ public function getNumericFilters() { @@ -804,7 +811,7 @@ public function getNumericFilters() /** * Sets numericFilters * - * @param string[]|null $numericFilters filter on numeric attributes + * @param \Algolia\AlgoliaSearch\Model\Search\NumericFilters|null $numericFilters numericFilters * * @return self */ @@ -818,7 +825,7 @@ public function setNumericFilters($numericFilters) /** * Gets tagFilters * - * @return string[]|null + * @return \Algolia\AlgoliaSearch\Model\Search\TagFilters|null */ public function getTagFilters() { @@ -828,7 +835,7 @@ public function getTagFilters() /** * Sets tagFilters * - * @param string[]|null $tagFilters filter hits by tags + * @param \Algolia\AlgoliaSearch\Model\Search\TagFilters|null $tagFilters tagFilters * * @return self */ @@ -1474,6 +1481,30 @@ public function setEnableReRanking($enableReRanking) return $this; } + /** + * Gets reRankingApplyFilter + * + * @return \Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter|null + */ + public function getReRankingApplyFilter() + { + return $this->container['reRankingApplyFilter'] ?? null; + } + + /** + * Sets reRankingApplyFilter + * + * @param \Algolia\AlgoliaSearch\Model\Search\ReRankingApplyFilter|null $reRankingApplyFilter reRankingApplyFilter + * + * @return self + */ + public function setReRankingApplyFilter($reRankingApplyFilter) + { + $this->container['reRankingApplyFilter'] = $reRankingApplyFilter; + + return $this; + } + /** * Gets query * diff --git a/clients/algoliasearch-client-php/lib/Model/Search/TagFilters.php b/clients/algoliasearch-client-php/lib/Model/Search/TagFilters.php new file mode 100644 index 0000000000..5c6205a356 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/TagFilters.php @@ -0,0 +1,183 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } +} + diff --git a/specs/bundled/algoliasearch-lite.yml b/specs/bundled/algoliasearch-lite.yml index 2bc7d5b12d..6c8a991189 100644 --- a/specs/bundled/algoliasearch-lite.yml +++ b/specs/bundled/algoliasearch-lite.yml @@ -162,6 +162,38 @@ components: properties: params: $ref: '#/components/schemas/paramsAsString' + searchFiltersArrayString: + type: array + items: + type: string + searchFiltersNestedArrayString: + type: array + items: + type: array + items: + type: string + facetFilters: + description: Filter hits by facet value. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + optionalFilters: + description: >- + Create filters for ranking purposes, where records that match the filter + are ranked higher, or lower in the case of a negative optional filter. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + numericFilters: + description: Filter on numeric attributes. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + tagFilters: + description: Filter hits by tags. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' page: type: integer description: Specify the page to retrieve. @@ -176,6 +208,13 @@ components: - type: integer minimum: 1 - $ref: '#/components/schemas/aroundRadiusAll' + reRankingApplyFilter: + description: >- + When Dynamic Re-Ranking is enabled, only records that match these + filters will be impacted by Dynamic Re-Ranking. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' baseSearchParams: type: object additionalProperties: false @@ -191,32 +230,13 @@ components: description: Filter the query with numeric, facet and/or tag filters. default: '' facetFilters: - type: array - items: - type: string - description: Filter hits by facet value. - default: [] + $ref: '#/components/schemas/facetFilters' optionalFilters: - type: array - items: - type: string - description: >- - Create filters for ranking purposes, where records that match the - filter are ranked higher, or lower in the case of a negative - optional filter. - default: [] + $ref: '#/components/schemas/optionalFilters' numericFilters: - type: array - items: - type: string - description: Filter on numeric attributes. - default: [] + $ref: '#/components/schemas/numericFilters' tagFilters: - type: array - items: - type: string - description: Filter hits by tags. - default: [] + $ref: '#/components/schemas/tagFilters' sumOrFiltersScores: type: boolean description: Determines how to calculate the total score for filtering. @@ -349,6 +369,8 @@ components: type: boolean description: Whether this search should use AI Re-Ranking. default: true + reRankingApplyFilter: + $ref: '#/components/schemas/reRankingApplyFilter' query: type: string description: The text to search in the index. @@ -873,6 +895,34 @@ components: $ref: '#/components/schemas/highlightedValue' matchLevel: $ref: '#/components/schemas/matchLevel' + matchedGeoLocation: + type: object + properties: + lat: + type: number + format: double + description: Latitude of the matched location. + lng: + type: number + format: double + description: Longitude of the matched location. + distance: + type: integer + description: >- + Distance between the matched location and the search location (in + meters). + personalization: + type: object + properties: + filtersScore: + type: integer + description: The score of the filters. + rankingScore: + type: integer + description: The score of the ranking. + score: + type: integer + description: The score of the event. rankingInfo: type: object additionalProperties: false @@ -895,24 +945,9 @@ components: type: integer description: Precision used when computing the geo distance, in meters. matchedGeoLocation: - type: object - additionalProperties: - type: object - additionalProperties: false - properties: - lat: - type: number - format: double - description: Latitude of the matched location. - lng: - type: number - format: double - description: Longitude of the matched location. - distance: - type: integer - description: >- - Distance between the matched location and the search location - (in meters). + $ref: '#/components/schemas/matchedGeoLocation' + personalization: + $ref: '#/components/schemas/personalization' nbExactWords: type: integer description: Number of exactly matched words. @@ -930,9 +965,21 @@ components: userScore: type: integer description: Custom ranking for the object, expressed as a single integer value. - word: + words: type: integer description: Number of matched words, including prefixes and typos. + promotedByReRanking: + type: boolean + description: Wether the record are promoted by the re-ranking strategy. + required: + - promoted + - nbTypos + - firstMatchedWord + - geoDistance + - nbExactWords + - words + - filters + - userScore _distinctSeqID: type: integer hit: diff --git a/specs/bundled/recommend.yml b/specs/bundled/recommend.yml index 5af60a370c..52c74e8a8e 100644 --- a/specs/bundled/recommend.yml +++ b/specs/bundled/recommend.yml @@ -50,6 +50,38 @@ components: type: string example: products description: The Algolia index name. + searchFiltersArrayString: + type: array + items: + type: string + searchFiltersNestedArrayString: + type: array + items: + type: array + items: + type: string + facetFilters: + description: Filter hits by facet value. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + optionalFilters: + description: >- + Create filters for ranking purposes, where records that match the filter + are ranked higher, or lower in the case of a negative optional filter. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + numericFilters: + description: Filter on numeric attributes. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + tagFilters: + description: Filter hits by tags. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' page: type: integer description: Specify the page to retrieve. @@ -64,6 +96,13 @@ components: - type: integer minimum: 1 - $ref: '#/components/schemas/aroundRadiusAll' + reRankingApplyFilter: + description: >- + When Dynamic Re-Ranking is enabled, only records that match these + filters will be impacted by Dynamic Re-Ranking. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' baseSearchParams: type: object additionalProperties: false @@ -79,32 +118,13 @@ components: description: Filter the query with numeric, facet and/or tag filters. default: '' facetFilters: - type: array - items: - type: string - description: Filter hits by facet value. - default: [] + $ref: '#/components/schemas/facetFilters' optionalFilters: - type: array - items: - type: string - description: >- - Create filters for ranking purposes, where records that match the - filter are ranked higher, or lower in the case of a negative - optional filter. - default: [] + $ref: '#/components/schemas/optionalFilters' numericFilters: - type: array - items: - type: string - description: Filter on numeric attributes. - default: [] + $ref: '#/components/schemas/numericFilters' tagFilters: - type: array - items: - type: string - description: Filter hits by tags. - default: [] + $ref: '#/components/schemas/tagFilters' sumOrFiltersScores: type: boolean description: Determines how to calculate the total score for filtering. @@ -237,6 +257,8 @@ components: type: boolean description: Whether this search should use AI Re-Ranking. default: true + reRankingApplyFilter: + $ref: '#/components/schemas/reRankingApplyFilter' query: type: string description: The text to search in the index. @@ -822,6 +844,34 @@ components: $ref: '#/components/schemas/highlightedValue' matchLevel: $ref: '#/components/schemas/matchLevel' + matchedGeoLocation: + type: object + properties: + lat: + type: number + format: double + description: Latitude of the matched location. + lng: + type: number + format: double + description: Longitude of the matched location. + distance: + type: integer + description: >- + Distance between the matched location and the search location (in + meters). + personalization: + type: object + properties: + filtersScore: + type: integer + description: The score of the filters. + rankingScore: + type: integer + description: The score of the ranking. + score: + type: integer + description: The score of the event. rankingInfo: type: object additionalProperties: false @@ -844,24 +894,9 @@ components: type: integer description: Precision used when computing the geo distance, in meters. matchedGeoLocation: - type: object - additionalProperties: - type: object - additionalProperties: false - properties: - lat: - type: number - format: double - description: Latitude of the matched location. - lng: - type: number - format: double - description: Longitude of the matched location. - distance: - type: integer - description: >- - Distance between the matched location and the search location - (in meters). + $ref: '#/components/schemas/matchedGeoLocation' + personalization: + $ref: '#/components/schemas/personalization' nbExactWords: type: integer description: Number of exactly matched words. @@ -879,9 +914,21 @@ components: userScore: type: integer description: Custom ranking for the object, expressed as a single integer value. - word: + words: type: integer description: Number of matched words, including prefixes and typos. + promotedByReRanking: + type: boolean + description: Wether the record are promoted by the re-ranking strategy. + required: + - promoted + - nbTypos + - firstMatchedWord + - geoDistance + - nbExactWords + - words + - filters + - userScore _distinctSeqID: type: integer recommendHit: diff --git a/specs/bundled/search.yml b/specs/bundled/search.yml index f7a867e68f..46354fa508 100644 --- a/specs/bundled/search.yml +++ b/specs/bundled/search.yml @@ -162,6 +162,38 @@ components: properties: params: $ref: '#/components/schemas/paramsAsString' + searchFiltersArrayString: + type: array + items: + type: string + searchFiltersNestedArrayString: + type: array + items: + type: array + items: + type: string + facetFilters: + description: Filter hits by facet value. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + optionalFilters: + description: >- + Create filters for ranking purposes, where records that match the filter + are ranked higher, or lower in the case of a negative optional filter. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + numericFilters: + description: Filter on numeric attributes. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' + tagFilters: + description: Filter hits by tags. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' page: type: integer description: Specify the page to retrieve. @@ -176,6 +208,13 @@ components: - type: integer minimum: 1 - $ref: '#/components/schemas/aroundRadiusAll' + reRankingApplyFilter: + description: >- + When Dynamic Re-Ranking is enabled, only records that match these + filters will be impacted by Dynamic Re-Ranking. + oneOf: + - $ref: '#/components/schemas/searchFiltersArrayString' + - $ref: '#/components/schemas/searchFiltersNestedArrayString' baseSearchParams: type: object additionalProperties: false @@ -191,32 +230,13 @@ components: description: Filter the query with numeric, facet and/or tag filters. default: '' facetFilters: - type: array - items: - type: string - description: Filter hits by facet value. - default: [] + $ref: '#/components/schemas/facetFilters' optionalFilters: - type: array - items: - type: string - description: >- - Create filters for ranking purposes, where records that match the - filter are ranked higher, or lower in the case of a negative - optional filter. - default: [] + $ref: '#/components/schemas/optionalFilters' numericFilters: - type: array - items: - type: string - description: Filter on numeric attributes. - default: [] + $ref: '#/components/schemas/numericFilters' tagFilters: - type: array - items: - type: string - description: Filter hits by tags. - default: [] + $ref: '#/components/schemas/tagFilters' sumOrFiltersScores: type: boolean description: Determines how to calculate the total score for filtering. @@ -349,6 +369,8 @@ components: type: boolean description: Whether this search should use AI Re-Ranking. default: true + reRankingApplyFilter: + $ref: '#/components/schemas/reRankingApplyFilter' query: type: string description: The text to search in the index. @@ -873,6 +895,34 @@ components: $ref: '#/components/schemas/highlightedValue' matchLevel: $ref: '#/components/schemas/matchLevel' + matchedGeoLocation: + type: object + properties: + lat: + type: number + format: double + description: Latitude of the matched location. + lng: + type: number + format: double + description: Longitude of the matched location. + distance: + type: integer + description: >- + Distance between the matched location and the search location (in + meters). + personalization: + type: object + properties: + filtersScore: + type: integer + description: The score of the filters. + rankingScore: + type: integer + description: The score of the ranking. + score: + type: integer + description: The score of the event. rankingInfo: type: object additionalProperties: false @@ -895,24 +945,9 @@ components: type: integer description: Precision used when computing the geo distance, in meters. matchedGeoLocation: - type: object - additionalProperties: - type: object - additionalProperties: false - properties: - lat: - type: number - format: double - description: Latitude of the matched location. - lng: - type: number - format: double - description: Longitude of the matched location. - distance: - type: integer - description: >- - Distance between the matched location and the search location - (in meters). + $ref: '#/components/schemas/matchedGeoLocation' + personalization: + $ref: '#/components/schemas/personalization' nbExactWords: type: integer description: Number of exactly matched words. @@ -930,9 +965,21 @@ components: userScore: type: integer description: Custom ranking for the object, expressed as a single integer value. - word: + words: type: integer description: Number of matched words, including prefixes and typos. + promotedByReRanking: + type: boolean + description: Wether the record are promoted by the re-ranking strategy. + required: + - promoted + - nbTypos + - firstMatchedWord + - geoDistance + - nbExactWords + - words + - filters + - userScore _distinctSeqID: type: integer hit: