-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
739: Add sort facets value feature r=curquiza a=the-sinner # Pull Request ## Related issue Fixes #634 ## What does this PR do? - added feature to sort facets value by alphanumerical or count order ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Shalabh Agarwal <[email protected]> Co-authored-by: Shalabh Agarwal <[email protected]>
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/com/meilisearch/sdk/model/FacetSortValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.meilisearch.sdk.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* Enum for Sorting Facet Values | ||
* | ||
* @see <a href="https://www.meilisearch.com/docs/reference/api/settings#faceting-object">API | ||
* specification</a> | ||
*/ | ||
public enum FacetSortValue { | ||
@SerializedName("alpha") | ||
ALPHA("alpha"), | ||
@SerializedName("count") | ||
COUNT("count"); | ||
|
||
public final String facetSortValue; | ||
|
||
FacetSortValue(String facetSortValue) { | ||
this.facetSortValue = facetSortValue; | ||
} | ||
|
||
@JsonValue | ||
@Override | ||
public String toString() { | ||
return this.facetSortValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package com.meilisearch.sdk.model; | ||
|
||
import java.util.HashMap; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Setter | ||
@Getter | ||
public class Faceting { | ||
protected int maxValuesPerFacet; | ||
protected HashMap<String, FacetSortValue> sortFacetValuesBy; | ||
|
||
public Faceting() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters