Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7299eb7

Browse files
committed
reformat to_tsany.c
1 parent7342a51 commit7299eb7

File tree

1 file changed

+43
-29
lines changed

1 file changed

+43
-29
lines changed

‎src/backend/tsearch/to_tsany.c

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,14 @@ typedef struct MorphOpaque
272272
staticvoid
273273
pushval_morph(Datumopaque,TSQueryParserStatestate,char*strval,intlenval,int16weight,boolprefix)
274274
{
275-
int32count=0;
276-
ParsedTextprs;
277-
uint32variant,
278-
pos=0,
279-
cntvar=0,
280-
cntpos=0,
281-
cnt=0;
282-
MorphOpaque*data= (MorphOpaque*)DatumGetPointer(opaque);
275+
int32count=0;
276+
ParsedTextprs;
277+
uint32variant,
278+
pos=0,
279+
cntvar=0,
280+
cntpos=0,
281+
cnt=0;
282+
MorphOpaque*data= (MorphOpaque*)DatumGetPointer(opaque);
283283

284284
prs.lenwords=4;
285285
prs.curwords=0;
@@ -290,12 +290,11 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
290290

291291
if (prs.curwords>0)
292292
{
293-
294293
while (count<prs.curwords)
295294
{
296-
if (pos>0&&pos+1<prs.words[count].pos.pos)
295+
if (pos>0&&pos+1<prs.words[count].pos.pos)
297296
{
298-
while(pos+1<prs.words[count].pos.pos)
297+
while (pos+1<prs.words[count].pos.pos)
299298
{
300299
/* put placeholders for each stop word */
301300
pushStop(state);
@@ -313,11 +312,18 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
313312
variant=prs.words[count].nvariant;
314313

315314
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)
317318
{
318319

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);
321327
pfree(prs.words[count].word);
322328
if (cnt)
323329
pushOperator(state,OP_AND,0);
@@ -344,14 +350,17 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
344350
Datum
345351
to_tsquery_byid(PG_FUNCTION_ARGS)
346352
{
347-
text*in=PG_GETARG_TEXT_P(1);
348-
TSQueryquery;
349-
MorphOpaquedata;
353+
text*in=PG_GETARG_TEXT_P(1);
354+
TSQueryquery;
355+
MorphOpaquedata;
350356

351357
data.cfg_id=PG_GETARG_OID(0);
352358
data.qoperator=OP_AND;
353359

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);
355364

356365
PG_RETURN_TSQUERY(query);
357366
}
@@ -371,14 +380,17 @@ to_tsquery(PG_FUNCTION_ARGS)
371380
Datum
372381
plainto_tsquery_byid(PG_FUNCTION_ARGS)
373382
{
374-
text*in=PG_GETARG_TEXT_P(1);
375-
TSQueryquery;
376-
MorphOpaquedata;
383+
text*in=PG_GETARG_TEXT_P(1);
384+
TSQueryquery;
385+
MorphOpaquedata;
377386

378387
data.cfg_id=PG_GETARG_OID(0);
379388
data.qoperator=OP_AND;
380389

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);
382394

383395
PG_RETURN_POINTER(query);
384396
}
@@ -399,27 +411,29 @@ plainto_tsquery(PG_FUNCTION_ARGS)
399411
Datum
400412
phraseto_tsquery_byid(PG_FUNCTION_ARGS)
401413
{
402-
text*in=PG_GETARG_TEXT_P(1);
403-
TSQueryquery;
404-
MorphOpaquedata;
414+
text*in=PG_GETARG_TEXT_P(1);
415+
TSQueryquery;
416+
MorphOpaquedata;
405417

406418
data.cfg_id=PG_GETARG_OID(0);
407419
data.qoperator=OP_PHRASE;
408420

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);
410425

411426
PG_RETURN_TSQUERY(query);
412427
}
413428

414429
Datum
415430
phraseto_tsquery(PG_FUNCTION_ARGS)
416431
{
417-
text*in=PG_GETARG_TEXT_P(0);
418-
OidcfgId;
432+
text*in=PG_GETARG_TEXT_P(0);
433+
OidcfgId;
419434

420435
cfgId=getTSCurrentConfig(true);
421436
PG_RETURN_DATUM(DirectFunctionCall2(phraseto_tsquery_byid,
422437
ObjectIdGetDatum(cfgId),
423438
PointerGetDatum(in)));
424439
}
425-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp