Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZoZg6-0005oM-Dw for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2015 16:22:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZoZg5-0004zF-KI for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2015 16:22:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZoZfT-0004J1-Mw for pgsql-bugs@postgresql.org; Tue, 20 Oct 2015 16:21:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZoZfR-0002z2-77 for pgsql-bugs@postgresql.org; Tue, 20 Oct 2015 16:21:42 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t9KGLbwc002531; Tue, 20 Oct 2015 12:21:38 -0400 From: Tom Lane To: vtamara@pasosdeJesus.org cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13690: Full Text Search with spanish dictionary cannot find some words In-reply-to: <20151020110857.3017.63066@wrigleys.postgresql.org> References: <20151020110857.3017.63066@wrigleys.postgresql.org> Comments: In-reply-to vtamara@pasosdeJesus.org message dated "Tue, 20 Oct 2015 11:08:57 -0000" Date: Tue, 20 Oct 2015 09:21:38 -0700 Message-ID: <33158.1445358098@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org vtamara@pasosdeJesus.org writes: > The following search in english succeeds (returns 1): > SELECT COUNT(*) FROM cat > WHERE to_tsvector('english', nombre) @@ to_tsquery('english', > 'politi:*' > ); > But fails using the spanish dictionary (returns 0): > SELECT COUNT(*) FROM cat > WHERE to_tsvector('spanish', nombre) @@ to_tsquery('spanish', > 'politi:*' > ); This is because you didn't adjust the wildcard search pattern for the different stemming rules used in Spanish. Look at the to_tsvector and to_tsquery results: regression=# SELECT to_tsvector('english', nombre) , to_tsquery('english','politi:*') from cat; to_tsvector | to_tsquery -------------------------+------------ 'politica':1 'social':2 | 'politi':* (1 row) regression=# SELECT to_tsvector('spanish', nombre) , to_tsquery('spanish','politi:*') from cat; to_tsvector | to_tsquery ----------------------+------------ 'polit':1 'social':2 | 'politi':* (1 row) I don't know enough Spanish to follow the reasoning for stemming "politica" as "polit" rather than something else; but I do see that "politi" is not reduced to "polit", which is fairly reasonable since that's not a word. "politi:*" will match anything whose stemmed version starts with "politi", but that's too long ... regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs