io.github.honhimw.ms.api.FacetingSettings Maven / Gradle / Ivy
Show all versions of meilisearch-rest-client Show documentation
/*
* 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.Faceting;
import io.github.honhimw.ms.model.TaskInfo;
import io.github.honhimw.ms.api.annotation.Operation;
import java.util.function.Consumer;
/**
* Faceting
*
* With Meilisearch, you can create faceted search interfaces. This setting allows you to:
*
* - Define the maximum number of values returned by the facets search parameter
* - Sort facet values by value count or alphanumeric order
*
*
* To learn more about faceting, refer to our dedicated guide.
*
* @author hon_him
* @see io.github.honhimw.ms.model.Faceting
* @since 2024-01-03
*/
public interface FacetingSettings {
/**
* Get the faceting settings of an index.
*
* @return current index faceting
*/
@Operation(method = "GET", paths = "/indexes/{index_uid}/settings/faceting")
Faceting get();
/**
* Partially update the faceting settings for an index.
* Any parameters not provided in the body will be left unchanged.
*
* @param faceting faceting settings
* @return update task
*/
@Operation(method = "PATCH", paths = "/indexes/{index_uid}/settings/faceting")
TaskInfo update(Faceting faceting);
/**
* Partially update the faceting settings for an index.
* Any parameters not provided in the body will be left unchanged.
*
* @param builder faceting settings builder
* @return update task
*/
@Operation(method = "PATCH", paths = "/indexes/{index_uid}/settings/faceting")
default TaskInfo update(Consumer builder) {
Faceting.Builder _builder = Faceting.builder();
builder.accept(_builder);
return update(_builder.build());
}
/**
* Reset an index's faceting settings to their default value.
* Setting sortFacetValuesBy to null( --data-binary '{ "sortFacetValuesBy": null }'), will restore it to the default value ("*": "alpha").
*
* @return reset task
*/
@Operation(method = "DELETE", paths = "/indexes/{index_uid}/settings/faceting")
TaskInfo reset();
}