SNIPPET() on multiple fields

Hi!

When I use a query like below, I see the highlighted text in results:

SELECT id, snippet(field1, QUERY()) FROM index WHERE MATCH('(@(field1) (text))');

However. the following query does not show my any highlights:

SELECT id, snippet(field1, QUERY()), snippet(field2, QUERY()) FROM index WHERE MATCH('(@(field1) (text)) (@(field2) (another_text))');

The snippet() function does not work when matching by two or more fields, does it?

Reproduced. The MRE is:

snikolaev@dev:~$ mysql -P9306 -h0 -v
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 4.2.0 15e927b@211223 release (columnar 1.11.4 327b3d4@211223) git branch HEAD (no branch)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Reading history-file /home/snikolaev/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop table if exists t; create table t(f1 text, f2 text); insert into t values(0,'b', 'c x'); select snippet(f1, query()), snippet(f2, query()) from t where match('@f1 b @f2 x');
--------------
drop table if exists t
--------------

Query OK, 0 rows affected (0.13 sec)

--------------
create table t(f1 text, f2 text)
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
insert into t values(0,'b', 'c x')
--------------

Query OK, 1 row affected (0.00 sec)

--------------
select snippet(f1, query()), snippet(f2, query()) from t where match('@f1 b @f2 x')
--------------

+----------------------+----------------------+
| snippet(f1, query()) | snippet(f2, query()) |
+----------------------+----------------------+
| b                    | c x                  |
+----------------------+----------------------+
1 row in set (0.01 sec)

It may be a bug or non-documented limitation of snippet() or query. It’s better to create an issue on github and with the above MRE.

Done