-
Couldn't load subscription status.
- Fork 104
Add new search parameters highlightPreTag, highlightPostTag and cropMarker #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: cvermand <[email protected]>
| if request.CropLength != 0 { | ||
| searchPostRequestParams["cropLength"] = request.CropLength | ||
| } | ||
| if request.CropMarker != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This CropMarker can be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I declare it as string and not as *string. In go if you create a struct all fields exist. This is why I check it.
I had thought to create every field as * so that when instantiating the structure they would be set to nil.
But it would have been much less convenient for the declaration so I preferred to make it easier for the user.
| if request.CropMarker != "" { | ||
| searchPostRequestParams["cropMarker"] = request.CropMarker | ||
| } | ||
| if request.HighlightPreTag != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a way to automate this kind of thing, like serialize somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love it! I didn't find any other ways
| Hits: []interface{}{ | ||
| map[string]interface{}{ | ||
| "book_id": float64(1), "title": "Alice In Wonderland", | ||
| "book_id": float64(123), "title": "Pride and Prejudice", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give some idea about this float64(...)? Why do you need to convert it to float?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default behavior of the deserializer in golang you can read in the documentation
To unmarshal JSON into an interface value, Unmarshal stores one of these in the interface value:
bool, for JSON booleans
float64, for JSON numbers
string, for JSON strings
[]interface{}, for JSON arrays
map[string]interface{}, for JSON objects
nil for JSON null
And by default, every number declare are int so in:
map[string]interface{}{
"book_id": 1,
}
book_id will be an int that is why I convert it. I didn't find a better way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! (go tests are a little bit harder to read for me yet, but I think they are ok) 👯♂️
|
bors merge |
291: Add new search parameters highlightPreTag, highlightPostTag and cropMarker r=alallema a=alallema As per meilisearch/meilisearch#2214 new search parameters are introduced: - `highlightPreTag` - `highlightPostTag` - `cropMarker` Co-authored-by: alallema <[email protected]> Co-authored-by: Amélie <[email protected]>
|
Build failed: |
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]>
As per meilisearch/meilisearch#2214 new search parameters are introduced:
highlightPreTaghighlightPostTagcropMarker