Renaming matches and _matchesInfo #437
Replies: 8 comments 8 replies
-
Thanks, @dichotommy! To give you some context, I think this field can potentially be deprecated and deleted in the future for a v1.0. Users seem to be using it because of the lack of custom highlighting and cropping behavior that Meilisearch has. We worked on solving a good part of it on v0.27. I really like proposal A. What do you think of |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Another possibility just for the brainstorm is |
Beta Was this translation helpful? Give feedback.
-
Hello, thanks for your different feedback! For the request bodyCurrent name: For the renaming, we think adding a verb like Knowing this, here are the potential candidate
For the response bodyCurrent name:
Before sending any survey, WDYT about this short list? |
Beta Was this translation helpful? Give feedback.
-
Final survey - in the search REQUEST, replace
|
Beta Was this translation helpful? Give feedback.
-
Final survey - in the search RESPONSE, replace
|
Beta Was this translation helpful? Give feedback.
-
Hello, here are the final namings: @gmourier I let you update this spec: meilisearch/specifications#135 😇 |
Beta Was this translation helpful? Give feedback.
-
Specified in meilisearch/specifications#135. Locking the discussion. |
Beta Was this translation helpful? Give feedback.
-
Renaming
matches
andmatchesInfo
Intro
I care a lot about parameter/variable/function names. Partly it's because I'm a perfectionistic writer who loves word puzzles. Finding the perfect combination of words to say as much as possible in as few characters as possible is a tantalizing challenge. Guilty as charged 😈
Mostly, though, it's because I have been a learner of complex software in the past and have been slowed down by poor naming. I believe that descriptive names can save all developers a lot of time because they help us understand at a glance whether we want to learn more about something.
matches
andmatchesInfo
In that regard, I have always thought that
matches
is not an effective parameter name.I go by the following test: can you guess what this parameter does based on the name?
With a name like
matches
, I can understand that it relates to search hits somehow, but not much beyond that. It's really vague.Similar for
_matchesInfo
, the object added to the response inhits
when you make a search usingmatches
: it's clear that it's related tomatches
, but that's basically all.If we don't plan on adding additional functionality to this parameter in the foreseeable future, I think it would be a good idea to give it and the returned object more descriptive names. The goal would be that a reader scrolling down a long list of search parameters could understand basically what this parameter does before committing to reading a lengthy explanation.
A name with an active verb would also make more intuitive sense with the boolean data type, e.g.
locateMatches: true
.Some proposals
Proposal A
matches
->returnMatchesPosition
_matchesInfo
->matchesPosition
Pros
true
Cons
attributesToHighlight
. Of course, "return" could be changed to "get" to save charactersProposal B
matches
->locateMatches
_matchesInfo
->matchesLocation
Pros
Cons
Proposal C
matches
->position
_matchesInfo
->positionInfo
Pros
matches
Cons
Conclusion
I'm not particularly satisfied with any of these proposals (big surprise, the perfectionist isn't satisfied 🙃), but I am curious if anyone shares my feelings about☺️
matches
, or if any of my suggestions seem to be heading in the right direction. Thanks for reading and please let me know what you thinkBeta Was this translation helpful? Give feedback.
All reactions