io.github.honhimw.ms.api.RankingRulesSettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of meilisearch-rest-client Show documentation
Show all versions of meilisearch-rest-client Show documentation
Reactive meilisearch rest client powered by reactor-netty-http.
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.honhimw.ms.api;
import io.github.honhimw.ms.model.RankingRule;
import io.github.honhimw.ms.model.TaskInfo;
import io.github.honhimw.ms.api.annotation.Operation;
import java.util.List;
/**
* Ranking rules
*
* Ranking rules are built-in rules that rank search results according to certain criteria. They are applied in the same order in which they appear in the rankingRules array.
*
* To learn more about ranking rules, refer to our dedicated guide.
*
Ranking rules array
* Default order
*
* [
* "words",
* "typo",
* "proximity",
* "attribute",
* "sort",
* "exactness"
* ]
*
*
* @author hon_him
* @since 2024-01-03
*/
public interface RankingRulesSettings {
/**
* Get the ranking rules of an index.
*
* @return current index ranking rules
*/
@Operation(method = "GET", paths = "/indexes/{index_uid}/settings/ranking-rules")
List get();
/**
* Update the ranking rules of an index.
*
* An array that contains ranking rules in order of importance.
*
* To create a custom ranking rule, give an attribute followed by a colon (:) and either asc for ascending order or desc for descending order.
*
* - To apply an ascending sort (results sorted by increasing value): attribute_name:asc
* - To apply a descending sort (results sorted by decreasing value): attribute_name:desc
*
* WARNING
*
* If some documents do not contain the attribute defined in a custom ranking rule, the application of the ranking rule is undefined and the search results might not be sorted as you expected.
*
* Make sure that any attribute used in a custom ranking rule is present in all of your documents. For example, if you set the custom ranking rule desc(year), make sure that all your documents contain the attribute year.
*
*
* @param rankingRules ordered ranking rules
* @return update task
*/
@Operation(method = "PUT", paths = "/indexes/{index_uid}/settings/ranking-rules")
TaskInfo update(List rankingRules);
/**
* Reset the ranking rules of an index to their default value.
* TIP
*
* Resetting ranking rules is not the same as removing them. To remove a ranking rule, use the update ranking rules endpoint.
*
*
* @return reset task
*/
@Operation(method = "DELETE", paths = "/indexes/{index_uid}/settings/ranking-rules")
TaskInfo reset();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy