'wether':CD & 'sky':BC
(1 row)
+select to_tsquery('asd&(and|fghj)');
+ to_tsquery
+----------------
+ 'asd' & 'fghj'
+(1 row)
+
+select to_tsquery('(asd&and)|fghj');
+ to_tsquery
+----------------
+ 'asd' | 'fghj'
+(1 row)
+
+select to_tsquery('(asd&!and)|fghj');
+ to_tsquery
+----------------
+ 'asd' | 'fghj'
+(1 row)
+
+select to_tsquery('(the|and&(i&1))&fghj');
+ to_tsquery
+--------------
+ '1' & 'fghj'
+(1 row)
+
select 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca';
?column?
----------
PG_FUNCTION_INFO_V1(to_tsquery_current);
Datum to_tsquery_current(PG_FUNCTION_ARGS);
-#define END 0
-#define ERR 1
-#define VAL 2
-#define OPR 3
-#define OPEN 4
-#define CLOSE 5
-#define VALTRUE 6 /* for stop words */
-#define VALFALSE 7
-
/* parser's states */
#define WAITOPERAND 1
#define WAITOPERATOR 2
/* XXX */
if (prs.curwords == 0)
- pushval_asis(state, VALTRUE, 0, 0, 0);
+ pushval_asis(state, VALSTOP, 0, 0, 0);
}
#define STACKDEPTH 32
elog(DEBUG3, (ptr[*pos].type == OPR) ?
"%d %c" : "%d %d", *pos, ptr[*pos].val);
#endif
- if (ptr[*pos].type == VAL || ptr[*pos].type == VALTRUE)
+ if (ptr[*pos].type == VAL || ptr[*pos].type == VALSTOP)
{
ptr[*pos].left = 0;
(*pos)++;
#define OPR 3
#define OPEN 4
#define CLOSE 5
-#define VALTRUE 6 /* for stop words */
-#define VALFALSE 7
+#define VALSTOP 6 /* for stop words */
bool TS_execute(ITEM * curitem, void *checkval,
bool calcnot, bool (*chkcond) (void *checkval, ITEM * val));
#define V_UNKNOWN 0
#define V_TRUE 1
#define V_FALSE 2
+#define V_STOP 3
/*
* Clean query tree from values which is always in
if (node->valnode->type == VAL)
return node;
- else if (node->valnode->type == VALTRUE)
+ else if (node->valnode->type == VALSTOP)
{
pfree(node);
- *result = V_TRUE;
+ *result = V_STOP;
return NULL;
}
node->right = clean_fakeval_intree(node->right, &rresult);
if (!node->right)
{
- *result = (rresult == V_TRUE) ? V_FALSE : V_TRUE;
+ *result = V_STOP;
freetree(node);
return NULL;
}
}
- else if (node->valnode->val == (int4) '|')
- {
- NODE *res = node;
-
- node->left = clean_fakeval_intree(node->left, &lresult);
- node->right = clean_fakeval_intree(node->right, &rresult);
- if (lresult == V_TRUE || rresult == V_TRUE)
- {
- freetree(node);
- *result = V_TRUE;
- return NULL;
- }
- else if (lresult == V_FALSE && rresult == V_FALSE)
- {
- freetree(node);
- *result = V_FALSE;
- return NULL;
- }
- else if (lresult == V_FALSE)
- {
- res = node->right;
- pfree(node);
- }
- else if (rresult == V_FALSE)
- {
- res = node->left;
- pfree(node);
- }
- return res;
- }
else
{
NODE *res = node;
node->left = clean_fakeval_intree(node->left, &lresult);
node->right = clean_fakeval_intree(node->right, &rresult);
- if (lresult == V_FALSE || rresult == V_FALSE)
- {
- freetree(node);
- *result = V_FALSE;
- return NULL;
- }
- else if (lresult == V_TRUE && rresult == V_TRUE)
+ if (lresult == V_STOP && rresult == V_STOP)
{
freetree(node);
- *result = V_TRUE;
+ *result = V_STOP;
return NULL;
}
- else if (lresult == V_TRUE)
+ else if (lresult == V_STOP)
{
res = node->right;
pfree(node);
}
- else if (rresult == V_TRUE)
+ else if (rresult == V_STOP)
{
res = node->left;
pfree(node);
select to_tsquery('default', 'qwe & sKies ');
select to_tsquery('simple', 'qwe & sKies ');
select to_tsquery('default', '\'the wether\':dc & \' sKies \':BC ');
+select to_tsquery('asd&(and|fghj)');
+select to_tsquery('(asd&and)|fghj');
+select to_tsquery('(asd&!and)|fghj');
+select to_tsquery('(the|and&(i&1))&fghj');
select 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca';
select 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:B';
select 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:A';