From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 015CB1FF15E for ; Mon, 15 Sep 2025 16:41:28 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 572D2267DA; Mon, 15 Sep 2025 16:41:33 +0200 (CEST) Message-ID: <26a86759-8d6a-4253-90a1-6a45272058f2@proxmox.com> Date: Mon, 15 Sep 2025 16:41:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Proxmox Datacenter Manager development discussion , Dominik Csapak References: <20250912093034.1606425-1-d.csapak@proxmox.com> Content-Language: en-US From: Thomas Lamprecht In-Reply-To: <20250912093034.1606425-1-d.csapak@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757947283454 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.078 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record TRACKER_ID 0.1 Incorporates a tracking ID number Subject: Re: [pdm-devel] [PATCH datacenter-manager] server: api: resources: make search terms (ascii) case insensitive X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Am 12.09.25 um 11:31 schrieb Dominik Csapak: > by converting both the values and the terms to (ascii) lower case. > > Making the search case insensitive seems more intuitive, since most > searches i could find behave this way (except e.g. in editors) > > Since all values are currently ascii only, and this is faster than > `to_lowercase` using `to_ascii_lowercase` seems better here. But is it really faster as long as the data only contains ascii? Checking the implementation it still does ascii first and only a more elaborate conversion if there's anything left over. Sure, more work than here, but for the data sizes here that range mostly in the tens to at max hundreds of bytes, besides some outlier. So not sure if we should add limitations here, as this also affects simple umlauts or characters with accents, which are quite common. That said, most things we currently match are restricted to ascii, so with a comment that tries to avoid copying this over for something that is not certain to be ascii (like free form description/notes) in the future, I'd be fine with doing it your proposed way. > > Also noticed that some matches can be replaced with the respective > MatchCategory matches, so we don't have to repeat this pattern > everywhere. Great, but might be even better to add some dedicated helpers private to this module for that, like (rather verbose): contains_case_insensitive starts_with_case_insensitive As you still need to pass all arguments explicitly anyway (like e.g. "remote"), so it's not like reusing this gives you any type saftey over a simple helper, while as being proposed it abstracts away the simple thing that happens under the hood, so IMO not a very good kind of abstraction/reuse (but certainly a matter of taste to a degree). Creating a simple trait for the search and implementing it for &str in this module might be an alternative to make it a bit more ergonomic to rust, but not sure if that's worth it (or better), just wanted to throw out the idea. _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel