]> granicus.if.org Git - postgresql/commitdiff
Remove asymetrical word processing in query and text
authorTeodor Sigaev <teodor@sigaev.ru>
Mon, 7 Jun 2004 16:49:25 +0000 (16:49 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Mon, 7 Jun 2004 16:49:25 +0000 (16:49 +0000)
contrib/tsearch/query.c

index 9d5e126c5bcfe5ff58cc754997a531be672e6e74..0e495eaaae15cb0fd4babd1b34c2e36dc82d56a6 100644 (file)
@@ -232,9 +232,18 @@ pushval_morph(QPRS_STATE * state, int typeval, char *strval, int lenval)
                lemm = lemmatize(token, &lenlemm, type);
                if (lemm)
                {
+                       if ( lemm==token ) {
+                               char *ptrs=token,*ptrd;
+                               ptrd = lemm = palloc(lenlemm+1);
+                               while(ptrs-token<lenlemm) {
+                                       *ptrd = tolower((unsigned char) *ptrs);
+                                       ptrs++;
+                                       ptrd++;
+                               }
+                               *ptrd='\0';
+                       }       
                        pushval_asis(state, VAL, lemm, lenlemm);
-                       if (lemm != token)
-                               pfree(lemm);
+                       pfree(lemm);
                }
                else
                        pushval_asis(state, VALTRUE, 0, 0);