Re: Text Search zero padding - Mailing list pgsql-general

From Tom Lane
Subject Re: Text Search zero padding
Date
Msg-id 22411.1204262345@sss.pgh.pa.us
Whole thread Raw
In response to Text Search zero padding  ("Richard Greenwood" <richard.greenwood@gmail.com>)
List pgsql-general
"Richard Greenwood" <richard.greenwood@gmail.com> writes:
> 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.

I'm not an expert in tsearch either, but given what you say here,
it seems like the Right Thing is to create a parser or dictionary
that strips those zeroes as being insignificant, so that R0001234 and
R1234 get mapped to the same stored/searchable lexeme.

            regards, tom lane

pgsql-general by date:

Previous
From: "Richard Greenwood"
Date:
Subject: Text Search zero padding
Next
From: "Devi"
Date:
Subject: Re: rule question