summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2004-06-07 16:48:49 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2004-06-07 16:48:49 +0000
commitdb688bc1c3f3eb774595fe90f7849b7f54874661 (patch)
treea5a96218ba91dc79e62b1dc0fbf74066b94bc8b4
parent1532e3a8aa3a9b4daa9d0fc4962f7768ede53b51 (diff)
Remove asymetrical word processing in query and text
-rw-r--r--contrib/tsearch/query.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/tsearch/query.c b/contrib/tsearch/query.c
index bcf2e0d83c4..88b7f7e4cb2 100644
--- a/contrib/tsearch/query.c
+++ b/contrib/tsearch/query.c
@@ -240,9 +240,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);