mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Phrase full text search.
Patch introduces new text search operator (<-> or <DISTANCE>) into tsquery. On-disk and binary in/out format of tsquery are backward compatible. It has two side effect: - change order for tsquery, so, users, who has a btree index over tsquery, should reindex it - less number of parenthesis in tsquery output, and tsquery becomes more readable Authors: Teodor Sigaev, Oleg Bartunov, Dmitry Ivanov Reviewers: Alexander Korotkov, Artur Zakirov
This commit is contained in:
@ -110,6 +110,10 @@ QTNodeCompare(QTNode *an, QTNode *bn)
|
||||
if ((res = QTNodeCompare(an->child[i], bn->child[i])) != 0)
|
||||
return res;
|
||||
}
|
||||
|
||||
if (ao->oper == OP_PHRASE && ao->distance != bo->distance)
|
||||
return (ao->distance > bo->distance) ? -1 : 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (an->valnode->type == QI_VAL)
|
||||
@ -150,7 +154,7 @@ QTNSort(QTNode *in)
|
||||
|
||||
for (i = 0; i < in->nchild; i++)
|
||||
QTNSort(in->child[i]);
|
||||
if (in->nchild > 1)
|
||||
if (in->nchild > 1 && in->valnode->qoperator.oper != OP_PHRASE)
|
||||
qsort((void *) in->child, in->nchild, sizeof(QTNode *), cmpQTN);
|
||||
}
|
||||
|
||||
@ -190,7 +194,10 @@ QTNTernary(QTNode *in)
|
||||
{
|
||||
QTNode *cc = in->child[i];
|
||||
|
||||
if (cc->valnode->type == QI_OPR && in->valnode->qoperator.oper == cc->valnode->qoperator.oper)
|
||||
/* OP_Phrase isn't associative */
|
||||
if (cc->valnode->type == QI_OPR &&
|
||||
in->valnode->qoperator.oper == cc->valnode->qoperator.oper &&
|
||||
in->valnode->qoperator.oper != OP_PHRASE)
|
||||
{
|
||||
int oldnchild = in->nchild;
|
||||
|
||||
|
Reference in New Issue
Block a user