Skip to content

Commit 137266b

Browse files
committed
feat(client): register synonym set classes to client object
1 parent d16a732 commit 137266b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/java/org/typesense/api/Client.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public class Client {
2626
private Stopwords stopwords;
2727
private Map<String, StopwordsSet> individualStopwordsSets;
2828

29+
private SynonymSets synonymSets;
30+
private Map<String, SynonymSet> individualSynonymSets;
31+
2932
public Health health;
3033
public Operations operations;
3134
public Metrics metrics;
@@ -50,6 +53,8 @@ public Client(Configuration configuration){
5053
this.stemming = new Stemming(this.apiCall);
5154
this.stopwords = new Stopwords(this.apiCall);
5255
this.individualStopwordsSets = new HashMap<>();
56+
this.synonymSets = new SynonymSets(this.apiCall);
57+
this.individualSynonymSets = new HashMap<>();
5358
}
5459

5560
public Collection collections(String name){
@@ -121,4 +126,19 @@ public StopwordsSet stopwords(String stopwordsSetId) {
121126
retVal = this.individualStopwordsSets.get(stopwordsSetId);
122127
return retVal;
123128
}
129+
130+
public SynonymSets synonymSets() {
131+
return this.synonymSets;
132+
}
133+
134+
public SynonymSet synonymSet(String synonymSetName) {
135+
SynonymSet retVal;
136+
137+
if (!this.individualSynonymSets.containsKey(synonymSetName)) {
138+
this.individualSynonymSets.put(synonymSetName, new SynonymSet(synonymSetName, this.apiCall));
139+
}
140+
141+
retVal = this.individualSynonymSets.get(synonymSetName);
142+
return retVal;
143+
}
124144
}

0 commit comments

Comments
 (0)