-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
357: Changes related to the next Meilisearch release (v0.30.0) r=brunoocasali a=meili-bot Related to this issue: meilisearch/integration-guides#221 This PR: - gathers the changes related to the next Meilisearch release (v0.30.0) so that this package is ready when the official release is out. - should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases). - might eventually contain test failures until the Meilisearch v0.30.0 is out.⚠️ This PR should NOT be merged until the next release of Meilisearch (v0.30.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._ Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com> Co-authored-by: Bruno Casali <brunoocasali@gmail.com>
- Loading branch information
Showing
22 changed files
with
642 additions
and
52 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
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
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,42 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Meilisearch | ||
{ | ||
/// <summary> | ||
/// Wrapper for Search Results. | ||
/// </summary> | ||
/// <typeparam name="T">Hit type.</typeparam> | ||
public interface ISearchable<T> | ||
{ | ||
/// <summary> | ||
/// Results of the query. | ||
/// </summary> | ||
[JsonPropertyName("hits")] | ||
IReadOnlyCollection<T> Hits { get; } | ||
|
||
/// <summary> | ||
/// Returns the number of documents matching the current search query for each given facet. | ||
/// </summary> | ||
[JsonPropertyName("facetDistribution")] | ||
IReadOnlyDictionary<string, IReadOnlyDictionary<string, int>> FacetDistribution { get; } | ||
|
||
/// <summary> | ||
/// Processing time of the query. | ||
/// </summary> | ||
[JsonPropertyName("processingTimeMs")] | ||
int ProcessingTimeMs { get; } | ||
|
||
/// <summary> | ||
/// Query originating the response. | ||
/// </summary> | ||
[JsonPropertyName("query")] | ||
string Query { get; } | ||
|
||
/// <summary> | ||
/// Contains the location of each occurrence of queried terms across all fields. | ||
/// </summary> | ||
[JsonPropertyName("_matchesPosition")] | ||
IReadOnlyDictionary<string, IReadOnlyCollection<MatchPosition>> MatchesPostion { get; } | ||
} | ||
} |
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
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
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,19 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Meilisearch | ||
{ | ||
/// <summary> | ||
/// Model for index swaps requests. | ||
/// </summary> | ||
public class IndexSwap | ||
{ | ||
[JsonPropertyName("indexes")] | ||
public List<string> Indexes { get; private set; } | ||
|
||
public IndexSwap(string indexA, string indexB) | ||
{ | ||
this.Indexes = new List<string> { indexA, indexB }; | ||
} | ||
} | ||
} |
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
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,27 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Meilisearch | ||
{ | ||
public class MatchPosition | ||
{ | ||
public MatchPosition(int start, int length) | ||
{ | ||
Start = start; | ||
Length = length; | ||
} | ||
|
||
/// <summary> | ||
/// The beginning of a matching term within a field. | ||
/// WARNING: This value is in bytes and not the number of characters. For example, ü represents two bytes but one character. | ||
/// </summary> | ||
[JsonPropertyName("start")] | ||
public int Start { get; } | ||
|
||
/// <summary> | ||
/// The length of a matching term within a field. | ||
/// WARNING: This value is in bytes and not the number of characters. For example, ü represents two bytes but one character. | ||
/// </summary> | ||
[JsonPropertyName("length")] | ||
public int Length { get; } | ||
} | ||
} |
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
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,75 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Meilisearch | ||
{ | ||
/// <summary> | ||
/// Wrapper for Search Results with finite pagination. | ||
/// </summary> | ||
/// <typeparam name="T">Hit type.</typeparam> | ||
public class PaginatedSearchResult<T> : ISearchable<T> | ||
{ | ||
public PaginatedSearchResult(IReadOnlyCollection<T> hits, int hitsPerPage, int page, int total, | ||
IReadOnlyDictionary<string, IReadOnlyDictionary<string, int>> facetDistribution, | ||
int processingTimeMs, string query, | ||
IReadOnlyDictionary<string, IReadOnlyCollection<MatchPosition>> matchesPostion) | ||
{ | ||
Hits = hits; | ||
HitsPerPage = hitsPerPage; | ||
Page = page; | ||
Total = total; | ||
FacetDistribution = facetDistribution; | ||
ProcessingTimeMs = processingTimeMs; | ||
Query = query; | ||
MatchesPostion = matchesPostion; | ||
} | ||
|
||
/// <summary> | ||
/// Number of documents each page. | ||
/// </summary> | ||
[JsonPropertyName("hitsPerPage")] | ||
public int HitsPerPage { get; } | ||
|
||
/// <summary> | ||
/// Number of documents to take. | ||
/// </summary> | ||
[JsonPropertyName("page")] | ||
public int Page { get; } | ||
|
||
/// <summary> | ||
/// Results of the query. | ||
/// </summary> | ||
[JsonPropertyName("hits")] | ||
public IReadOnlyCollection<T> Hits { get; } | ||
|
||
/// <summary> | ||
/// Gets the estimated total number of hits returned by the search. | ||
/// </summary> | ||
[JsonPropertyName("total")] | ||
public int Total { get; } | ||
|
||
/// <summary> | ||
/// Returns the number of documents matching the current search query for each given facet. | ||
/// </summary> | ||
[JsonPropertyName("facetDistribution")] | ||
public IReadOnlyDictionary<string, IReadOnlyDictionary<string, int>> FacetDistribution { get; } | ||
|
||
/// <summary> | ||
/// Processing time of the query. | ||
/// </summary> | ||
[JsonPropertyName("processingTimeMs")] | ||
public int ProcessingTimeMs { get; } | ||
|
||
/// <summary> | ||
/// Query originating the response. | ||
/// </summary> | ||
[JsonPropertyName("query")] | ||
public string Query { get; } | ||
|
||
/// <summary> | ||
/// Contains the location of each occurrence of queried terms across all fields. | ||
/// </summary> | ||
[JsonPropertyName("_matchesPosition")] | ||
public IReadOnlyDictionary<string, IReadOnlyCollection<MatchPosition>> MatchesPostion { get; } | ||
} | ||
} |
Oops, something went wrong.