manticoresearch icon indicating copy to clipboard operation
manticoresearch copied to clipboard

GROUP N BY X does not support JSON attributes

Open cbess opened this issue 5 years ago • 7 comments

Manticore Search version: 3.2.2

OS version: debian:stretch

Build version: 62ea5ff0@191220

Description of the issue:

SphinxQL GROUP N BY does not work with json attributes.

Steps to reproduce:

Create a RT index with a json attribute like: rt_attr_json = meta

index base_rt
{
    type = rt
    
    rt_field = title
    rt_field = content
    rt_field = url

    # meta attr store
    rt_attr_json = meta

    stored_fields = content

    min_word_len = 2
    rt_mem_limit = 300M
    wordforms = /etc/manticoresearch/wordforms-en.txt
    stopwords = /etc/manticoresearch/stopwords-en.txt
    exceptions = /etc/manticoresearch/exceptions-en.txt
    embedded_limit = 1M
    # enable for SUGGEST call
    min_infix_len = 4
}

index main_rt : base_rt
{
    path = /var/lib/manticore/data/main_rt_v1
}

Attempt to use a string value from it to perform a GROUP N BY [json attr] query:

SELECT 
	id,
	SNIPPET(content, QUERY()) as text,
	meta.site AS site
FROM main_rt WHERE MATCH('cloud')
GROUP 3 BY site WITHIN GROUP ORDER BY id DESC
ORDER BY id DESC
LIMIT 0, 10
OPTION max_matches=240, field_weights=(title=12, content=10);

Error returned: index main: internal error: unhandled sorting mode (match-sort=5, group=1, group-sort=5)

cbess avatar Dec 25 '19 18:12 cbess

Any updates on this bug?

cbess avatar Feb 11 '20 02:02 cbess

@cbess Not fixed yet. Not sure when we will have time for this as we're busy with other higher priority things.

FFR: the minimized test case is:

mysql> create table idx(j json, t text);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into idx(j) values('{"a": 1}');
Query OK, 1 row affected (0.00 sec)

mysql> insert into idx(j) values('{"a": 1}');
Query OK, 1 row affected (0.00 sec)

mysql> select j.a, count(*) from idx group 2 by j.a;
ERROR 1064 (42000): index idx: internal error: unhandled sorting mode (match-sort=5, group=1, group-sort=5)

manticoresearch avatar Feb 11 '20 02:02 manticoresearch

Understood. Thanks for keeping it on your radar! I really appreciate the work that goes into this project!

cbess avatar Feb 13 '20 03:02 cbess

As an update, does https://github.com/manticoresoftware/manticoresearch/commit/e6424a13e56f9783d2e9433b5c6df784fdfcf191 solve this issue as well?

cbess avatar Nov 19 '20 00:11 cbess

no this issue is not fixed yet

tomatolog avatar Nov 19 '20 06:11 tomatolog

Any updates on this issue?

cbess avatar May 20 '21 13:05 cbess

No updates. Still in backlog with not so high priority.

sanikolaev avatar May 20 '21 14:05 sanikolaev