Re: pg_trgm module: no convertion into Trigrams on one side when comparing

From: "Janek Sendrowski" <janek12(at)web(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_trgm module: no convertion into Trigrams on one side when comparing
Date: 2013-11-14 12:05:48
Message-ID: trinity-b8079889-bd86-480f-8630-7a4911456dfa-1384430748517@3capp-webde-bs23
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Amit,
 
Thanks for your answer.

My issue is that I still need a ranking like the similarity when comparing trigrams.
I'm working on a similarity search, which determindes similiar sentences from my table.

The usual similarity search with Trigrams and a gist bzw. gin index is to slow with my set of rows.

So I've built an Fixed Query Array. I took some sentences as pivots and calculated the distance between them and all my sentences.
Now I can search for similiar sentences by calculating their distance to my pivots and comparing them with the distances I already got.
I noticed that it's a good way to use trigrams as metric distance function.
 
So the issue is that I have to take certain trigrams as pivots and of cource I need to store an exact ranking when comparing.
Your method detect the rows which includes all of the trigrams you are searching for, but I still need a ranking...

something like SELECT similarity('How are your', "{" ho","how","are","re "," hi","wha","hat","at "," a"}"::trgm);
 
I hope you have an idea
 
Janek Sendrowski
 
 
 
 
 
 
 

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2013-11-14 13:44:00 Tuning 9.3 for 32 GB RAM
Previous Message LPlateAndy 2013-11-14 11:13:03 Re: expression index not used within function