Skip to content

Improved docs on map matching.#102

Merged
pluknet merged 1 commit intonginx:mainfrom
nisbet-hubbard:patch-2
Apr 13, 2026
Merged

Improved docs on map matching.#102
pluknet merged 1 commit intonginx:mainfrom
nisbet-hubbard:patch-2

Conversation

@nisbet-hubbard
Copy link
Copy Markdown

@nisbet-hubbard nisbet-hubbard commented Nov 5, 2024

This PR improves the wording regarding map testing to reflect the performance benefits of using exact match over regex.

https://web.archive.org/web/20240908025132/https://forum.nginx.org/read.php?2,214693,214694

@y82
Copy link
Copy Markdown
Collaborator

y82 commented Nov 6, 2024

Hi @nisbet-hubbard,

Thank you for your contribution and for your attention to detail. I still find the existing phrasing — “regular expression match” and “matching variant chosen” — quite clear and consistent with our current terminology. Additionally, we haven’t previously used the term “testing” in this context, while phrases like “strings evaluated/matched” and “regular expressions matched” are more established.

This is just my perspective, and other community members may have different thoughts on this.

@y82 y82 self-assigned this Nov 6, 2024
@nisbet-hubbard
Copy link
Copy Markdown
Author

Thanks! I’ve updated the patch to address these concerns.

What bothers me in the original version is that wording like ‘If the source value matches more than one of the specified variants’ doesn’t make it clear (to people who are not already familiar with the codebase) whether all the variants are actually searched or just the variants up to the first match. So, I’m borrowing a phrase from the docs on the location directive to clarify this point.

@nisbet-hubbard nisbet-hubbard force-pushed the patch-2 branch 2 times, most recently from 24fd4d3 to d05c0e1 Compare November 18, 2024 23:49
@nisbet-hubbard nisbet-hubbard changed the title Improve docs on map testing Improved docs on map matching. Nov 18, 2024
@nisbet-hubbard
Copy link
Copy Markdown
Author

Rebased as per guidelines.

@pluknet
Copy link
Copy Markdown
Collaborator

pluknet commented Jan 10, 2025

In my personal reading of the current wording:
"the first matching variant will be chosen"
already implies that
"the search terminates on the first match".

Further, regarding the patch, I don't like that "the first matching" is used twice, it worsens the wording quality.

@nisbet-hubbard
Copy link
Copy Markdown
Author

Absolutely, and it's because you already know that's what it means.

What I was trying to get across is we understand what the current wording implies on personal reading because we already know what it implies. And we need to stand in the shoes of someone who doesn't.

In any case, here's an alternative edit:

If the source value potentially matches more than one of the specified variants

Would this satisfy everyone?

The search is performed up to the first match.
The search priority is always applied.

While here, simplified description.
Unified wording based on text review from f09e543.
@pluknet
Copy link
Copy Markdown
Collaborator

pluknet commented Apr 10, 2026

Hello,

I've looked once again at the current state.
The text reflects the implementation detail for ngx_hash_find_combined() based search.
So it needs to be updated in other places such as searching server names.
This also need to include the "stream" counterpart.

Regardless, the existing wording looks like it has a logic flaw.
Personally, I read it as if the priority is applied only for the case of multiple search candidates.

Since it's hard to explain in details, and to reduces the number of review round-trips,
I have updated your branch to address all the details (including translations).
Please see if it's good for you. I intend to merge this in a couple days.

@pluknet pluknet requested a review from y82 April 10, 2026 11:50
@pluknet pluknet self-assigned this Apr 10, 2026
@pluknet pluknet merged commit e6fc4e9 into nginx:main Apr 13, 2026
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