Skip to content

Commit d8f079a

Browse files
algolia-botben-kalmusClaraMuller
committed
feat(specs): add compositions deduplication setting (generated)
algolia/api-clients-automation#5418 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Ben Kalmus <[email protected]> Co-authored-by: Clara Muller <[email protected]>
1 parent 2cc80d5 commit d8f079a

File tree

3 files changed

+133
-2
lines changed

3 files changed

+133
-2
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.composition;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
9+
/**
10+
* Deduplication positioning configures how a duplicate result should be resolved between an
11+
* injected item and main search results. Current configuration supports: - 'highest': always select
12+
* the item in the highest position, and remove duplicates that appear lower in the results. -
13+
* 'highestInjected': duplicate result will be moved to its highest possible injected position, but
14+
* not higher. If a duplicate appears higher in main search results, it will be removed to stay it's
15+
* intended group position (which could be lower than main).
16+
*/
17+
public enum DedupPositioning {
18+
HIGHEST("highest"),
19+
20+
HIGHEST_INJECTED("highestInjected");
21+
22+
private final String value;
23+
24+
DedupPositioning(String value) {
25+
this.value = value;
26+
}
27+
28+
@JsonValue
29+
public String getValue() {
30+
return value;
31+
}
32+
33+
@Override
34+
public String toString() {
35+
return String.valueOf(value);
36+
}
37+
38+
@JsonCreator
39+
public static DedupPositioning fromValue(String value) {
40+
for (DedupPositioning b : DedupPositioning.values()) {
41+
if (b.value.equals(value)) {
42+
return b;
43+
}
44+
}
45+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
46+
}
47+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.composition;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.Objects;
9+
10+
/**
11+
* Deduplication configures the methods used to resolve duplicate items between main search results
12+
* and injected group results.
13+
*/
14+
public class Deduplication {
15+
16+
@JsonProperty("positioning")
17+
private DedupPositioning positioning;
18+
19+
public Deduplication setPositioning(DedupPositioning positioning) {
20+
this.positioning = positioning;
21+
return this;
22+
}
23+
24+
/** Get positioning */
25+
@javax.annotation.Nonnull
26+
public DedupPositioning getPositioning() {
27+
return positioning;
28+
}
29+
30+
@Override
31+
public boolean equals(Object o) {
32+
if (this == o) {
33+
return true;
34+
}
35+
if (o == null || getClass() != o.getClass()) {
36+
return false;
37+
}
38+
Deduplication deduplication = (Deduplication) o;
39+
return Objects.equals(this.positioning, deduplication.positioning);
40+
}
41+
42+
@Override
43+
public int hashCode() {
44+
return Objects.hash(positioning);
45+
}
46+
47+
@Override
48+
public String toString() {
49+
StringBuilder sb = new StringBuilder();
50+
sb.append("class Deduplication {\n");
51+
sb.append(" positioning: ").append(toIndentedString(positioning)).append("\n");
52+
sb.append("}");
53+
return sb.toString();
54+
}
55+
56+
/**
57+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
58+
*/
59+
private String toIndentedString(Object o) {
60+
if (o == null) {
61+
return "null";
62+
}
63+
return o.toString().replace("\n", "\n ");
64+
}
65+
}

algoliasearch/src/main/java/com/algolia/model/composition/Injection.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class Injection {
1818
@JsonProperty("injectedItems")
1919
private List<InjectedItem> injectedItems;
2020

21+
@JsonProperty("deduplication")
22+
private Deduplication deduplication;
23+
2124
public Injection setMain(Main main) {
2225
this.main = main;
2326
return this;
@@ -48,6 +51,17 @@ public List<InjectedItem> getInjectedItems() {
4851
return injectedItems;
4952
}
5053

54+
public Injection setDeduplication(Deduplication deduplication) {
55+
this.deduplication = deduplication;
56+
return this;
57+
}
58+
59+
/** Get deduplication */
60+
@javax.annotation.Nullable
61+
public Deduplication getDeduplication() {
62+
return deduplication;
63+
}
64+
5165
@Override
5266
public boolean equals(Object o) {
5367
if (this == o) {
@@ -57,12 +71,16 @@ public boolean equals(Object o) {
5771
return false;
5872
}
5973
Injection injection = (Injection) o;
60-
return Objects.equals(this.main, injection.main) && Objects.equals(this.injectedItems, injection.injectedItems);
74+
return (
75+
Objects.equals(this.main, injection.main) &&
76+
Objects.equals(this.injectedItems, injection.injectedItems) &&
77+
Objects.equals(this.deduplication, injection.deduplication)
78+
);
6179
}
6280

6381
@Override
6482
public int hashCode() {
65-
return Objects.hash(main, injectedItems);
83+
return Objects.hash(main, injectedItems, deduplication);
6684
}
6785

6886
@Override
@@ -71,6 +89,7 @@ public String toString() {
7189
sb.append("class Injection {\n");
7290
sb.append(" main: ").append(toIndentedString(main)).append("\n");
7391
sb.append(" injectedItems: ").append(toIndentedString(injectedItems)).append("\n");
92+
sb.append(" deduplication: ").append(toIndentedString(deduplication)).append("\n");
7493
sb.append("}");
7594
return sb.toString();
7695
}

0 commit comments

Comments
 (0)