Skip to content

Conversation

@harish2704
Copy link

Since MeiliSearch doesn't allow multi-index searching, some time, we may need to store multiple entities in single search index.

Also, in most cases, we may not need to index all the fields of a model instance.

This PR address the above two issues by adding

  1. an optional searchIndexName field in model definition
  2. an optional mapping function ( called toSearchIndex ) which will transform the data before it sent for indexing

@bidoubiwa bidoubiwa self-requested a review September 13, 2021 10:47
@bidoubiwa
Copy link
Contributor

Thanks so much for this PR! I will be reviewing it asap :) 🔥

@yogeshkotadiya
Copy link

@bidoubiwa Any update on this PR? Would love to have this feature as soon as possible.
Let us know if any help is required.

@bidoubiwa
Copy link
Contributor

Hey @harish2704 I will be working on this review and on the repo in itself the following weeks :) Sorry for the delay

@vedantpandit22
Copy link

@bidoubiwa Any update on this PR? Would love to have this feature as soon as possible.
Let us know if any help is required.

@bidoubiwa
Copy link
Contributor

@vedantpandit22 very sorry, I spend the few last days working on the geo_search since it was introduced in v0.23.0 of MeiliSearch. Strapi is next on my to-do so it should start today or Monday!

@bidoubiwa
Copy link
Contributor

Hey @harish2704 I'm testing locally your PR and except for some specifics it is working great. Are you on strapi's discord? If you'r not no problem I can ask my questions directly here. Or you can come on MeiliSearch's slack (accessible in the upper right corner of our documentation)

@bidoubiwa
Copy link
Contributor

Hello @harish2704 I'm merging your PR into a new branch on which I'm going to add my modifications since the review I'm making is way to long to start with.

Thanks so much for these very cool features!

If you are participating in Hacktoberfest, and you would like to receive a small gift from MeiliSearch too, please complete this form.

@bidoubiwa bidoubiwa changed the base branch from main to add_composite_indexes October 19, 2021 14:04
@bidoubiwa bidoubiwa merged this pull request into meilisearch:add_composite_indexes Oct 19, 2021
@harish2704
Copy link
Author

@bidoubiwa

I'm testing locally your PR and except for some specifics it is working great.

I very happy and exited about this update. Thanks for the update.
Since you are tested it on local, I hope now you will be aware about the caveats of this feature.
For eg: when we enable composite index ( for eg: say 3 models are using same index ) ,
then we ( the plugin ) can not know or set the "per model enable/disable status"

This information is actually not available from the server , so we may not be able to implement it .

Are you aware of this?

Are you on strapi's discord? If you'r not no problem I can ask my questions directly here. Or you can come on MeiliSearch's slack

I prefer discord over slack. I just joined Strapi's dicord ( username: harish2704 ) and MeiliSearch's slack. You can message me over any channel . ( But will be offline for next 5-6 hours. )

If you are participating in Hacktoberfest, and you would like to receive a small gift from MeiliSearch too, please complete this form.

Thank you !. I ll take a look at it.

@bidoubiwa
Copy link
Contributor

For eg: when we enable composite index ( for eg: say 3 models are using same index ) ,
then we ( the plugin ) can not know or set the "per model enable/disable status"

Yes this is one of the points that I wanted to raise in the PR. To fix the issue, in case of a composite index I will not delete the index (enable/disable). Instead, it will only delete the documents of the collection you disable.
If the user disables the last enabled model of a composite index, in that case I will delete the index.

If I do not find a way to smartly get the information of which model is enabled or not, I will use the caching system to store the information.

I prefer discord over slack.

I'll come back to you with some questions if needed :)

Thanks again for you amazing work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants