Skip to content

Commit

Permalink
Fix checkstyle, add skip for 8.10 in new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Jul 10, 2023
1 parent 4c946a2 commit e839b0c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ setup:

---
"Create empty synonyms set":
- skip:
version: " - 8.9.99"
reason: Fixed in 8.10.0
- do:
synonyms.put:
synonyms_set: test-empty-synonyms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ setup:

---
"Delete synonym rules - delete all synonym rules leave an empty synonym set":
- skip:
version: " - 8.9.99"
reason: Fixed in 8.10.0
- do:
synonym_rule.delete:
synonyms_set: test-synonyms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import org.elasticsearch.indices.SystemIndexDescriptor;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.sort.SortOrder;
Expand Down Expand Up @@ -82,7 +80,6 @@ public class SynonymsManagementAPIService {
public static final int MAX_SYNONYMS_SETS = 10_000;
private static final String SYNONYM_RULE_ID_FIELD = SynonymRule.ID_FIELD.getPreferredName();
private static final String SYNONYM_SETS_AGG_NAME = "synonym_sets_aggr";
private static final String RULESET_FILTER_AGG_NAME = "ruleset_filter";

private final Client client;

Expand All @@ -105,14 +102,15 @@ public SynonymsManagementAPIService(Client client) {

/* The synonym index stores two object types:
- Synonym rules:
- The id is calculated using internalSynonymRuleId method
- SYNONYM_RULE_ID_FIELD contains the synonym rule ID
- SYNONYMS_FIELD contains the synonyms
- SYNONYMS_SET_FIELD contains the synonym set the rule belongs to
- OBJECT_TYPE_FIELD contains SYNONYM_RULE_OBJECT_TYPE
- The id is calculated using internalSynonymRuleId method
- Synonym sets:
- OBJECT_TYPE_FIELD contains SYNONYM_SET_OBJECT_TYPE
- The id is the synonym set name
- SYNONYMS_SET_FIELD is null
- OBJECT_TYPE_FIELD contains SYNONYM_SET_OBJECT_TYPE
*/
private static XContentBuilder mappings() {
try {
Expand Down Expand Up @@ -403,14 +401,15 @@ public void deleteSynonymsSet(String synonymSetId, ActionListener<SynonymsReload
}

// Deletes the synonym set doc
client.prepareDelete(SYNONYMS_ALIAS_NAME, synonymSetId).execute(deleteRulesListener.delegateFailure((deleteListener, deleteResponse) -> {
if (deleteResponse.status() != RestStatus.OK) {
deleteListener.onFailure(new ElasticsearchException("Error deleting synonym set [" + synonymSetId + "]"));
return;
}
client.prepareDelete(SYNONYMS_ALIAS_NAME, synonymSetId)
.execute(deleteRulesListener.delegateFailure((deleteListener, deleteResponse) -> {
if (deleteResponse.status() != RestStatus.OK) {
deleteListener.onFailure(new ElasticsearchException("Error deleting synonym set [" + synonymSetId + "]"));
return;
}

reloadAnalyzers(synonymSetId, deleteListener, AcknowledgedResponse.of(true));
}));
reloadAnalyzers(synonymSetId, deleteListener, AcknowledgedResponse.of(true));
}));

}));
}));
Expand Down

0 comments on commit e839b0c

Please sign in to comment.