Re: [HACKERS] request a new feature in fuzzystrmatch

2013-07-03 Thread Liming Hu
On Sat, Jun 29, 2013 at 7:55 PM, Michael Paquier
michael.paqu...@gmail.com wrote:
 On Sun, Jun 30, 2013 at 5:37 AM, Joe Conway m...@joeconway.com wrote:
 Actually, given that this change will create version 1.1 of the
 extension, I believe the 1.0 versions of the sql scripts should
 probably be removed entirely. Can someone with more knowledge of the
 extension facility comment on that?
 When upgrading this extension here is what you should do:
 - Remove fuzzystrmatch--1.0.sql
 - Add fuzzystrmatch--1.1.sql with the new definitions
 - Add fuzzystrmatch--1.0--1.1.sql to be able to perform an upgrade
 between 1.0 and 1.1
 - Let fuzzystrmatch--unpackaged--1.0.sql as-is

Hi Michael,

Thanks. What should be included in  fuzzystrmatch--1.0--1.1.sql for the upgrade?
Liming

 Then by having a quick glance at the patch you sent...
 - fuzzystrmatch--unpackaged--1.0.sql is renamed internally to 1.1.sql
 - fuzzystrmatch--1.0.sql remains, and is renamed to 1.1 internally
 - fuzzystrmatch--1.0--1.1.sql is not provided

 Regards,
 --
 Michael



--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-07-03 Thread Liming Hu
On Mon, Jul 1, 2013 at 8:09 AM, Alvaro Herrera alvhe...@2ndquadrant.com wrote:
 Joe Conway escribió:

 Actually, given that this change will create version 1.1 of the
 extension, I believe the 1.0 versions of the sql scripts should
 probably be removed entirely. Can someone with more knowledge of the
 extension facility comment on that?

 Besides what Michael said, another thing is that you need to ensure that
 if the functions are run with the 1.0 definitions, they don't crash
 (i.e. you need to check the number of arguments actually passed to
 function(s), and ensure no changes are made to the types of previously
 existing arguments).  You can test this by installing the 1.0 version in
 a 9.3 database, then pg_upgrade, and test the functions without running
 the ALTER EXTENSION UPGRADE.

 --
 Álvaro Herrerahttp://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services
Hi Alvaro,

I do not have a 9.3 environment. I did not change any previous existing code.
Can anybody help me on the upgrade?

Thanks,

Liming


--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-06-29 Thread Liming Hu

On 6/29/2013 1:37 PM, Joe Conway wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/25/2013 01:37 PM, Liming Hu wrote:

please remove dameraulevenshteinnocompatible related stuff, I
just followed the template you created.
dameraulevenshteinnocompatible was used in my first testing.
diff -cNr
/opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql



diff -cNr
/opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql

Actually, given that this change will create version 1.1 of the
extension, I believe the 1.0 versions of the sql scripts should
probably be removed entirely. Can someone with more knowledge of the
extension facility comment on that?

Joe

Thanks. It is my first contribution to Postgresql community.

LIming


- -- 
Joe Conway

credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting,  24x7 Support
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJRz0V5AAoJEDfy90M199hl3sgP/Ai51I56A7luUhRFt2s3eo0p
HWiuxsWU2tXwoGmvYFtSze80mpfBfCGpBrD+uhh2PLZlFt6uS21wpYaezr1Y9wAM
astvWAOXVOg/AUlb5lyoAze5CL3kpRVX7EvUPGrzb6RMK3VfIckRdIoqwh8/Ko/C
j1ECEcWMHsRDUUDs+kU/mXAyRKpnC+VdSwOAU/k3J7Q0KpSvCZ4R+codinR29Ub4
L4W30436IKOr+BktorFc24FYRpVVG2llMPtWUhgKb1MfW5d+NRqID0gTIF4a9TJr
yaEBmmT1eupdje4pwY3R+xDGroCj3AAx7PAfW+CRMrsYvEFVy945l2lbSjvqDlDy
lpFsWWepYNdQhZBKP0Au986aqTKmoKgFoyWV/Yi7BfLx7Gh70Wk8OPcDKuUIdHou
UNfMouAUxGW9ZHZRmDSaYncTnLEcEJS11akddoIKDXCbdTVAQXFGLNqv1pp0KN+J
xU1eOrh+oQVwTayZH+S2Xa8+AT+g9wLH5zynJozDSRitdLIGdN1zzUVVXdO1Nx2i
2anxXdoW4DB+x+G8ea2Wmxfsw3MMS8Ck10VqhN6JMojDP0rczA6+EFrZcBlsWlWx
LX4iPTroUGZ318IC+A2CXci0uXs7+2l2zrescpEdqrqcTwTJHpGFbRbYniGBFgXW
6LeSPHhRDQUykXMvEU9I
=xeVQ
-END PGP SIGNATURE-




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-06-25 Thread Liming Hu
On Mon, Jun 24, 2013 at 6:02 PM, Joe Conway m...@joeconway.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 06/14/2013 12:08 PM, Liming Hu wrote:
 I have implemented the code according to Joe's
 suggestion, and put the code at:
 https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1



 Please submit a proper patch so it can be seen on our mailing list
 archives.

 Hi Alvaro,

 I am kind of new to the Postgresql hacker community, Can
 you please help me on submit the patch?

 I have not done much in the way of real review yet, but here at least
 is a context diff against git master.

 Joe

Hi Joe,

Thanks a lot.

please remove dameraulevenshteinnocompatible related stuff, I just
followed the template you created.
dameraulevenshteinnocompatible was used in my first testing.

diff -cNr /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
fuzzystrmatch/fuzzystrmatch--1.0.sql
*** /opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--1.0.sql
2012-02-25 20:24:23.0 -0600
--- fuzzystrmatch/fuzzystrmatch--1.0.sql 2013-06-11 04:09:01.0 -0500
CREATE FUNCTION dameraulevenshteinnocompatible
(text,text,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_with_costs_noncompatible'
+ LANGUAGE C IMMUTABLE STRICT;


please remove dameraulevenshteinnocompatible related stuff, I just
followed the template you created.
dameraulevenshteinnocompatible was used in my first testing.

diff -cNr 
/opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
*** 
/opt/src/pgsql-git/master/contrib/fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql
2012-02-25 20:24:23.0 -0600
--- fuzzystrmatch/fuzzystrmatch--unpackaged--1.0.sql 2013-06-11
04:09:01.0 -0500

+ ALTER EXTENSION fuzzystrmatch ADD function
dameraulevenshteinnoncompatible(text,text,integer,integer,integer,integer);

+CREATE FUNCTION dameraulevenshtein_less_equal_noncompatible
(text,text,int,int,int,int,int) RETURNS int
+ AS 'MODULE_PATHNAME','dameraulevenshtein_less_equal_with_costs_noncompatible'
+ LANGUAGE C IMMUTABLE STRICT;


I updated:

https://github.com/liminghu/fuzzystrmatch/blob/fuzzystrmatchv1.1/fuzzystrmatch--1.0.sql

https://github.com/liminghu/fuzzystrmatch/blob/fuzzystrmatchv1.1/fuzzystrmatch--unpackaged--1.0.sql

correspondingly.

Sorry about that.

Thanks and nice day.

Liming



 - --
 Joe Conway
 credativ LLC: http://www.credativ.us
 Linux, PostgreSQL, and general Open Source
 Training, Service, Consulting,  24x7 Support
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.12 (GNU/Linux)
 Comment: Using GnuPG with undefined - http://www.enigmail.net/

 iQIcBAEBAgAGBQJRyOw2AAoJEDfy90M199hlFhEP/2o/d08Fq4CHA9iI05PxDwQM
 AHF6PWS5gJToNLtiTevyEamWyzlULjX3yJ9gTAhxc+ltxE9Xuf3/bfMcJQSbJ5c9
 6GSH7CWpaY1DpfAwvYiwTJ9EPBZ11u8VZaMrb1VU2DS8rioOOL3llzpk+D6/1no5
 y327vlH1aOuqk3Hwu0c/WN8RAcf1HLbhafph2KruUfr/ba3uILBQZtzpyK4uCDew
 OJA+cktXHv3ho7w4N//xVQs3sZ/EoLahOt/y4syd3dN+Cq/8kj/uJaVgT2QY8rDQ
 HIBpYvm+b3DsYpjw2qrSVBriIupF2a0UPkLfC5cu3om8VvBilShydE6uTI+f+55p
 a12NuzepwgDnpZ1jOZkkmnBslpfoZI9TEo1UDeZ8x/TSZDW72FhwRtWq9kO9CFIK
 cJvG9B9E5zhyZx9V1C2S0qpvIJAj/Gns4ymvYU1lm5UUnpPSpTQoUK8ybrfnHoTE
 B0DEVjqxbrk9SSJ5LI3KojAaSMUIQDcjMQFCsghR1s5/yRhpZ7xEPvcL63ARwDcv
 ZeeL6r5G+nmKAfRAjGbmWi/Y1ANI0ucO5XxnfhSDb+TCQow4U6IgNvkYjN1hTNEI
 //9mQHDHi5qsuGcRcgvFLLeR4eVSGewseYLOR9XELMYTam4IUClwPr6WHuMqE/aE
 jvMZafqZ/1EhQ2SeqCo4
 =wcGM
 -END PGP SIGNATURE-



--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-06-15 Thread Liming Hu

On 6/15/2013 9:51 PM, Josh Berkus wrote:

Liming,

I've added your proposal in to the commitfest so that you can get a
review this commitfest.  However, you need to generate a context diff
and submit it to this mailing list for it to really get reviewed.
That's a requirement.


Hi Josh,

Thanks. Where can I see the proposal? Thanks.

Liming


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-06-14 Thread Liming Hu
On Tue, Jun 11, 2013 at 3:19 PM, Liming Hu dawnin...@gmail.com wrote:
 On Tue, Jun 11, 2013 at 2:56 PM, Joe Conway m...@joeconway.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 06/11/2013 02:23 PM, Liming Hu wrote:
 On Tue, Jun 11, 2013 at 1:57 PM, Alvaro Herrera
 alvhe...@2ndquadrant.com wrote:
 Liming Hu escribió:

 I have implemented the code according to Joe's suggestion, and
 put the code at:
 https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1



 Please submit a proper patch so it can be seen on our mailing list
 archives.

 Hi Alvaro,

 I am kind of new to the Postgresql hacker community, Can you
 please help me on submit the patch?

 Hi Liming,

 I might be able to help, but it will be at least a couple of days
 before I have the time to look at this,

 Joe


 ok, thanks, I will wait.
Hi Joe,

Do you have some time in the weekend to help me submit the patch?
Thanks,

Liming

 Liming
 - --
 Joe Conway
 credativ LLC: http://www.credativ.us
 Linux, PostgreSQL, and general Open Source
 Training, Service, Consulting,  24x7 Support
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.12 (GNU/Linux)
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBAgAGBQJRt50oAAoJEDfy90M199hliukP/A8IZf7L0DcYWG/jZUttTg0M
 yWpCz1KHZ7fAGqeJ5ddzuSx5CMjsmt2zYQ+0EfLX1ftoSxIHaFpSC49GgJHUdAoq
 TSOOC1rfkfmNJG98WfUPH14Flq4eEl9reUZDXXi3jqol+npJdAQaEt9EM5y0qkcB
 pDCy9iMaYdjYNV6RXFOBNI+7Up43oULbMLhWwwFnGX9AgCLk8SGRZHnfT1zOaXYE
 bW/Dl9TIu058ENZqFFLIfjxqngE/Y61SOaLRAxEkbO7HAFkuwgQwnIayrasR29F+
 GX4+HRcsd0jrcF858Dm4E+YAffI2quOR2HgZTGQj6jTNtRpb16+EI+X1vrYI3AH8
 5tf3exq9FDL/02zlCpKm8+uXksaLzffQXlbQPw8uDlpk+ThD0uo2990/TC6QYgXO
 o2vCu+nkWdTc2AUk4NkoVFwXaaFLZ+M8U+swRHNAShqH7VQVx8rRwubsRJ1msT3i
 nC8BFyMsBzOmsKNwO0IM6ZcsJXaIpmMCUshF8cGDfgpsWUQ/wzovzopb+PSiEKQB
 X45hWYtiK3tIvo0f9gvEWzRJ4+O8tmmIZzzWz127yBdugV0xjsEHnDihpjkeMPJx
 WHs5ViN62u62r34UCtX1oiClCC+FYR0f//alh48VlXWzP7NkFt4dcKOD6ZCzSOeQ
 udKM0QF2TNbUebj9QIpq
 =W6Oy
 -END PGP SIGNATURE-



 --
 Liming Hu
 cell: (435)-512-4190
 Seattle Washington



--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-06-11 Thread Liming Hu
On Sat, May 18, 2013 at 6:38 PM, David Fetter da...@fetter.org wrote:
 On Fri, May 17, 2013 at 05:50:38PM +0200, Cédric Villemain wrote:
 Hello Liming,

   Sounds interesting. How can we build this over our current
   implementation, or do we need to build it from scratch?
  
   I know how to write the code, but just need approval of accepting into
   the new version.
 
  Well, acceptance depends largely on the implementation and actual
  benefit statistics. I would suggest implementing a basic version and
  then demonstrating its potential benefits here. It will lead to
  clearer ideas for us and lead to improvements in the implementation.

 You can have a look at this page:
 http://wiki.postgresql.org/wiki/Submitting_a_Patch

 Also very important to look at for patch implementation and
 communication:

 http://wiki.postgresql.org/wiki/Working_with_Git

 Cheers,
 David (wondering whether we should provide specific instructions for
 github, bitbucket, etc.).

I have implemented the code according to Joe's suggestion, and put the code at:
https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1

Thanks,

Liming
 --
 David Fetter da...@fetter.org http://fetter.org/
 Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
 Skype: davidfetter  XMPP: david.fet...@gmail.com
 iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

 Remember to vote!
 Consider donating to Postgres: http://www.postgresql.org/about/donate



--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-06-11 Thread Liming Hu
On Tue, Jun 11, 2013 at 1:57 PM, Alvaro Herrera
alvhe...@2ndquadrant.com wrote:
 Liming Hu escribió:

 I have implemented the code according to Joe's suggestion, and put the code 
 at:
 https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1

 Please submit a proper patch so it can be seen on our mailing list
 archives.

Hi Alvaro,

I am kind of new to the Postgresql hacker community, Can you please
help me on submit the
patch?

Thanks,

Liming
 --
 Álvaro Herrerahttp://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services



--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-06-11 Thread Liming Hu
On Tue, Jun 11, 2013 at 2:56 PM, Joe Conway m...@joeconway.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 06/11/2013 02:23 PM, Liming Hu wrote:
 On Tue, Jun 11, 2013 at 1:57 PM, Alvaro Herrera
 alvhe...@2ndquadrant.com wrote:
 Liming Hu escribió:

 I have implemented the code according to Joe's suggestion, and
 put the code at:
 https://github.com/liminghu/fuzzystrmatch/tree/fuzzystrmatchv1.1



 Please submit a proper patch so it can be seen on our mailing list
 archives.

 Hi Alvaro,

 I am kind of new to the Postgresql hacker community, Can you
 please help me on submit the patch?

 Hi Liming,

 I might be able to help, but it will be at least a couple of days
 before I have the time to look at this,

 Joe


ok, thanks, I will wait.

Liming
 - --
 Joe Conway
 credativ LLC: http://www.credativ.us
 Linux, PostgreSQL, and general Open Source
 Training, Service, Consulting,  24x7 Support
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.12 (GNU/Linux)
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBAgAGBQJRt50oAAoJEDfy90M199hliukP/A8IZf7L0DcYWG/jZUttTg0M
 yWpCz1KHZ7fAGqeJ5ddzuSx5CMjsmt2zYQ+0EfLX1ftoSxIHaFpSC49GgJHUdAoq
 TSOOC1rfkfmNJG98WfUPH14Flq4eEl9reUZDXXi3jqol+npJdAQaEt9EM5y0qkcB
 pDCy9iMaYdjYNV6RXFOBNI+7Up43oULbMLhWwwFnGX9AgCLk8SGRZHnfT1zOaXYE
 bW/Dl9TIu058ENZqFFLIfjxqngE/Y61SOaLRAxEkbO7HAFkuwgQwnIayrasR29F+
 GX4+HRcsd0jrcF858Dm4E+YAffI2quOR2HgZTGQj6jTNtRpb16+EI+X1vrYI3AH8
 5tf3exq9FDL/02zlCpKm8+uXksaLzffQXlbQPw8uDlpk+ThD0uo2990/TC6QYgXO
 o2vCu+nkWdTc2AUk4NkoVFwXaaFLZ+M8U+swRHNAShqH7VQVx8rRwubsRJ1msT3i
 nC8BFyMsBzOmsKNwO0IM6ZcsJXaIpmMCUshF8cGDfgpsWUQ/wzovzopb+PSiEKQB
 X45hWYtiK3tIvo0f9gvEWzRJ4+O8tmmIZzzWz127yBdugV0xjsEHnDihpjkeMPJx
 WHs5ViN62u62r34UCtX1oiClCC+FYR0f//alh48VlXWzP7NkFt4dcKOD6ZCzSOeQ
 udKM0QF2TNbUebj9QIpq
 =W6Oy
 -END PGP SIGNATURE-



--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-18 Thread Liming Hu
On Fri, May 17, 2013 at 11:13 PM, Atri Sharma atri.j...@gmail.com wrote:


 Sent from my iPad

 On 18-May-2013, at 11:23, Liming Hu dawnin...@gmail.com wrote:

 On Fri, May 17, 2013 at 10:21 PM, Atri Sharma atri.j...@gmail.com wrote:


 Sent from my iPad

 On 18-May-2013, at 10:41, Liming Hu dawnin...@gmail.com wrote:

 On Fri, May 17, 2013 at 9:39 PM, Atri Sharma atri.j...@gmail.com wrote:


 Sent from my iPad

 On 18-May-2013, at 10:00, Liming Hu dawnin...@gmail.com wrote:

 On 5/17/2013 9:10 PM, Atri Sharma wrote:
 On Sat, May 18, 2013 at 9:27 AM, Liming Hu dawnin...@gmail.com wrote:
 On 5/17/2013 12:39 PM, Liming Hu wrote:
 On Fri, May 17, 2013 at 12:06 PM, Josh Berkus j...@agliodbs.com 
 wrote:
 Can we add Levenshtein-Damerau edit distance since it is used in
 spelling checker
 instead of levenshtein edit distance?
 Patches welcome!  You, too, can be a PostgreSQL contributor.

 However, you will need to preserve the ability of users to use the 
 old
 levenshtien algorithm as well, for backwards-compatibility.  
 Shouldn't
 be hard, just add a new function called levenshtiend().
 I am working on it, I will make it this weekend project.

 I have done that. and put the code at github:
 https://github.com/liminghu/fuzzystrmatch

 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 sudo cp fuzzystrmatch.so
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 sudo /etc/init.d/postgresql restart

 * Restarting PostgreSQL 9.1 database server

  [ OK ]


 select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
 CREATE EXTENSION fuzzystrmatch;

 ** Error **

 ERROR: could not load library
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so:
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
 damerau_levenshtein_internal_noncompatible

 Any one can help me on this? Thanks.
 The system is not able to find the required library, and I dont think
 using cp to place the library is a very good idea.Did you run Make
 Install after you added your work in the Makefile?

 I did not run make install. I am running a stable postgresql in my 
 laptop, I do not
 want to reinstall everything, just want to try this contribution.  I am 
 afraid
 reinstall it will destroy my configurations, and databases, just do not 
 want to mess up.
 did you see any thing wrong:
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
 https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
 https://github.com/liminghu/fuzzystrmatch/blob/master/



 You need not reinstall your entire database for installing/re installing 
 an extension.Running make install from the extension's directory(after 
 placing it in /contrib of a postgres database source directory) will 
 install the extension in your current database without breaking anything.

 You mean:
 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 make install
 ?

 Yes,although,I would run make clean before running make install,just for 
 ensuring that all runs well.

 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 sudo make clean
 rm -f fuzzystrmatch.so   libfuzzystrmatch.a
 rm -f fuzzystrmatch.o dmetaphone.o
 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 sudo make install
 gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
 -Wdeclaration-after-statement -Wendif-labels -Wformat-security
 -fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
 -I../../src/include -D_GNU_SOURCE   -c -o fuzzystrmatch.o
 fuzzystrmatch.c
 In file included from fuzzystrmatch.c:250:0:
 dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
 dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
 [-Wunused-variable]
 dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
 [-Wunused-variable]
 In file included from fuzzystrmatch.c:253:0:
 dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
 dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
 [-Wunused-variable]
 dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
 [-Wunused-variable]
 dameraulevenshtein.c: In function 
 ‘dameraulevenshtein_with_costs_noncompatible’:
 dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
 declarations and code [-Wdeclaration-after-statement]
 dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
 declarations and code [-Wdeclaration-after-statement]
 fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
 fuzzystrmatch.c:266:2: warning: implicit declaration of function
 ‘damerau_levenshtein_internal_noncompatible’
 [-Wimplicit-function-declaration]
 fuzzystrmatch.c: At top level:
 dameraulevenshtein.c:40:12: warning

Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-18 Thread Liming Hu

On 5/18/2013 12:11 AM, Atri Sharma wrote:


Sent from my iPad

On 18-May-2013, at 12:34, Liming Hu dawnin...@gmail.com wrote:


On Fri, May 17, 2013 at 11:44 PM, Atri Sharma atri.j...@gmail.com wrote:


Sent from my iPad

On 18-May-2013, at 12:07, Liming Hu dawnin...@gmail.com wrote:


On Fri, May 17, 2013 at 11:13 PM, Atri Sharma atri.j...@gmail.com wrote:


Sent from my iPad

On 18-May-2013, at 11:23, Liming Hu dawnin...@gmail.com wrote:


On Fri, May 17, 2013 at 10:21 PM, Atri Sharma atri.j...@gmail.com wrote:


Sent from my iPad

On 18-May-2013, at 10:41, Liming Hu dawnin...@gmail.com wrote:


On Fri, May 17, 2013 at 9:39 PM, Atri Sharma atri.j...@gmail.com wrote:


Sent from my iPad

On 18-May-2013, at 10:00, Liming Hu dawnin...@gmail.com wrote:


On 5/17/2013 9:10 PM, Atri Sharma wrote:

On Sat, May 18, 2013 at 9:27 AM, Liming Hu dawnin...@gmail.com wrote:

On 5/17/2013 12:39 PM, Liming Hu wrote:

On Fri, May 17, 2013 at 12:06 PM, Josh Berkus j...@agliodbs.com wrote:

Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?

Patches welcome!  You, too, can be a PostgreSQL contributor.

However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility.  Shouldn't
be hard, just add a new function called levenshtiend().

I am working on it, I will make it this weekend project.

I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatch

liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart

* Restarting PostgreSQL 9.1 database server

[ OK ]


select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;

** Error **

ERROR: could not load library
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so:
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatible

Any one can help me on this? Thanks.

The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?

I did not run make install. I am running a stable postgresql in my laptop, I do 
not
want to reinstall everything, just want to try this contribution.  I am afraid
reinstall it will destroy my configurations, and databases, just do not want to 
mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/



You need not reinstall your entire database for installing/re installing an 
extension.Running make install from the extension's directory(after placing it 
in /contrib of a postgres database source directory) will install the extension 
in your current database without breaking anything.

You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?

Yes,although,I would run make clean before running make install,just for 
ensuring that all runs well.

liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so   libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE   -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function ‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning

Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-18 Thread Liming Hu

On 5/18/2013 1:03 AM, Atri Sharma wrote:

On Sat, May 18, 2013 at 1:30 PM, Liming Hu dawnin...@gmail.com wrote:

On 5/18/2013 12:11 AM, Atri Sharma wrote:

Sent from my iPad

On 18-May-2013, at 12:34, Liming Hu dawnin...@gmail.com wrote:

On Fri, May 17, 2013 at 11:44 PM, Atri Sharma atri.j...@gmail.com wrote:

Sent from my iPad

On 18-May-2013, at 12:07, Liming Hu dawnin...@gmail.com wrote:

On Fri, May 17, 2013 at 11:13 PM, Atri Sharma atri.j...@gmail.com wrote:

Sent from my iPad

On 18-May-2013, at 11:23, Liming Hu dawnin...@gmail.com wrote:

On Fri, May 17, 2013 at 10:21 PM, Atri Sharma atri.j...@gmail.com wrote:

Sent from my iPad

On 18-May-2013, at 10:41, Liming Hu dawnin...@gmail.com wrote:

On Fri, May 17, 2013 at 9:39 PM, Atri Sharma atri.j...@gmail.com wrote:

Sent from my iPad

On 18-May-2013, at 10:00, Liming Hu dawnin...@gmail.com wrote:

On 5/17/2013 9:10 PM, Atri Sharma wrote:

On Sat, May 18, 2013 at 9:27 AM, Liming Hu dawnin...@gmail.com wrote:

On 5/17/2013 12:39 PM, Liming Hu wrote:

On Fri, May 17, 2013 at 12:06 PM, Josh Berkus j...@agliodbs.com wrote:

Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?

Patches welcome!  You, too, can be a PostgreSQL contributor.

However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility.  Shouldn't
be hard, just add a new function called levenshtiend().

I am working on it, I will make it this weekend project.

I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatch

liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart

* Restarting PostgreSQL 9.1 database server

[ OK ]


select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;

** Error **

ERROR: could not load library
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so:
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatible

Any one can help me on this? Thanks.

The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?

I did not run make install. I am running a stable postgresql in my laptop, I
do not
want to reinstall everything, just want to try this contribution.  I am
afraid
reinstall it will destroy my configurations, and databases, just do not want
to mess up.
did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/


You need not reinstall your entire database for installing/re installing an
extension.Running make install from the extension's directory(after placing
it in /contrib of a postgres database source directory) will install the
extension in your current database without breaking anything.

You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?

Yes,although,I would run make clean before running make install,just for
ensuring that all runs well.

liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so   libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE   -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function
‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement

[HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu
Hi,

I am studying your levenshtein edit distance contribution in Postgresql.

Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?

Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation.



Thanks,

Liming


--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu

Hi Atri,

Thanks for the quick response.

levenshtein edit distance defines operations of: insertion, deletion, 
modification.
Levenshtein-Damerau edit distance defines operations of:  insertion, deletion, 
modification
and transposition (
it will be two operations in levenshtein edit distance:
one deletion, and one insertion,
).

In spelling checker/corrector, i.e.
 levenshtein('cta', 'cat') will return 2.
but Levenshtein-Damerau('cta', 'cat') will return 1.
if the maximum error is 1, we can not get 'cat'.

In practice, Levenshtein-Damerau is more widely used than Levenshtein.
I believe you notice Google automated search suggestions, they use 
Levenshtein-Damerau.


Thanks,

Liming


On 5/17/2013 3:00 AM, Atri Sharma wrote:


Sent from my iPad

On 17-May-2013, at 6:11, Liming Hu dawnin...@gmail.com wrote:


Hi,

I am studying your levenshtein edit distance contribution in Postgresql.

Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?

Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation.





Could you give some use cases for the same, where the proposed feature does 
better than the current functionalities?

Regards,

Atri




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu

Hi Atri,

I also talked to the author of fuzzystrmatch, he also thinks it is a 
good feature.

Thanks,

Liming

On 5/17/2013 8:21 AM, Liming Hu wrote:

Hi Atri,

Thanks for the quick response.

levenshtein edit distance defines operations of: insertion, deletion, 
modification.
Levenshtein-Damerau edit distance defines operations of: insertion, 
deletion, modification

and transposition (
it will be two operations in levenshtein edit distance:
one deletion, and one insertion,
).

In spelling checker/corrector, i.e.
 levenshtein('cta', 'cat') will return 2.
but Levenshtein-Damerau('cta', 'cat') will return 1.
if the maximum error is 1, we can not get 'cat'.

In practice, Levenshtein-Damerau is more widely used than Levenshtein.
I believe you notice Google automated search suggestions, they use 
Levenshtein-Damerau.


Thanks,

Liming


On 5/17/2013 3:00 AM, Atri Sharma wrote:


Sent from my iPad

On 17-May-2013, at 6:11, Liming Hu dawnin...@gmail.com wrote:


Hi,

I am studying your levenshtein edit distance contribution in 
Postgresql.


Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?

Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation. 






Could you give some use cases for the same, where the proposed 
feature does better than the current functionalities?


Regards,

Atri






--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu

On 5/17/2013 8:23 AM, Atri Sharma wrote:

On Fri, May 17, 2013 at 8:51 PM, Liming Hu dawnin...@gmail.com wrote:

Hi Atri,

Thanks for the quick response.

levenshtein edit distance defines operations of: insertion, deletion,
modification.
Levenshtein-Damerau edit distance defines operations of:  insertion,
deletion, modification
and transposition (
it will be two operations in levenshtein edit distance:
one deletion, and one insertion,
).

In spelling checker/corrector, i.e.
  levenshtein('cta', 'cat') will return 2.
but Levenshtein-Damerau('cta', 'cat') will return 1.
if the maximum error is 1, we can not get 'cat'.

In practice, Levenshtein-Damerau is more widely used than Levenshtein.
I believe you notice Google automated search suggestions, they use
Levenshtein-Damerau.


Sounds interesting. How can we build this over our current
implementation, or do we need to build it from scratch?

Regards,

Atri
I know how to write the code, but just need approval of accepting into 
the new version.



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu
Actually it is easy for me to just modify the code, and use it for me
case, I would like to contribute to the
community. I will write a basic implementation first.

On Fri, May 17, 2013 at 9:10 AM, Atri Sharma atri.j...@gmail.com wrote:
 On Fri, May 17, 2013 at 9:29 PM, Alvaro Herrera
 alvhe...@2ndquadrant.com wrote:
 Liming Hu escribió:
 Hi Atri,

 I also talked to the author of fuzzystrmatch, he also thinks it is a
 good feature.

 Yeah, I heard our fuzzystrmatch module being talked down a decade ago
 for not considering transpositions, so +1 for getting it patched.


 That is awesome then. The example Liming provided is itself pretty
 interesting and promising.

 Regards,

 Atri


 --
 Regards,

 Atri
 l'apprenant



-- 
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu
On Fri, May 17, 2013 at 12:06 PM, Josh Berkus j...@agliodbs.com wrote:

 Can we add Levenshtein-Damerau edit distance since it is used in
 spelling checker
 instead of levenshtein edit distance?

 Patches welcome!  You, too, can be a PostgreSQL contributor.

 However, you will need to preserve the ability of users to use the old
 levenshtien algorithm as well, for backwards-compatibility.  Shouldn't
 be hard, just add a new function called levenshtiend().

I am working on it, I will make it this weekend project.
 --
 Josh Berkus
 PostgreSQL Experts Inc.
 http://pgexperts.com


 --
 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-hackers



--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu

On 5/17/2013 12:39 PM, Liming Hu wrote:

On Fri, May 17, 2013 at 12:06 PM, Josh Berkus j...@agliodbs.com wrote:

Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?

Patches welcome!  You, too, can be a PostgreSQL contributor.

However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility.  Shouldn't
be hard, just add a new function called levenshtiend().


I am working on it, I will make it this weekend project.


I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatch

liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart

 * Restarting PostgreSQL 9.1 database server

   [ OK ]


select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;

** Error **

ERROR: could not load library
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so:
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatible

Any one can help me on this? Thanks.


--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



--
Liming Hu
cell: (435)-512-4190
Seattle Washington




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu

On 5/17/2013 9:10 PM, Atri Sharma wrote:

On Sat, May 18, 2013 at 9:27 AM, Liming Hu dawnin...@gmail.com wrote:

On 5/17/2013 12:39 PM, Liming Hu wrote:

On Fri, May 17, 2013 at 12:06 PM, Josh Berkus j...@agliodbs.com wrote:

Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?

Patches welcome!  You, too, can be a PostgreSQL contributor.

However, you will need to preserve the ability of users to use the old
levenshtien algorithm as well, for backwards-compatibility.  Shouldn't
be hard, just add a new function called levenshtiend().


I am working on it, I will make it this weekend project.


I have done that. and put the code at github:
https://github.com/liminghu/fuzzystrmatch

liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo cp fuzzystrmatch.so
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo /etc/init.d/postgresql restart

  * Restarting PostgreSQL 9.1 database server

[ OK ]


select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
CREATE EXTENSION fuzzystrmatch;

** Error **

ERROR: could not load library
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so:
/usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
damerau_levenshtein_internal_noncompatible

Any one can help me on this? Thanks.


The system is not able to find the required library, and I dont think
using cp to place the library is a very good idea.Did you run Make
Install after you added your work in the Makefile?


I did not run make install. I am running a stable postgresql in my 
laptop, I do not
want to reinstall everything, just want to try this contribution.  I am 
afraid
reinstall it will destroy my configurations, and databases, just do not 
want to mess up.

did you see any thing wrong:
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
https://github.com/liminghu/fuzzystrmatch/blob/master/levenshtein.c

Thanks,

Liming



Regards,

Atri


--
Regards,

Atri
l'apprenant




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu
On Fri, May 17, 2013 at 9:39 PM, Atri Sharma atri.j...@gmail.com wrote:


 Sent from my iPad

 On 18-May-2013, at 10:00, Liming Hu dawnin...@gmail.com wrote:

 On 5/17/2013 9:10 PM, Atri Sharma wrote:
 On Sat, May 18, 2013 at 9:27 AM, Liming Hu dawnin...@gmail.com wrote:
 On 5/17/2013 12:39 PM, Liming Hu wrote:
 On Fri, May 17, 2013 at 12:06 PM, Josh Berkus j...@agliodbs.com wrote:
 Can we add Levenshtein-Damerau edit distance since it is used in
 spelling checker
 instead of levenshtein edit distance?
 Patches welcome!  You, too, can be a PostgreSQL contributor.

 However, you will need to preserve the ability of users to use the old
 levenshtien algorithm as well, for backwards-compatibility.  Shouldn't
 be hard, just add a new function called levenshtiend().
 I am working on it, I will make it this weekend project.

 I have done that. and put the code at github:
 https://github.com/liminghu/fuzzystrmatch

 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 sudo cp fuzzystrmatch.so
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 sudo /etc/init.d/postgresql restart

  * Restarting PostgreSQL 9.1 database server

[ OK ]


 select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
 CREATE EXTENSION fuzzystrmatch;

 ** Error **

 ERROR: could not load library
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so:
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
 damerau_levenshtein_internal_noncompatible

 Any one can help me on this? Thanks.
 The system is not able to find the required library, and I dont think
 using cp to place the library is a very good idea.Did you run Make
 Install after you added your work in the Makefile?

 I did not run make install. I am running a stable postgresql in my laptop, I 
 do not
 want to reinstall everything, just want to try this contribution.  I am 
 afraid
 reinstall it will destroy my configurations, and databases, just do not want 
 to mess up.
 did you see any thing wrong:
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
 https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
 https://github.com/liminghu/fuzzystrmatch/blob/master/



 You need not reinstall your entire database for installing/re installing an 
 extension.Running make install from the extension's directory(after placing 
 it in /contrib of a postgres database source directory) will install the 
 extension in your current database without breaking anything.

You mean:
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
make install
?



 Regards,

 Atri




--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] request a new feature in fuzzystrmatch

2013-05-17 Thread Liming Hu
On Fri, May 17, 2013 at 10:21 PM, Atri Sharma atri.j...@gmail.com wrote:


 Sent from my iPad

 On 18-May-2013, at 10:41, Liming Hu dawnin...@gmail.com wrote:

 On Fri, May 17, 2013 at 9:39 PM, Atri Sharma atri.j...@gmail.com wrote:


 Sent from my iPad

 On 18-May-2013, at 10:00, Liming Hu dawnin...@gmail.com wrote:

 On 5/17/2013 9:10 PM, Atri Sharma wrote:
 On Sat, May 18, 2013 at 9:27 AM, Liming Hu dawnin...@gmail.com wrote:
 On 5/17/2013 12:39 PM, Liming Hu wrote:
 On Fri, May 17, 2013 at 12:06 PM, Josh Berkus j...@agliodbs.com wrote:
 Can we add Levenshtein-Damerau edit distance since it is used in
 spelling checker
 instead of levenshtein edit distance?
 Patches welcome!  You, too, can be a PostgreSQL contributor.

 However, you will need to preserve the ability of users to use the old
 levenshtien algorithm as well, for backwards-compatibility.  Shouldn't
 be hard, just add a new function called levenshtiend().
 I am working on it, I will make it this weekend project.

 I have done that. and put the code at github:
 https://github.com/liminghu/fuzzystrmatch

 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 sudo cp fuzzystrmatch.so
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so
 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 sudo /etc/init.d/postgresql restart

 * Restarting PostgreSQL 9.1 database server

   [ OK ]


 select dameraulevenshteinnocompatible('cta', 'cat',1,1,1,1);
 CREATE EXTENSION fuzzystrmatch;

 ** Error **

 ERROR: could not load library
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so:
 /usr/lib/postgresql/9.1/lib/fuzzystrmatch.so: undefined symbol:
 damerau_levenshtein_internal_noncompatible

 Any one can help me on this? Thanks.
 The system is not able to find the required library, and I dont think
 using cp to place the library is a very good idea.Did you run Make
 Install after you added your work in the Makefile?

 I did not run make install. I am running a stable postgresql in my laptop, 
 I do not
 want to reinstall everything, just want to try this contribution.  I am 
 afraid
 reinstall it will destroy my configurations, and databases, just do not 
 want to mess up.
 did you see any thing wrong:
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--1.0.sql
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch--unpackaged--1.0.sql
 https://github.com/liminghu/fuzzystrmatch/blob/master/fuzzystrmatch.c
 https://github.com/liminghu/fuzzystrmatch/blob/master/dameraulevenshtein.c
 https://github.com/liminghu/fuzzystrmatch/blob/master/



 You need not reinstall your entire database for installing/re installing an 
 extension.Running make install from the extension's directory(after placing 
 it in /contrib of a postgres database source directory) will install the 
 extension in your current database without breaking anything.

 You mean:
 liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
 make install
 ?



 Yes,although,I would run make clean before running make install,just for 
 ensuring that all runs well.


liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make clean
rm -f fuzzystrmatch.so   libfuzzystrmatch.a
rm -f fuzzystrmatch.o dmetaphone.o
liming@liming-UX31A:~/Downloads/postgresql-9.1.9/contrib/fuzzystrmatch$
sudo make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE   -c -o fuzzystrmatch.o
fuzzystrmatch.c
In file included from fuzzystrmatch.c:250:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
In file included from fuzzystrmatch.c:253:0:
dameraulevenshtein.c: In function ‘damerau_levenshtein_less_equal_internal’:
dameraulevenshtein.c:290:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c:328:57: warning: unused variable ‘trans’
[-Wunused-variable]
dameraulevenshtein.c: In function ‘dameraulevenshtein_with_costs_noncompatible’:
dameraulevenshtein.c:480:9: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
dameraulevenshtein.c:494:10: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
fuzzystrmatch.c: In function ‘damerau_levenshtein_with_costs_noncompatible’:
fuzzystrmatch.c:266:2: warning: implicit declaration of function
‘damerau_levenshtein_internal_noncompatible’
[-Wimplicit-function-declaration]
fuzzystrmatch.c: At top level:
dameraulevenshtein.c:40:12: warning: ‘dameraulevenshtein_internal’
declared ‘static’ but never defined [-Wunused-function]
dameraulevenshtein.c:37:12: warning:
‘dameraulevenshtein_less_equal_internal’ declared ‘static’ but never
defined [-Wunused

[HACKERS] Fwd: request a new feature in fuzzystrmatch

2013-05-16 Thread Liming Hu
-- Forwarded message --
From: Liming Hu dawnin...@gmail.com
Date: Thu, May 16, 2013 at 5:41 PM
Subject: request a new feature in fuzzystrmatch
To: pgsql-hackers@postgresql.org


Hi,

I am studying your levenshtein edit distance contribution in Postgresql.

Can we add Levenshtein-Damerau edit distance since it is used in
spelling checker
instead of levenshtein edit distance?

Levenshtein-Damerau edit distance C source code:
http://stackoverflow.com/questions/10727174/dameraulevenshtein-distance-edit-distance-with-transposition-c-implementation.



Thanks,

Liming


--
Liming Hu
cell: (435)-512-4190
Seattle Washington


--
Liming Hu
cell: (435)-512-4190
Seattle Washington


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers