Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8qok-0007YJ-CZ for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Dec 2022 22:47:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p8qoh-0005wl-Qk for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Dec 2022 22:47:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8qoh-0005wb-HM for pgsql-hackers@lists.postgresql.org; Fri, 23 Dec 2022 22:47:03 +0000 Received: from sid.nimrod.no ([2001:8c0:9340:1::2]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8qod-0007lJ-Oz for pgsql-hackers@lists.postgresql.org; Fri, 23 Dec 2022 22:47:03 +0000 Received: from sid.nimrod.no (sid.nimrod.no [195.139.160.2]) by sid.nimrod.no (8.14.7/8.14.7) with ESMTP id 2BNLiQu2015759; Fri, 23 Dec 2022 22:44:27 +0100 DKIM-Filter: OpenDKIM Filter v2.11.0 sid.nimrod.no 2BNLiQu2015759 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nimrod.no; s=n20181209; t=1671831867; bh=d6TqZloPpdHWAAJMmhMZRZfkFGITmXoLuwEQqjHovlM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=tdCysph1f2QBuYqlMrz8NxnZgZmrToSsg+4qAq+2QGv6jAcG7I8seqXNk3GylUwlE mnPMSVdZgnEBWXzVf2gJezQ1pUGUPsirgdaOLxUteSYagOltfqCfaaSV4cLeWzcbu2 1+1N+CX1i95ylk9KO2rFnzPotNqTp4Td0PvhrIAw2CnIYdvh3dMgjzOvsetLyGDJQv oxE2jtdBtfS5iX6QxBwBsmsA8945pAkbJSo9Q/YnsuDZP/oiK+o4Qnh53ApHkn9cUY vvK/TQfxKXBFCF8H/SvTPGCHsc9x0EYFjrLFN9lT0488REf1JHmp2Xfxa754eVDSAA ov3RAjykPbIxg== From: Dag Lem To: Alvaro Herrera Cc: PostgreSQL Hackers Subject: Re: daitch_mokotoff module Organization: Nimrod References: <20221223130747.ymxv7gbj6kr7vwrh@alvherre.pgsql> Date: Fri, 23 Dec 2022 22:44:26 +0100 In-Reply-To: <20221223130747.ymxv7gbj6kr7vwrh@alvherre.pgsql> (Alvaro Herrera's message of "Fri, 23 Dec 2022 14:07:47 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > I wonder why do you have it return the multiple alternative codes as a > space-separated string. Maybe an array would be more appropriate. Even > on your documented example use, the first thing you do is split it on > spaces. In the example, the *input* is split on whitespace, the returned soundex codes are not. The splitting of the input is done in order to code each word separately. One of the stated rules of the Daitch-Mokotoff Soundex Coding is that "When a name consists of more than one word, it is coded as if one word", and this may not always be desired. See https://www.avotaynu.com/soundex.htm or https://www.jewishgen.org/InfoFiles/soundex.html for the rules. The intended use for the Daitch-Mokotoff soundex, as for any other soundex algorithm, is to index names (or words) on some representation of sound, so that alike sounding names with different spellings will match. In PostgreSQL, the Daitch-Mokotoff Soundex and Full Text Search makes for a powerful combination to match alike sounding names. Full Text Search (as any other free text search engine) works with documents, and thus the Daitch-Mokotoff Soundex implementation produces documents (words separated by space). As stated in the documentation: "Any alternative soundex codes are separated by space, which makes the returned text suited for use in Full Text Search". Best regards, Dag Lem