Amit Langote
amitl****@gmail*****
2013年 10月 4日 (金) 12:23:24 JST
On Fri, Oct 4, 2013 at 11:25 AM, Fujii Masao <masao****@gmail*****> wrote: > On Fri, Oct 4, 2013 at 9:26 AM, Amit Langote <amitl****@gmail*****> wrote: >> On Fri, Oct 4, 2013 at 3:44 AM, Fujii Masao <masao****@gmail*****> wrote: >>> On Sat, Sep 28, 2013 at 6:16 PM, Beena Emerson <memis****@gmail*****> wrote: >>>> Please find attached the updated patch to rebase against the new HEAD and >>>> also implements the comments I had given before. >>> >>> +PG_FUNCTION_INFO_V1(set_bigm_limit); >>> +Datum set_bigm_limit(PG_FUNCTION_ARGS); >>> + >>> +PG_FUNCTION_INFO_V1(show_bigm_limit); >>> +Datum show_bigm_limit(PG_FUNCTION_ARGS); >>> >>> I think that it's better to treat the similarity limit as a custom GUC variable >>> rather than implementing special functions like the above. If we do that, >>> we can change and show the value of the similarity limit as follows. Thought? >>> >>> SET pg_bigm.similarity_limit TO 0.001; >>> SHOW pg_bigm.similarity_limit; >>> >> >> I think it looks better. >> >>> +/* GIN does not support ordering operators, wait for GiST support... >>> + >>> +CREATE FUNCTION bigm_similarity_dist(text,text) >>> +RETURNS float4 >>> +AS 'MODULE_PATHNAME' >>> +LANGUAGE C STRICT IMMUTABLE; >>> >>> So we should not include bigm_similarity_dist() at all? >>> >> >> It could be added I think. I guess I forgot to remove the comment >> around the function itself. So, > > Is it really worth adding that even if pg_bigm supports only GIN index? > On second thought, I also think just adding bigm_similarity_dist() function would not serve any purpose as such. Since, GIN does not support ordering operators, we can not add it in any useful way for now. Looking at pg_trgm's distance operator ALTER OPERATOR FAMILY gist_trgm_ops USING gist ADD OPERATOR 2 <-> (text, text) FOR ORDER BY pg_catalog.float_ops, Above can not be done with "USING gin". It gives following; ERROR: access method "gin" does not support ordering operators > The pg_trgm document says > > ---------- > SELECT t, t <-> 'word' AS dist > FROM test_trgm > ORDER BY dist LIMIT 10; > > This can be implemented quite efficiently by GiST indexes, but not > by GIN indexes. > ---------- > > Is this related to the comment that you added into the patch? > Yes. But, after these considerations, we should not let bigm_similarity_dist() in just yet. Thoughts? -- Amit