如何在 vespa.ai 中使用 groupby 进行分页?

How to do pagination using groupby in vespa.ai?

我试过以下查询-

http://<hostname>:<port>/search/?yql=select * from sources document_name where sddocname contains 'document_name' | all(group(key) each(each(output(summary())))) ;

我得到的结果-

{
"root": {
    "id": "toplevel",
    "relevance": 1.0,
    "fields": {
        "totalCount": 2924
    },
    "coverage": {
        "coverage": 100,
        "documents": 2924,
        "full": true,
        "nodes": 3,
        "results": 1,
        "resultsFull": 1
    },
    "children": [
        {
            "id": "group:root:0",
            "relevance": 1.0,
            "continuation": {
                "this": ""
            },
            "children": [
                {...

实现分页我们需要 continuation.this 键值,但我们在 this 键中得到空字符串。

还有,如何使用group by设置分页中单页的记录数?

上面的例子

all(group(key) each(each(output(summary())))) 

不会有任何后续,因为您已经获取了所有唯一键组和每个唯一键的所有命中。

all(group(key) max(2) each( max(1) each(output(summary())))) 

为您提供最多 2 个键值,并且每个键有 1 次点击。在这种情况下,您会看到有效的延续。