forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commiteb08605
committed
Make websearch_to_tsquery() parse text in quotes as a single token
websearch_to_tsquery() splits text in quotes into tokens and connects them withphrase operator on its own. However, that leads to surprising results when thetoken contains no words.For instance, websearch_to_tsquery('"aaa: bbb"') is 'aaa <2> bbb', becauseit is equivalent of to_tsquery(E'aaa <-> \':\' <-> bbb'). Butwebsearch_to_tsquery('"aaa: bbb"') has to be 'aaa <-> bbb' in order to matchto_tsvector('aaa: bbb').Since0c4f355, we anyway connect lexemes of complex tokens with phraseoperators. Thus, let's just websearch_to_tsquery() parse text in quotes asa single token. Therefore, websearch_to_tsquery() should process the quotedtext in the same way phraseto_tsquery() does. This solution is what we exactlyneed and also simplifies the code.This commit is an incompatible change, so we don't backpatch it.Reported-by: Valentin Gatien-BaronDiscussion:https://postgr.es/m/CA%2B0DEqiZs7gdOd4ikmg%3D0UWG%2BSwWOLxPsk_JW-sx9WNOyrb0KQ%40mail.gmail.comAuthor: Alexander KorotkovReviewed-by: Tom Lane, Zhihong Yu1 parent651d005 commiteb08605
File tree
3 files changed
+39
-67
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+39
-67
lines changedLines changed: 23 additions & 58 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
80 |
| - | |
81 | 80 |
| |
82 | 81 |
| |
83 | 82 |
| |
| |||
235 | 234 |
| |
236 | 235 |
| |
237 | 236 |
| |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 | 237 |
| |
242 | 238 |
| |
243 | 239 |
| |
| |||
398 | 394 |
| |
399 | 395 |
| |
400 | 396 |
| |
401 |
| - | |
402 |
| - | |
403 |
| - | |
404 | 397 |
| |
405 | 398 |
| |
406 | 399 |
| |
407 | 400 |
| |
408 | 401 |
| |
| 402 | + | |
| 403 | + | |
| 404 | + | |
409 | 405 |
| |
| 406 | + | |
410 | 407 |
| |
411 |
| - | |
412 |
| - | |
413 |
| - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
414 | 412 |
| |
415 |
| - | |
416 |
| - | |
417 |
| - | |
418 |
| - | |
419 |
| - | |
420 |
| - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
421 | 416 |
| |
422 |
| - | |
423 |
| - | |
424 |
| - | |
425 |
| - | |
426 |
| - | |
427 |
| - | |
428 |
| - | |
429 |
| - | |
430 |
| - | |
431 |
| - | |
432 |
| - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
433 | 420 |
| |
434 | 421 |
| |
435 | 422 |
| |
| |||
467 | 454 |
| |
468 | 455 |
| |
469 | 456 |
| |
470 |
| - | |
471 |
| - | |
472 |
| - | |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
480 |
| - | |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
488 | 464 |
| |
489 | 465 |
| |
490 | 466 |
| |
| |||
498 | 474 |
| |
499 | 475 |
| |
500 | 476 |
| |
501 |
| - | |
502 |
| - | |
503 |
| - | |
504 |
| - | |
505 |
| - | |
506 |
| - | |
507 |
| - | |
508 |
| - | |
509 |
| - | |
510 |
| - | |
511 |
| - | |
512 |
| - | |
| 477 | + | |
| 478 | + | |
513 | 479 |
| |
514 | 480 |
| |
515 | 481 |
| |
| |||
846 | 812 |
| |
847 | 813 |
| |
848 | 814 |
| |
849 |
| - | |
850 | 815 |
| |
851 | 816 |
| |
852 | 817 |
| |
|
Lines changed: 15 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2678 | 2678 |
| |
2679 | 2679 |
| |
2680 | 2680 |
| |
2681 |
| - | |
2682 |
| - | |
2683 |
| - | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
2684 | 2684 |
| |
2685 | 2685 |
| |
2686 | 2686 |
| |
| |||
2695 | 2695 |
| |
2696 | 2696 |
| |
2697 | 2697 |
| |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
2698 | 2704 |
| |
2699 | 2705 |
| |
2700 | 2706 |
| |
| |||
2708 | 2714 |
| |
2709 | 2715 |
| |
2710 | 2716 |
| |
2711 |
| - | |
2712 |
| - | |
2713 |
| - | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
2714 | 2720 |
| |
2715 | 2721 |
| |
2716 | 2722 |
| |
2717 |
| - | |
2718 |
| - | |
2719 |
| - | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
2720 | 2726 |
| |
2721 | 2727 |
| |
2722 | 2728 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
759 | 759 |
| |
760 | 760 |
| |
761 | 761 |
| |
| 762 | + | |
762 | 763 |
| |
763 | 764 |
| |
764 | 765 |
| |
|
0 commit comments
Comments
(0)