Re: Comparing tsvector results

From: Liza Sazonova <liza(at)getpitstop(dot)io>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Comparing tsvector results
Date: 2016-06-16 18:51:03
Message-ID: CAE49Aj6-NBkkhktQry_EcB9vV3YzvGSXfxkrORscxQ4RM9_dWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you!

It seems like this function's not available in PostgreSQL 9.5 that I'm
using
I'm getting: "ERROR: function ​tsvector_to_array(unknown) does not exist".

Do you know of any equivalent function in earlier releases?

I was thinking of casting ts_vector into text, and then splitting the text
using a delimiter; but this seems like a slow solution and I was wondering
if there's anything better.

On Thu, Jun 16, 2016 at 2:38 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Thu, Jun 16, 2016 at 2:21 PM, Liza Sazonova <liza(at)getpitstop(dot)io> wrote:
>
>> Hello,
>>
>> I'm trying to implement a keyword-based search on my database.
>>
>> I have some text input (Say, "The A or B and C with D") and a list of
>> keywords ("B","X","Y"). I want to identify which keywords are present in
>> the text input. I also want to use a thesaurus to process the text input,
>> since the keywords have synonyms (for example, "The A : X").
>>
>> As far as I understand, the only way for me to process text input with a
>> thesaurus would be to use tsvector / tsquery; or at least this is the
>> fastest way.
>> Is it possible to retrieve the tsvector from the text input, then
>> retrieve the tsvector from the keyword list, and identify which words are
>> present in both?
>>
>>
> From its description the tsvector_to_array function sounds like it would
> be helpful here.
>
> ​
> https://www.postgresql.org/docs/9.6/static/functions-textsearch.html#TEXTSEARCH-FUNCTIONS-TABLE
> ​
>
> ​tsvector_to_array(input) -> unnest
> intersect
> tsvector_to_array(keywords) -> unnest
>
> ​David J.​
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-06-16 19:16:08 Re: Comparing tsvector results
Previous Message David G. Johnston 2016-06-16 18:38:56 Re: Comparing tsvector results