From: Alan Hodgson <ahodgson@lists.simkin.ca>
To: pgsql-general@lists.postgresql.org
Subject: Re: Text search lexer's handling of hyphens and negatives
Date: Wed, 16 Oct 2019 08:50:59 -0700
Message-ID: <45772fae97692f848fa102b0ddb92ad0c6d6b5bc.camel@lists.simkin.ca> (raw)
In-Reply-To: <CAPD=2WHyvzOguNw0kU5f=Ri8ek=Lru65nsshGWCyivmifk_pLA@mail.gmail.com>
References: <CAPD=2WFRaQk9LhocKPB-ewX9spRnWJwy=wFm8sm5L0yPqny1vA@mail.gmail.com>
<62ec72bf6b16aa980430e87ae54d6b8091ce8b73.camel@lists.simkin.ca>
<CAPD=2WHyvzOguNw0kU5f=Ri8ek=Lru65nsshGWCyivmifk_pLA@mail.gmail.com>
On Tue, 2019-10-15 at 20:34 -0700, raylu wrote:
> On Tue, Oct 15, 2019 at 3:35 PM Alan Hodgson <ahodgson@lists.simkin.ca
> > 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?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ahodgson@lists.simkin.ca
Subject: Re: Text search lexer's handling of hyphens and negatives
In-Reply-To: <45772fae97692f848fa102b0ddb92ad0c6d6b5bc.camel@lists.simkin.ca>
References: <CAPD=2WFRaQk9LhocKPB-ewX9spRnWJwy=wFm8sm5L0yPqny1vA@mail.gmail.com> <62ec72bf6b16aa980430e87ae54d6b8091ce8b73.camel@lists.simkin.ca> <CAPD=2WHyvzOguNw0kU5f=Ri8ek=Lru65nsshGWCyivmifk_pLA@mail.gmail.com> <45772fae97692f848fa102b0ddb92ad0c6d6b5bc.camel@lists.simkin.ca>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox