Re: [GENERAL] tgrm index for word_similarity

2017-10-22 Thread Arthur Zakirov
On Sat, Oct 21, 2017 at 10:01:56PM -0700, Igal @ Lucee.org wrote: > > 1) I thought that the whole idea behind indexes on expressions is that the > index would be used in a WHERE clause?  See > https://www.postgresql.org/docs/10/static/indexes-expressional.html - Am I > missing something? > I thin

Re: [GENERAL] tgrm index for word_similarity

2017-10-21 Thread Igal @ Lucee.org
On 10/21/2017 5:01 AM, Arthur Zakirov wrote: PostgreSQL doesn't use index scan with functions within WHERE clause. So you always need to use operators instead. You can try <% operator and pg_trgm.word_similarity_threshold variable: =# SET pg_trgm.word_similarity_threshold TO 0.1; =# SELECT name,

Re: [GENERAL] tgrm index for word_similarity

2017-10-21 Thread Arthur Zakirov
On Thu, Oct 19, 2017 at 04:54:19PM -0700, Igal @ Lucee.org wrote: > > My query at the moment is: > >     SELECT name, popularity >     FROM   temp.items3_v >      ,(values ('some phrase'::text)) consts(input) >     WHERE  true >         and word_similarity(input, name) > 0.01  -- be lenient

Re: [GENERAL] tgrm index for word_similarity

2017-10-20 Thread Igal @ Lucee.org
On 10/19/2017 4:54 PM, Igal @ Lucee.org wrote: I want to use Postgres for a fuzzy auto-suggest search field.  As the user will be typing their search phrase, Postgres will show a list of items that fuzzy-matches what they typed so far, ordered by popularity (ntile(20)) and distance, i.e. 1 - wo

[GENERAL] tgrm index for word_similarity

2017-10-19 Thread Igal @ Lucee.org
Hello, I want to use Postgres for a fuzzy auto-suggest search field.  As the user will be typing their search phrase, Postgres will show a list of items that fuzzy-matches what they typed so far, ordered by popularity (ntile(20)) and distance, i.e. 1 - word_similarity(). I created a Material