Skip site navigation (1) Skip section navigation (2)

Re: Text Search zero padding

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Richard Greenwood <richard(dot)greenwood(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Text Search zero padding
Date: 2008-02-29 08:06:40
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Thu, 28 Feb 2008, Richard Greenwood wrote:

> I am using text search across multiple columns. Two of the columns
> have values that have zero padding - sort of. The values look like
> R0001234 (1 char followed by 7 digits, zero padded). Users are
> accustom to searching with and without the zero padding (entering
> R0001234 or R1234 should return identical results). This is easy to
> accommodate when parsing user input for a single column, but text
> searching across multiple columns it is harder determine if a
> char/digit group should be padded.
> So far my best idea is to create a tsvector column containing both
> padded and non-padded versions of the value. i.e. put both R1234 and
> R0001234 into the tsvector column. This seems pretty brute force, and
> I am pretty new to text search, so I'd welcome any suggestions.

create your dictionary, which index R0001234 as R0001234 and R1234
Seems, dict_regex is your friend.

> Thanks,
> Rich

Oleg Bartunov, Research Scientist, Head of AstroNet (,
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su,
phone: +007(495)939-16-83, +007(495)939-23-83

In response to


pgsql-general by date

Next:From: Gurjeet SinghDate: 2008-02-29 09:23:05
Subject: Re: LIMIT Question
Previous:From: Scott MarloweDate: 2008-02-29 07:25:13
Subject: Re: WAL Log Size

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group