Received: from malur.postgresql.org ([217.196.149.56])
by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256)
(Exim 4.89)
(envelope-from )
id 1iKlZx-0004lq-9L
for pgsql-general@arkaria.postgresql.org; Wed, 16 Oct 2019 15:51:13 +0000
Received: from localhost ([127.0.0.1] helo=malur.postgresql.org)
by malur.postgresql.org with esmtp (Exim 4.89)
(envelope-from )
id 1iKlZw-0002sQ-0w
for pgsql-general@arkaria.postgresql.org; Wed, 16 Oct 2019 15:51:12 +0000
Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29])
by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256)
(Exim 4.89)
(envelope-from )
id 1iKlZv-0002sJ-LX
for pgsql-general@lists.postgresql.org; Wed, 16 Oct 2019 15:51:11 +0000
Received: from athena.simkin.ca ([2607:f040:1001:2::ff:2])
by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256)
(Exim 4.89)
(envelope-from )
id 1iKlZr-00028K-2B
for pgsql-general@lists.postgresql.org; Wed, 16 Oct 2019 15:51:11 +0000
Received: from skynet.simkin.ca (node-1w7jr9sr73xr28w39enna6tzw.ipv6.telus.net
[IPv6:2001:569:bce0:6400:468a:5bff:fef0:d35c])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384)
(No client certificate requested)
by athena.simkin.ca (Postfix) with ESMTPSA id 77104DC696E8
for ;
Wed, 16 Oct 2019 08:51:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.simkin.ca;
s=athena; t=1571241063;
bh=cJykdmtxpWLoKWVRVfG0SHfqb2T7xAEjsf05N59ThJU=;
h=Subject:From:To:Date:From:To:Subject:Date:Reply-To;
b=tSQtgOH9uazweKox76w79yk3SNC45x6wr93bFE1EiU1BsKtWZ/XMSxYASr+fY+3Bg
TBXFSLEQ+CTcaLh4kUXrnEWcs8mD4tR3fvyLKFnDUZUAArsk4X5FEUIb7CX69Mf23q
z5JT7yR/SDILKiTG6UHVS5nuxd2gQ0yErh6tX66JqFbhetpKffVqLisNfWPW2S5T4w
HslKkGjAXx+KylutEUzKHlbVgo86z4XZfEVB39JNDMYJJ5i51Q+atr0rpICSKTLBli
VUdLixheoJqJEX/zF2d0luvmZGn+hM5X7Ynu4EyK1ruXiaQNJ2TNKdql7vbphjZyqe
0krmFnm3dpGeQ==
Received: from skynet.simkin.ca (skynet.simkin.ca [IPv6:::1])
by skynet.simkin.ca (Postfix) with ESMTP id 1EE1821A5CB3A
for ;
Wed, 16 Oct 2019 08:50:59 -0700 (PDT)
Message-ID: <45772fae97692f848fa102b0ddb92ad0c6d6b5bc.camel@lists.simkin.ca>
Subject: Re: Text search lexer's handling of hyphens and negatives
From: Alan Hodgson
To: pgsql-general@lists.postgresql.org
Date: Wed, 16 Oct 2019 08:50:59 -0700
In-Reply-To:
References:
<62ec72bf6b16aa980430e87ae54d6b8091ce8b73.camel@lists.simkin.ca>
Content-Type: multipart/alternative; boundary="=-7Cnqx5GDWc77hGRbTlK9"
User-Agent: Evolution 3.30.5
MIME-Version: 1.0
List-Id:
List-Help:
List-Subscribe:
List-Post:
List-Owner:
List-Archive:
Precedence: bulk
--=-7Cnqx5GDWc77hGRbTlK9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
On Tue, 2019-10-15 at 20:34 -0700, raylu wrote:
> On Tue, Oct 15, 2019 at 3:35 PM Alan Hodgson > wrote:
> > My company has found the pg_trm extension to be more useful for
> > partial text searches than the full text functions. I don't know
> > specifically how it might help with your hyphens but it would be
> > worth testing. The docs actually suggest using them in conjunction
> > in some cases.
>
> We actually do use pg_trgm already for the names/titles of
> things.Indexing the content with a trigram index and then
> doingLOWER(content) LIKE '%789-xyz%' would certainly work, but1. we'd
> have to do a little bit of finagling if we wanted to match onword
> boundaries (don't match '6789-xyza' in the above example)2. trigram
> indexes are pretty huge for long documents, which is why wecurrently
> only use them for names/titles
> We may give up and just use pg_trgm for contents if nothing else
> worksout but it feels like the text search lexer is _so_ close to what
> wewant.
Maybe you could have a trigger pull out those specific hypenated
references into a separate column when the document is added or updated,
and store/index those separately?
--=-7Cnqx5GDWc77hGRbTlK9
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
On Tue, 2019-10-15 at 20:34 -0700, raylu wrote:
On Tue, Oct 15, 2019 at 3:35 PM Alan Hodgson <
<=
a href=3D"mailto:ahodgson@lists.simkin.ca">ahodgson@lists.simkin.ca
> wrote:
My company has=
found the pg_trm extension to be more useful for partial text searches tha=
n the full text functions. I don't know specifically how it might help with=
your hyphens but it would be worth testing. The docs actually suggest usin=
g them in conjunction in some cases.
=
We actually do use pg_trgm already for the names/titles of things.
Indexing the content with a trigram index and then doingLOWER(=
content) LIKE '%789-xyz%' would certainly work, but
1. we'd have =
to do a little bit of finagling if we wanted to match on
word bou=
ndaries (don't match '6789-xyza' in the above example)
2. trigram=
indexes are pretty huge for long documents, which is why we
curr=
ently only use them for names/titles
We may give u=
p and just use pg_trgm for contents if nothing else works
out but=
it feels like the text search lexer is _so_ close to what we
wan=
t.
Maybe you could hav=
e a trigger pull out those specific hypenated references into a separate co=
lumn when the document is added or updated, and store/index those separatel=
y?
--=-7Cnqx5GDWc77hGRbTlK9--