|
| 1 | +package com.algolia.model.search; |
| 2 | + |
| 3 | +import com.google.gson.annotations.SerializedName; |
| 4 | +import java.util.Objects; |
| 5 | + |
| 6 | +/** SearchForFacetsOptions */ |
| 7 | +public class SearchForFacetsOptions { |
| 8 | + |
| 9 | + @SerializedName("facet") |
| 10 | + private String facet; |
| 11 | + |
| 12 | + @SerializedName("indexName") |
| 13 | + private String indexName; |
| 14 | + |
| 15 | + @SerializedName("facetQuery") |
| 16 | + private String facetQuery = ""; |
| 17 | + |
| 18 | + @SerializedName("maxFacetHits") |
| 19 | + private Integer maxFacetHits = 10; |
| 20 | + |
| 21 | + @SerializedName("type") |
| 22 | + private SearchTypeFacet type = SearchTypeFacet.FACET; |
| 23 | + |
| 24 | + public SearchForFacetsOptions setFacet(String facet) { |
| 25 | + this.facet = facet; |
| 26 | + return this; |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * The `facet` name. |
| 31 | + * |
| 32 | + * @return facet |
| 33 | + */ |
| 34 | + @javax.annotation.Nonnull |
| 35 | + public String getFacet() { |
| 36 | + return facet; |
| 37 | + } |
| 38 | + |
| 39 | + public SearchForFacetsOptions setIndexName(String indexName) { |
| 40 | + this.indexName = indexName; |
| 41 | + return this; |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * The Algolia index name. |
| 46 | + * |
| 47 | + * @return indexName |
| 48 | + */ |
| 49 | + @javax.annotation.Nonnull |
| 50 | + public String getIndexName() { |
| 51 | + return indexName; |
| 52 | + } |
| 53 | + |
| 54 | + public SearchForFacetsOptions setFacetQuery(String facetQuery) { |
| 55 | + this.facetQuery = facetQuery; |
| 56 | + return this; |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Text to search inside the facet's values. |
| 61 | + * |
| 62 | + * @return facetQuery |
| 63 | + */ |
| 64 | + @javax.annotation.Nullable |
| 65 | + public String getFacetQuery() { |
| 66 | + return facetQuery; |
| 67 | + } |
| 68 | + |
| 69 | + public SearchForFacetsOptions setMaxFacetHits(Integer maxFacetHits) { |
| 70 | + this.maxFacetHits = maxFacetHits; |
| 71 | + return this; |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * Maximum number of facet hits to return during a search for facet values. For performance |
| 76 | + * reasons, the maximum allowed number of returned values is 100. maximum: 100 |
| 77 | + * |
| 78 | + * @return maxFacetHits |
| 79 | + */ |
| 80 | + @javax.annotation.Nullable |
| 81 | + public Integer getMaxFacetHits() { |
| 82 | + return maxFacetHits; |
| 83 | + } |
| 84 | + |
| 85 | + public SearchForFacetsOptions setType(SearchTypeFacet type) { |
| 86 | + this.type = type; |
| 87 | + return this; |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * Get type |
| 92 | + * |
| 93 | + * @return type |
| 94 | + */ |
| 95 | + @javax.annotation.Nonnull |
| 96 | + public SearchTypeFacet getType() { |
| 97 | + return type; |
| 98 | + } |
| 99 | + |
| 100 | + @Override |
| 101 | + public boolean equals(Object o) { |
| 102 | + if (this == o) { |
| 103 | + return true; |
| 104 | + } |
| 105 | + if (o == null || getClass() != o.getClass()) { |
| 106 | + return false; |
| 107 | + } |
| 108 | + SearchForFacetsOptions searchForFacetsOptions = (SearchForFacetsOptions) o; |
| 109 | + return ( |
| 110 | + Objects.equals(this.facet, searchForFacetsOptions.facet) && |
| 111 | + Objects.equals(this.indexName, searchForFacetsOptions.indexName) && |
| 112 | + Objects.equals(this.facetQuery, searchForFacetsOptions.facetQuery) && |
| 113 | + Objects.equals(this.maxFacetHits, searchForFacetsOptions.maxFacetHits) && |
| 114 | + Objects.equals(this.type, searchForFacetsOptions.type) |
| 115 | + ); |
| 116 | + } |
| 117 | + |
| 118 | + @Override |
| 119 | + public int hashCode() { |
| 120 | + return Objects.hash(facet, indexName, facetQuery, maxFacetHits, type); |
| 121 | + } |
| 122 | + |
| 123 | + @Override |
| 124 | + public String toString() { |
| 125 | + StringBuilder sb = new StringBuilder(); |
| 126 | + sb.append("class SearchForFacetsOptions {\n"); |
| 127 | + sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); |
| 128 | + sb |
| 129 | + .append(" indexName: ") |
| 130 | + .append(toIndentedString(indexName)) |
| 131 | + .append("\n"); |
| 132 | + sb |
| 133 | + .append(" facetQuery: ") |
| 134 | + .append(toIndentedString(facetQuery)) |
| 135 | + .append("\n"); |
| 136 | + sb |
| 137 | + .append(" maxFacetHits: ") |
| 138 | + .append(toIndentedString(maxFacetHits)) |
| 139 | + .append("\n"); |
| 140 | + sb.append(" type: ").append(toIndentedString(type)).append("\n"); |
| 141 | + sb.append("}"); |
| 142 | + return sb.toString(); |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * Convert the given object to string with each line indented by 4 spaces (except the first line). |
| 147 | + */ |
| 148 | + private String toIndentedString(Object o) { |
| 149 | + if (o == null) { |
| 150 | + return "null"; |
| 151 | + } |
| 152 | + return o.toString().replace("\n", "\n "); |
| 153 | + } |
| 154 | +} |
0 commit comments