Skip to content

Commit 5ebf404

Browse files
bors[bot]meili-botalallema
authored
Merge #286
286: Changes related to the next Meilisearch release (v0.27.0) r=curquiza a=meili-bot Related to this issue: meilisearch/integration-guides#190 This PR: - gathers the changes related to the next Meilisearch release (v0.27.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.27.0 is out. ⚠️ This PR should NOT be merged until the next release of Meilisearch (v0.27.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._ Done: - #287 - #289 - #290 - #291 - #294 - #293 # Release **:warning:** The go package didn't need a version update CI will publish the package once the `Publish release` will be done. However, a version file exists and this is only for analytics but it already is on the next version (the v0.19.1). This version makes this package compatible with MeiliSearch v0.27.0🎉  Check out the changelog of [MeiliSearch v0.27.0](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.27.0) for more information about the changes. ## 🚀 Enhancements * Feature/Analytics (#279) `@brunoocasali` * Add new methods for the new typo tolerance settings #294 `@alallema` `Index.GetTypoTolerance()` `Index.UpdateTypoTolerance(params)` `Index.ResetTypoTolerance()` * Ensure nested field support #290 `@alallema` * Add new search parameters highlightPreTag, highlightPostTag and cropMarker #291 `@alallema` Co-authored-by: meili-bot <[email protected]> Co-authored-by: Amélie <[email protected]> Co-authored-by: alallema <[email protected]>
2 parents 44aa5f3 + ec887b0 commit 5ebf404

File tree

12 files changed

+1466
-381
lines changed

12 files changed

+1466
-381
lines changed

.code-samples.meilisearch.yaml

Lines changed: 93 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -92,41 +92,48 @@ get_settings_1: |-
9292
update_settings_1: |-
9393
distinctAttribute := "movie_id"
9494
settings := meilisearch.Settings{
95-
RankingRules: []string{
96-
"words",
97-
"typo",
98-
"proximity",
99-
"attribute",
100-
"sort",
101-
"exactness",
102-
"release_date:desc",
103-
"rank:desc",
104-
},
105-
DistinctAttribute: &distinctAttribute,
106-
SearchableAttributes: []string{
107-
"title",
108-
"overview",
109-
"genres",
110-
},
111-
DisplayedAttributes: []string{
112-
"title",
113-
"overview",
114-
"genres",
115-
"release_date",
116-
},
117-
StopWords: []string{
118-
"the",
119-
"a",
120-
"an",
121-
},
122-
SortableAttributes: []string{
123-
"title",
124-
"release_date",
125-
},
126-
Synonyms: map[string][]string{
127-
"wolverine": []string{"xmen", "logan"},
128-
"logan": []string{"wolverine"},
129-
},
95+
RankingRules: []string{
96+
"words",
97+
"typo",
98+
"proximity",
99+
"attribute",
100+
"sort",
101+
"exactness",
102+
"release_date:desc",
103+
"rank:desc",
104+
},
105+
DistinctAttribute: &distinctAttribute,
106+
SearchableAttributes: []string{
107+
"title",
108+
"overview",
109+
"genres",
110+
},
111+
DisplayedAttributes: []string{
112+
"title",
113+
"overview",
114+
"genres",
115+
"release_date",
116+
},
117+
StopWords: []string{
118+
"the",
119+
"a",
120+
"an",
121+
},
122+
SortableAttributes: []string{
123+
"title",
124+
"release_date",
125+
},
126+
Synonyms: map[string][]string{
127+
"wolverine": []string{"xmen", "logan"},
128+
"logan": []string{"wolverine"},
129+
},
130+
TypoTolerance: &meilisearch.TypoTolerance{
131+
MinWordSizeForTypos: meilisearch.MinWordSizeForTypo{
132+
OneTypo: 8,
133+
TwoTypos: 10,
134+
},
135+
DisableOnAttributes: []string{"title"},
136+
},
130137
}
131138
client.Index("movies").UpdateSettings(&settings)
132139
reset_settings_1: |-
@@ -214,6 +221,18 @@ update_sortable_attributes_1: |-
214221
client.Index("books").UpdateSortableAttributes(&sortableAttributes)
215222
reset_sortable_attributes_1: |-
216223
client.Index("books").ResetSortableAttributes()
224+
get_typo_tolerance_1:
225+
client.Index("books").GetTypoTolerance()
226+
update_typo_tolerance_1: |-
227+
client.Index("books").UpdateTypoTolerance(&meilisearch.TypoTolerance{
228+
MinWordSizeForTypos: meilisearch.MinWordSizeForTypo{
229+
OneTypo: 4,
230+
TwoTypos: 10,
231+
},
232+
DisableOnAttributes: []string{"title"},
233+
})
234+
reset_typo_tolerance_1: |-
235+
client.Index("books").ResetTypoTolerance()
217236
get_index_stats_1: |-
218237
client.Index("movies").GetStats()
219238
get_indexes_stats_1: |-
@@ -266,14 +285,25 @@ search_parameter_guide_retrieve_1: |-
266285
AttributesToRetrieve: []string{"overview", "title"},
267286
})
268287
search_parameter_guide_crop_1: |-
269-
resp, err := client.Index("movies").Search("shifu" &meilisearch.SearchRequest{
288+
resp, err := client.Index("movies").Search("shifu", &meilisearch.SearchRequest{
270289
AttributesToCrop: []string{"overview"},
271-
CropLength: 10,
290+
CropLength: 5,
291+
})
292+
search_parameter_guide_crop_marker_1: |-
293+
resp, err := client.Index("movies").Search("shifu", &meilisearch.SearchRequest{
294+
AttributesToCrop: []string{"overview"},
295+
CropMarker: "[…]",
272296
})
273297
search_parameter_guide_highlight_1: |-
274298
resp, err := client.Index("movies").Search("winter feast", &meilisearch.SearchRequest{
275299
AttributesToHighlight: []string{"overview"},
276300
})
301+
search_parameter_guide_highlight_tag_1: |-
302+
resp, err := client.Index("movies").Search("winter feast", &meilisearch.SearchRequest{
303+
AttributesToHighlight: []string{"overview"},
304+
HighlightPreTag: "<span class=\"highlight\">",
305+
HighlightPostTag: "</span>",
306+
})
277307
search_parameter_guide_matches_1: |-
278308
resp, err := client.Index("movies").Search("winter feast", &meilisearch.SearchRequest{
279309
Matches: true,
@@ -342,6 +372,32 @@ settings_guide_sortable_1: |-
342372
},
343373
}
344374
client.Index("books").UpdateSettings(&settings)
375+
settings_guide_typo_tolerance_1: |-
376+
client.index("movies").UpdateTypoTolerance({
377+
MinWordSizeForTypos: meilisearch.MinWordSizeForTypo{
378+
TwoTypos: 12,
379+
},
380+
DisableOnAttributes: []string{"title"},
381+
})
382+
typo_tolerance_guide_1: |-
383+
client.index("movies").UpdateTypoTolerance({
384+
Enabled: false,
385+
})
386+
typo_tolerance_guide_2: |-
387+
client.index("movies").UpdateTypoTolerance({
388+
DisableOnAttributes: []string{"title"},
389+
})
390+
typo_tolerance_guide_3: |-
391+
client.index("movies").UpdateTypoTolerance({
392+
DisableOnWords: []string{"shrek"},
393+
})
394+
typo_tolerance_guide_4: |-
395+
client.index("movies").UpdateTypoTolerance({
396+
MinWordSizeForTypos: meilisearch.MinWordSizeForTypo{
397+
OneTypo: 4,
398+
TwoTypos: 10,
399+
},
400+
})
345401
add_movies_json_1: |-
346402
import (
347403
"encoding/json"

.github/workflows/pre-release-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ jobs:
4040
- name: Get the latest Meilisearch RC
4141
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
4242
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
43-
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} ./meilisearch --master-key=masterKey --no-analytics
43+
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
4444
- name: Run integration tests
4545
run: go test -v ./...

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ jobs:
5757
dep ensure
5858
fi
5959
- name: Meilisearch setup (latest version) with Docker
60-
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey --no-analytics
60+
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest meilisearch --master-key=masterKey --no-analytics
6161
- name: Run integration tests
6262
run: go test -v ./...

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ searchRes, err := index.Search("wonder",
227227

228228
## 🤖 Compatibility with Meilisearch
229229

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

232232
## 💡 Learn More
233233

index_search.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ func (i Index) Search(query string, request *SearchRequest) (*SearchResponse, er
3838
if request.CropLength != 0 {
3939
searchPostRequestParams["cropLength"] = request.CropLength
4040
}
41+
if request.CropMarker != "" {
42+
searchPostRequestParams["cropMarker"] = request.CropMarker
43+
}
44+
if request.HighlightPreTag != "" {
45+
searchPostRequestParams["highlightPreTag"] = request.HighlightPreTag
46+
}
47+
if request.HighlightPostTag != "" {
48+
searchPostRequestParams["highlightPostTag"] = request.HighlightPostTag
49+
}
4150
if len(request.AttributesToRetrieve) != 0 {
4251
searchPostRequestParams["attributesToRetrieve"] = request.AttributesToRetrieve
4352
}

0 commit comments

Comments
 (0)