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

Added missing distinct param in search parameters overview #3073

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RecreationalMath
Copy link
Contributor

@RecreationalMath RecreationalMath commented Dec 11, 2024

Fixes #3029

Added missing distinct param in search parameters overview table in reference/api/search.mdx file

Things to check:

  1. Should the default value for distinct parameter be null or "" empty string?
  2. Is the description technically correct? -> limit search to return one (most relevant) document per each value of specified attribute

Added missing `distinct` param in search parameters overview table in `reference/api/search.mdx` file

Things to check:
1. Should the default value be `null` string or `""` empty string?
2. If the description is technically correct?

Closes meilisearch#3029
Copy link
Member

@guimachiavelli guimachiavelli left a comment

Choose a reason for hiding this comment

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

Hello, @RecreationalMath! Thanks for the contribution!

A few comments:

  1. The default value of /search's distinct is null, as indicated in the section you're linking to: https://www.meilisearch.com/docs/reference/api/search#distinct-attributes-at-search-time
  2. I'm afraid you have misunderstood what distinct does. distinct tells Meilisearch that all documents sharing the same distinct value are functionally the same document. Imagine a webshop where 5 documents represent the same shirt, but in different colours. You can use distinct so when people search for shirt they don't see the same shirt repeated several times in the search results.

If you need more info, take a look at the distinct search parameter, or the general explanation of distinct attributes.

@RecreationalMath
Copy link
Contributor Author

Thanks for sharing the explanation of distinct attributes.

Option 1: Attribute whose value must be unique in the returned documents
Option 2: Restrict search to unique values of the attribute defined as distinct

@guimachiavelli Let me know which one suits better for the short description?

@guimachiavelli
Copy link
Member

I option 2 might work. What's your opinion? Are you afraid it might be hard to understand?

@RecreationalMath
Copy link
Contributor Author

I think It is comprehensible, especially when you look at it in conjunction with the section dedicated to its explanation on the same page
For the sake of brevity, I had removed two words (underlined below) from my original sentence.
Restrict search to documents with unique values of the attribute defined as distinct.
If you think that makes it more understandable, I can include these two words in the description.

@guimachiavelli
Copy link
Member

I find it hard to pinpoint precisely why, but I do think that the "document with" bit makes the sentence a bit clearer. Let's go with that!

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.

Missing distinct search param in search params overview
2 participants