@@ -272,14 +272,14 @@ typedef struct MorphOpaque
272
272
static void
273
273
pushval_morph (Datum opaque ,TSQueryParserState state ,char * strval ,int lenval ,int16 weight ,bool prefix )
274
274
{
275
- int32 count = 0 ;
276
- ParsedText prs ;
277
- uint32 variant ,
278
- pos = 0 ,
279
- cntvar = 0 ,
280
- cntpos = 0 ,
281
- cnt = 0 ;
282
- MorphOpaque * data = (MorphOpaque * )DatumGetPointer (opaque );
275
+ int32 count = 0 ;
276
+ ParsedText prs ;
277
+ uint32 variant ,
278
+ pos = 0 ,
279
+ cntvar = 0 ,
280
+ cntpos = 0 ,
281
+ cnt = 0 ;
282
+ MorphOpaque * data = (MorphOpaque * )DatumGetPointer (opaque );
283
283
284
284
prs .lenwords = 4 ;
285
285
prs .curwords = 0 ;
@@ -290,12 +290,11 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
290
290
291
291
if (prs .curwords > 0 )
292
292
{
293
-
294
293
while (count < prs .curwords )
295
294
{
296
- if (pos > 0 && pos + 1 < prs .words [count ].pos .pos )
295
+ if (pos > 0 && pos + 1 < prs .words [count ].pos .pos )
297
296
{
298
- while ( pos + 1 < prs .words [count ].pos .pos )
297
+ while ( pos + 1 < prs .words [count ].pos .pos )
299
298
{
300
299
/* put placeholders for each stop word */
301
300
pushStop (state );
@@ -313,11 +312,18 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
313
312
variant = prs .words [count ].nvariant ;
314
313
315
314
cnt = 0 ;
316
- while (count < prs .curwords && pos == prs .words [count ].pos .pos && variant == prs .words [count ].nvariant )
315
+ while (count < prs .curwords &&
316
+ pos == prs .words [count ].pos .pos &&
317
+ variant == prs .words [count ].nvariant )
317
318
{
318
319
319
- pushValue (state ,prs .words [count ].word ,prs .words [count ].len ,weight ,
320
- ((prs .words [count ].flags & TSL_PREFIX )|| prefix ) ? true : false);
320
+ pushValue (state ,
321
+ prs .words [count ].word ,
322
+ prs .words [count ].len ,
323
+ weight ,
324
+ ((prs .words [count ].flags & TSL_PREFIX )|| prefix ) ?
325
+ true :
326
+ false);
321
327
pfree (prs .words [count ].word );
322
328
if (cnt )
323
329
pushOperator (state ,OP_AND ,0 );
@@ -344,14 +350,17 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
344
350
Datum
345
351
to_tsquery_byid (PG_FUNCTION_ARGS )
346
352
{
347
- text * in = PG_GETARG_TEXT_P (1 );
348
- TSQuery query ;
349
- MorphOpaque data ;
353
+ text * in = PG_GETARG_TEXT_P (1 );
354
+ TSQuery query ;
355
+ MorphOpaque data ;
350
356
351
357
data .cfg_id = PG_GETARG_OID (0 );
352
358
data .qoperator = OP_AND ;
353
359
354
- query = parse_tsquery (text_to_cstring (in ),pushval_morph ,PointerGetDatum (& data ), false);
360
+ query = parse_tsquery (text_to_cstring (in ),
361
+ pushval_morph ,
362
+ PointerGetDatum (& data ),
363
+ false);
355
364
356
365
PG_RETURN_TSQUERY (query );
357
366
}
@@ -371,14 +380,17 @@ to_tsquery(PG_FUNCTION_ARGS)
371
380
Datum
372
381
plainto_tsquery_byid (PG_FUNCTION_ARGS )
373
382
{
374
- text * in = PG_GETARG_TEXT_P (1 );
375
- TSQuery query ;
376
- MorphOpaque data ;
383
+ text * in = PG_GETARG_TEXT_P (1 );
384
+ TSQuery query ;
385
+ MorphOpaque data ;
377
386
378
387
data .cfg_id = PG_GETARG_OID (0 );
379
388
data .qoperator = OP_AND ;
380
389
381
- query = parse_tsquery (text_to_cstring (in ),pushval_morph ,PointerGetDatum (& data ), true);
390
+ query = parse_tsquery (text_to_cstring (in ),
391
+ pushval_morph ,
392
+ PointerGetDatum (& data ),
393
+ true);
382
394
383
395
PG_RETURN_POINTER (query );
384
396
}
@@ -399,27 +411,29 @@ plainto_tsquery(PG_FUNCTION_ARGS)
399
411
Datum
400
412
phraseto_tsquery_byid (PG_FUNCTION_ARGS )
401
413
{
402
- text * in = PG_GETARG_TEXT_P (1 );
403
- TSQuery query ;
404
- MorphOpaque data ;
414
+ text * in = PG_GETARG_TEXT_P (1 );
415
+ TSQuery query ;
416
+ MorphOpaque data ;
405
417
406
418
data .cfg_id = PG_GETARG_OID (0 );
407
419
data .qoperator = OP_PHRASE ;
408
420
409
- query = parse_tsquery (text_to_cstring (in ),pushval_morph ,PointerGetDatum (& data ), true);
421
+ query = parse_tsquery (text_to_cstring (in ),
422
+ pushval_morph ,
423
+ PointerGetDatum (& data ),
424
+ true);
410
425
411
426
PG_RETURN_TSQUERY (query );
412
427
}
413
428
414
429
Datum
415
430
phraseto_tsquery (PG_FUNCTION_ARGS )
416
431
{
417
- text * in = PG_GETARG_TEXT_P (0 );
418
- Oid cfgId ;
432
+ text * in = PG_GETARG_TEXT_P (0 );
433
+ Oid cfgId ;
419
434
420
435
cfgId = getTSCurrentConfig (true);
421
436
PG_RETURN_DATUM (DirectFunctionCall2 (phraseto_tsquery_byid ,
422
437
ObjectIdGetDatum (cfgId ),
423
438
PointerGetDatum (in )));
424
439
}
425
-