Skip to content

Commit 21bf793

Browse files
meili-bors[bot]meili-botbidoubiwa
authored
Merge #768
768: Changes related to the next Meilisearch release (v0.28.0) r=bidoubiwa a=meili-bot This PR gathers the changes related to the next Meilisearch release (v0.28.0) so that this package is ready when the official release is out. ⚠️ This PR should NOT be merged until: - the next release of Meilisearch (v0.28.0) is out. - the [`meilisearch-js`](https://github.com/meilisearch/meilisearch-js) dependency has been released to be compatible with Meilisearch v0.28.0. Once the release is out, the upgrade of the `meilisearch-js` dependency might be committed to this branch. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._ _Related to this issue: https://github.com/meilisearch/integration-guides/issues/205_ Co-authored-by: meili-bot <[email protected]> Co-authored-by: cvermand <[email protected]> Co-authored-by: Charlotte Vermandel <[email protected]>
2 parents 4aa26d2 + 2ef15d6 commit 21bf793

27 files changed

+109
-76
lines changed

.github/scripts/check-release.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22

33
# Checking if current tag matches the package version
44
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
5-
file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
6-
if [ "$current_tag" != "$file_tag" ]; then
7-
echo "Error: the current tag does not match the version in package file(s)."
8-
echo "$current_tag vs $file_tag"
5+
6+
package_file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
7+
package_file_name='package.json'
8+
version_file_tag=$(grep "PACKAGE_VERSION =" src/package-version.ts | cut -d "=" -f 2- | tr -d " " | tr -d "'")
9+
version_file_name='src/package-version.ts'
10+
11+
if [ "$current_tag" != "$package_file_tag" ] || [ "$current_tag" != "$version_file_tag" ]; then
12+
echo 'Error: the current tag does not match the version in package file(s).'
13+
echo "$package_file_name: $current_tag vs $package_file_tag"
14+
echo "$version_file_name: $current_tag vs $version_file_tag"
915
exit 1
1016
fi
1117

CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,16 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m
131131

132132
⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md).
133133

134-
Make a PR modifying the file [`package.json`](/package.json) with the right version.
134+
Make a PR modifying the following files with the right version:
135135

136+
[`package.json`](/package.json):
136137
```javascript
137-
"version": "X.X.X"
138+
"version": "X.X.X",
139+
```
140+
141+
[`src/package-version`](/src/package-version.ts)
142+
```javascript
143+
export const PACKAGE_VERSION = 'X.X.X'
138144
```
139145

140146
Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/instant-meilisearch/releases): on this page, click on `Edit` (related to the draft release) > update the description (be sure you apply [these recommandations](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md#writting-the-release-description)) > when you are ready, click on `Publish release`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ This package only guarantees the compatibility with the [version v4 of InstantSe
253253

254254
**Supported Meilisearch versions**:
255255

256-
This package only guarantees the compatibility with the [version v0.27.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.27.0).
256+
This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).
257257

258258
**Node / NPM versions**:
259259

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"url": "https://github.com/meilisearch/instant-meilisearch.git"
5858
},
5959
"dependencies": {
60-
"meilisearch": "0.26.0"
60+
"meilisearch": "^0.27.0"
6161
},
6262
"devDependencies": {
6363
"@babel/cli": "^7.18.6",

src/adapter/search-request-adapter/filters.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
Filter,
33
ParsedFilter,
4-
FacetsDistribution,
4+
FacetDistribution,
55
FacetsCache,
66
MeiliSearchParams,
77
SearchContext,
@@ -62,10 +62,10 @@ export function getFacetsFromFilter(filters?: Filter): FacetsCache {
6262
}
6363

6464
function getFacetsFromDefaultDistribution(
65-
facetsDistribution: FacetsDistribution
65+
facetDistribution: FacetDistribution
6666
): FacetsCache {
67-
return Object.keys(facetsDistribution).reduce((cache: any, facet) => {
68-
const facetValues = Object.keys(facetsDistribution[facet])
67+
return Object.keys(facetDistribution).reduce((cache: any, facet) => {
68+
const facetValues = Object.keys(facetDistribution[facet])
6969
return {
7070
...cache,
7171
[facet]: facetValues,
@@ -91,19 +91,19 @@ export function extractFacets(
9191
}
9292

9393
/**
94-
* Assign missing filters to facetsDistribution.
95-
* All facet passed as filter should appear in the facetsDistribution.
94+
* Assign missing filters to facetDistribution.
95+
* All facets passed as filter should appear in the facetDistribution.
9696
* If not present, the facet is added with 0 as value.
9797
*
9898
*
9999
* @param {FacetsCache} cache?
100-
* @param {FacetsDistribution} distribution?
101-
* @returns {FacetsDistribution}
100+
* @param {FacetDistribution} distribution?
101+
* @returns {FacetDistribution}
102102
*/
103103
export function addMissingFacets(
104104
cachedFacets?: FacetsCache,
105-
distribution?: FacetsDistribution
106-
): FacetsDistribution {
105+
distribution?: FacetDistribution
106+
): FacetDistribution {
107107
distribution = distribution || {}
108108

109109
// If cachedFacets contains something

src/adapter/search-request-adapter/search-params-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function adaptSearchParams(
2222
// Facets
2323
const facets = searchContext?.facets
2424
if (facets?.length) {
25-
meiliSearchParams.facetsDistribution = facets
25+
meiliSearchParams.facets = facets
2626
}
2727

2828
// Attributes To Crop

src/adapter/search-request-adapter/search-resolver.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { addMissingFacets, extractFacets } from './filters'
1010
const emptySearch: MeiliSearchResponse<Record<string, any>> = {
1111
hits: [],
1212
query: '',
13-
facetsDistribution: {},
13+
facetDistribution: {},
1414
limit: 0,
1515
offset: 0,
16-
exhaustiveNbHits: false,
17-
nbHits: 0,
16+
estimatedTotalHits: 0,
1817
processingTimeMs: 0,
1918
}
2019

@@ -69,10 +68,10 @@ export function SearchResolver(cache: SearchCacheInterface) {
6968
.index(searchContext.indexUid)
7069
.search(searchContext.query, searchParams)
7170

72-
// Add missing facets back into facetsDistribution
73-
searchResponse.facetsDistribution = addMissingFacets(
71+
// Add missing facets back into facetDistribution
72+
searchResponse.facetDistribution = addMissingFacets(
7473
facetsCache,
75-
searchResponse.facetsDistribution
74+
searchResponse.facetDistribution
7675
)
7776

7877
// Cache response

src/adapter/search-response-adapter/hits-adapter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ export function adaptHits(
2121
let adaptedHits = paginatedHits.map((hit: Record<string, any>) => {
2222
// Creates Hit object compliant with InstantSearch
2323
if (Object.keys(hit).length > 0) {
24-
const { _formatted: formattedHit, _matchesInfo, ...documentFields } = hit
24+
const {
25+
_formatted: formattedHit,
26+
_matchesPosition,
27+
...documentFields
28+
} = hit
2529

2630
const adaptedHit: Record<string, any> = Object.assign(
2731
documentFields,

src/adapter/search-response-adapter/search-response-adapter.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,16 @@ export function adaptSearchResponse<T>(
2121
): { results: Array<AlgoliaSearchResponse<T>> } {
2222
const searchResponseOptionals: Record<string, any> = {}
2323

24-
const facets = searchResponse.facetsDistribution
24+
const facets = searchResponse.facetDistribution
2525
const { pagination } = searchContext
2626

27-
const exhaustiveFacetsCount = searchResponse?.exhaustiveFacetsCount
28-
if (exhaustiveFacetsCount) {
29-
searchResponseOptionals.exhaustiveFacetsCount = exhaustiveFacetsCount
30-
}
31-
3227
const nbPages = ceiledDivision(
3328
searchResponse.hits.length,
3429
pagination.hitsPerPage
3530
)
3631
const hits = adaptHits(searchResponse.hits, searchContext, pagination)
3732

38-
const exhaustiveNbHits = searchResponse.exhaustiveNbHits
39-
const nbHits = searchResponse.nbHits
33+
const estimatedTotalHits = searchResponse.estimatedTotalHits
4034
const processingTimeMs = searchResponse.processingTimeMs
4135
const query = searchResponse.query
4236

@@ -49,12 +43,12 @@ export function adaptSearchResponse<T>(
4943
page,
5044
facets,
5145
nbPages,
52-
exhaustiveNbHits,
53-
nbHits,
46+
nbHits: estimatedTotalHits,
5447
processingTimeMS: processingTimeMs,
5548
query,
5649
hits,
5750
params: '',
51+
exhaustiveNbHits: false,
5852
...searchResponseOptionals,
5953
}
6054
return {

src/cache/__tests__/assets/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export const searchResponse = {
44
offset: 0,
55
limit: 0,
66
processingTimeMs: 0,
7-
nbHits: 0,
7+
estimatedTotalHits: 0,
88
exhaustiveNbHits: false,
99
}

0 commit comments

Comments
 (0)