Skip to content
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

Expose a set of Meilisearch search parameters to be overridden/configured #1258

Merged
merged 7 commits into from
Dec 11, 2023

Conversation

flevi29
Copy link
Collaborator

@flevi29 flevi29 commented Oct 1, 2023

Pull Request

Related issue

Fixes #1249

What does this PR do?

  • Adds ability to configure and override a selection of Meilisearch search parameters
  • Modifies some types, stronger type checking

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

@changeset-bot
Copy link

changeset-bot bot commented Oct 1, 2023

🦋 Changeset detected

Latest commit: 95d1f6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@meilisearch/instant-meilisearch Major
@meilisearch/autocomplete-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -32,16 +33,17 @@ import { constructClientAgents } from './agents'

/**
* Instantiate SearchClient required by instantsearch.js.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this comment should be tweaked, to explain the new return type.

@@ -214,19 +246,22 @@ export function adaptSearchParams(
): MeiliSearchMultiSearchParams {
const meilisearchParams = MeiliParamsCreator(searchContext)
meilisearchParams.addQuery()
meilisearchParams.addIndexUid()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because index uid is non-optional, I opted for stronger types, and always initiate meiliSearchParams with indexUid.

@@ -20,7 +20,6 @@ export function getParametersWithoutFilters(
}
const meilisearchParams = MeiliParamsCreator(defaultSearchContext)
meilisearchParams.addFacets()
meilisearchParams.addIndexUid()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always needs to be added, so the MeiliParamsCreator does it.

Comment on lines -36 to -39
export const enum MatchingStrategies {
ALL = 'all',
LAST = 'last',
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be imported from Meilisearch JS package, and its type fixed there. (meilisearch/meilisearch-js#1588)

@flevi29
Copy link
Collaborator Author

flevi29 commented Oct 1, 2023

Seems like I've made a faulty merge.

@flevi29
Copy link
Collaborator Author

flevi29 commented Oct 1, 2023

Jetbrains IDE merge did some weird stuff, where merge did not delete anything, and only kept additions, or at least I believe that's what happened. I tried reverting, but just couldn't get it right so I had to reset and merge again. Apologies if this causes any problem with git history.

@flevi29
Copy link
Collaborator Author

flevi29 commented Oct 9, 2023

Looks like I didn't run some of the tests. I only ran yarn test and yarn test:e2e. Will fix.

@brunoocasali
Copy link
Member

Hey @flevi29, I'm the current maintainer of the repo, and I have a lot on my plate right now. I'll take a look at your code ASAP :)

Thanks for the contribution!

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @flevi29, I hope you're good!

Thanks a lot for your time doing this update; I'm sure the small breaking change will be paid off soon!

Unfortunately, I've lacked time in the last few months due to other company priorities, and reviewing a PR like this is very demanding to me now. So, I looked at it, and it is good from my POV.
Since this is an important change, and I want to ensure people can take advantage of it ASAP (the PR has been waiting for a long time now), I'm going to merge and release it.

Anyway, thanks for your effort @flevi29!

By the way, if anyone is seeing this comment, please step in regarding reviewing PRs or raising new PRs, we have a very engaged community, and we need you more than ever.

@brunoocasali brunoocasali added enhancement New feature or request breaking-change The related changes are breaking for the users labels Dec 11, 2023
@brunoocasali
Copy link
Member

bors merge

@meili-bors meili-bors bot merged commit f95e70a into meilisearch:main Dec 11, 2023
8 checks passed
@flevi29 flevi29 deleted the expose-search-parameters branch December 11, 2023 06:59
@flevi29
Copy link
Collaborator Author

flevi29 commented Dec 11, 2023

Hey @brunoocasali!

No problem, take your time. I will keep contributing when I find the time, for my next issue this was kind of a blocking one.

Thanks for the kind words, and godspeed with current priorities!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users enhancement New feature or request
Projects
None yet
2 participants