partial text search

From: avpro avpro <avprowebeden(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: partial text search
Date: 2015-01-08 15:45:09
Message-ID: CAAQdDnkk3=9UZ55Wp_JUXX0JfXHy2O-L=ehsxmeUL-4r1g6L1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

> Hi,
>
> my task is to search partial text in the fields mentioned in query.
Basically I have to tables t1 and t2 and I need to search in t1 all the
codes returned by a query from t2. In t1 the values could be identical as
in t2 or could be partial. For example.
>
> T1:
>
> Description
>
> 190201 – is not our student
>
> 190202 – is …
>
> 190202
>
> T2:
>
> Description
>
> 190202
>
> My query should return for item “190202” from t2 all the columns where
this text is found in t1, but not necessary identical. The result will be
the last two rows from T1:
>
> 190202 – is …
>
> 190202
>
> I have tried something similar with the following:
>
> SELECT description FROM t1 WHERE description LIKE '195004'
>
> Instead of ‘195004’ I would like to put one by one all elements returned
by another query:
>
> SELECT description FROM t2
>
> Any idea how to do that?
>
> I was looking on the partial text search with tsvector and tsquery, but
I’m not sure how to put the queries should be something like this:
>
> SELECT to_tsvector(t1.description) @@ to_tsquery(SELECT description FROM
t2);
>
> Thank you.

Browse pgsql-general by date

  From Date Subject
Next Message Beena Emerson 2015-01-08 16:53:30 Re: Inconsistent bgworker behaviour
Previous Message deans 2015-01-08 12:15:40 Re: BDR Error restarted

Browse pgsql-novice by date

  From Date Subject
Next Message James David Smith 2015-01-09 11:05:09 Upgrade Ubuntu - PostgresSQL is ok?
Previous Message Daniel Staal 2015-01-07 20:31:20 Re: How can I prevent duplicate inserts by multiple concurrent threads ?