summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeodor Sigaev2004-06-07 16:48:18 +0000
committerTeodor Sigaev2004-06-07 16:48:18 +0000
commite25a6e185bbb3894ed87459354099df877b0d311 (patch)
treed9cc53cc9b5e0a3346a4df28d539ced36ebd8501
parent613c684a6015f30382e5c4a272efea7628007250 (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);