Skip to content

Improve IndexConfig derive macro #616

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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

funlennysub
Copy link

@funlennysub funlennysub commented Sep 1, 2024

Pull Request

Related issue

None

What does this PR do?

  • A way to override the index name
  • A way to change pagination settings
  • Minor code improvements

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?

@funlennysub
Copy link
Author

Perhaps if there's no fields with displayed flag, it should default to "*" as meilisearch does, because from my understanding right now it will just set it to an empty array?

@funlennysub funlennysub changed the title Option to override index name with IndexConfig derive Improve IndexConfig derive macro Sep 1, 2024
Comment on lines 29 to 30
#[proc_macro_derive(IndexConfig, attributes(index_config))]
pub fn generate_index_settings(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
Copy link
Contributor

@CommanderStorm CommanderStorm Jun 30, 2025

Choose a reason for hiding this comment

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

(not a maintainer)

Since this change is quite sublte otherwise: could you add a doc comment explaining how the macro can be used?

A testcase would obviously also be nice, but since this was not tested beforehand..

Copy link
Collaborator

@Mubelotix Mubelotix left a comment

Choose a reason for hiding this comment

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

Hello @funlennysub, thank you for your contribution! Giving the ability to change the index name definitely seems useful. However, I don't see what makes max_total_hits any different than all the other settings. If we support max_total_hits, that would leave the door open to every single other setting and I don't want this macro to become a multi-thousand line macro.

Could you just keep the way to set the index name please?

@Mubelotix Mubelotix marked this pull request as draft July 11, 2025 21:39
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.

3 participants