1

I have tried below query-

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

The result I got-

{
"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": [
                {...

To implement pagination We need continuation.this key value, but we are getting empty string inside this key that.

Also, How can we set the number of records in a single page in pagination using group by?

suyash308
  • 347
  • 1
  • 7

1 Answers1

3

The above example

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

Will not have any continuation as you have fetched all unique key groups and all hits for each of the unique keys.

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

Gives you max 2 key values, and for each of those keys 1 hit. In this case you'll see valid continuations.

Jo Kristian Bergum
  • 2,984
  • 5
  • 8