Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination #86

Closed
gieart87 opened this issue Feb 22, 2016 · 10 comments
Closed

Pagination #86

gieart87 opened this issue Feb 22, 2016 · 10 comments
Milestone

Comments

@gieart87
Copy link

I had a problem about pagination in elastic . I try to send a parameter "?page = 2" when using mysql running normally . But when using elastic it does not work .

{
    "message": "Not Found",
    "url": "\/myapp\/api\/categories.json?limit=3\u0026amp;page=2",
    "code": 404,
    "trace": [
        {
            "file": "\/var\/www\/html\/myapp\/vendor\/cakephp\/cakephp\/src\/Controller\/Controller.php",
            "line": 688,
            "function": "paginate",
            "class": "Cake\\Controller\\Component\\PaginatorComponent",
            "type": "-\u003E",
            "args": [
                {

                },
                {
                    "limit": 3
                }
            ]
        },
        {`
@markstory
Copy link
Member

What is the -\u003E doing in there?

@markstory markstory added this to the 1.0.0 milestone Feb 22, 2016
@gieart87
Copy link
Author

That is debug trace of cakephp , I do not know what causes it
elastic

@markstory
Copy link
Member

Ok. Is there anything more to that trace?

@gieart87
Copy link
Author

This is the full trace :

{
    "message": "Not Found",
    "url": "/bot/viglink/cakeviglink/api/categories.json?page=2",
    "code": 404,
    "trace": [
        {
            "file": "/var/www/html/bot/viglink/cakeviglink/vendor/cakephp/cakephp/src/Controller/Controller.php",
            "line": 688,
            "function": "paginate",
            "class": "Cake\\Controller\\Component\\PaginatorComponent",
            "type": "->",
            "args": [
                {},
                {
                    "limit": 3
                }
            ]
        },
        {
            "file": "/var/www/html/bot/viglink/cakeviglink/src/Controller/Api/CategoriesController.php",
            "line": 39,
            "function": "paginate",
            "class": "Cake\\Controller\\Controller",
            "type": "->",
            "args": [
                {}
            ]
        },
        {
            "file": "/var/www/html/bot/viglink/cakeviglink/vendor/cakephp/cakephp/src/Controller/Controller.php",
            "line": 429,
            "function": "call_user_func_array",
            "args": [
                [
                    {
                        "components": {
                            "RequestHandler": null
                        },
                        "name": "Categories",
                        "helpers": [],
                        "request": {
                            "params": {
                                "plugin": null,
                                "controller": "Categories",
                                "action": "index",
                                "_ext": "json",
                                "pass": [],
                                "_method": "GET",
                                "prefix": "api",
                                "isAjax": false,
                                "paging": {
                                    "categories": {
                                        "finder": "all",
                                        "page": 1,
                                        "current": 3,
                                        "count": 3,
                                        "perPage": 3,
                                        "prevPage": false,
                                        "nextPage": false,
                                        "pageCount": 1,
                                        "sort": null,
                                        "direction": false,
                                        "limit": null,
                                        "sortDefault": false,
                                        "directionDefault": false
                                    }
                                }
                            },
                            "data": [],
                            "query": {
                                "page": "2"
                            },
                            "cookies": [],
                            "url": "api/categories.json",
                            "base": "/bot/viglink/cakeviglink",
                            "webroot": "/bot/viglink/cakeviglink/",
                            "here": "/bot/viglink/cakeviglink/api/categories.json",
                            "trustProxy": false
                        },
                        "response": {},
                        "paginate": {
                            "limit": 3
                        },
                        "autoRender": true,
                        "View": null,
                        "plugin": null,
                        "passedArgs": [],
                        "modelClass": "Categories",
                        "viewClass": null,
                        "viewVars": [],
                        "RequestHandler": {
                            "enabled": true,
                            "response": {},
                            "ext": "json",
                            "request": {
                                "params": {
                                    "plugin": null,
                                    "controller": "Categories",
                                    "action": "index",
                                    "_ext": "json",
                                    "pass": [],
                                    "_method": "GET",
                                    "prefix": "api",
                                    "isAjax": false,
                                    "paging": {
                                        "categories": {
                                            "finder": "all",
                                            "page": 1,
                                            "current": 3,
                                            "count": 3,
                                            "perPage": 3,
                                            "prevPage": false,
                                            "nextPage": false,
                                            "pageCount": 1,
                                            "sort": null,
                                            "direction": false,
                                            "limit": null,
                                            "sortDefault": false,
                                            "directionDefault": false
                                        }
                                    }
                                },
                                "data": [],
                                "query": {
                                    "page": "2"
                                },
                                "cookies": [],
                                "url": "api/categories.json",
                                "base": "/bot/viglink/cakeviglink",
                                "webroot": "/bot/viglink/cakeviglink/",
                                "here": "/bot/viglink/cakeviglink/api/categories.json",
                                "trustProxy": false
                            },
                            "components": []
                        },
                        "Flash": {
                            "request": {
                                "params": {
                                    "plugin": null,
                                    "controller": "Categories",
                                    "action": "index",
                                    "_ext": "json",
                                    "pass": [],
                                    "_method": "GET",
                                    "prefix": "api",
                                    "isAjax": false,
                                    "paging": {
                                        "categories": {
                                            "finder": "all",
                                            "page": 1,
                                            "current": 3,
                                            "count": 3,
                                            "perPage": 3,
                                            "prevPage": false,
                                            "nextPage": false,
                                            "pageCount": 1,
                                            "sort": null,
                                            "direction": false,
                                            "limit": null,
                                            "sortDefault": false,
                                            "directionDefault": false
                                        }
                                    }
                                },
                                "data": [],
                                "query": {
                                    "page": "2"
                                },
                                "cookies": [],
                                "url": "api/categories.json",
                                "base": "/bot/viglink/cakeviglink",
                                "webroot": "/bot/viglink/cakeviglink/",
                                "here": "/bot/viglink/cakeviglink/api/categories.json",
                                "trustProxy": false
                            },
                            "response": {},
                            "components": []
                        },
                        "Categories": {},
                        "Paginator": {
                            "request": {
                                "params": {
                                    "plugin": null,
                                    "controller": "Categories",
                                    "action": "index",
                                    "_ext": "json",
                                    "pass": [],
                                    "_method": "GET",
                                    "prefix": "api",
                                    "isAjax": false,
                                    "paging": {
                                        "categories": {
                                            "finder": "all",
                                            "page": 1,
                                            "current": 3,
                                            "count": 3,
                                            "perPage": 3,
                                            "prevPage": false,
                                            "nextPage": false,
                                            "pageCount": 1,
                                            "sort": null,
                                            "direction": false,
                                            "limit": null,
                                            "sortDefault": false,
                                            "directionDefault": false
                                        }
                                    }
                                },
                                "data": [],
                                "query": {
                                    "page": "2"
                                },
                                "cookies": [],
                                "url": "api/categories.json",
                                "base": "/bot/viglink/cakeviglink",
                                "webroot": "/bot/viglink/cakeviglink/",
                                "here": "/bot/viglink/cakeviglink/api/categories.json",
                                "trustProxy": false
                            },
                            "response": {},
                            "components": []
                        }
                    },
                    "index"
                ],
                []
            ]
        },
        {
            "file": "/var/www/html/bot/viglink/cakeviglink/vendor/cakephp/cakephp/src/Routing/Dispatcher.php",
            "line": 114,
            "function": "invokeAction",
            "class": "Cake\\Controller\\Controller",
            "type": "->",
            "args": []
        },
        {
            "file": "/var/www/html/bot/viglink/cakeviglink/vendor/cakephp/cakephp/src/Routing/Dispatcher.php",
            "line": 87,
            "function": "_invoke",
            "class": "Cake\\Routing\\Dispatcher",
            "type": "->",
            "args": [
                {
                    "components": {
                        "RequestHandler": null
                    },
                    "name": "Categories",
                    "helpers": [],
                    "request": {
                        "params": {
                            "plugin": null,
                            "controller": "Categories",
                            "action": "index",
                            "_ext": "json",
                            "pass": [],
                            "_method": "GET",
                            "prefix": "api",
                            "isAjax": false,
                            "paging": {
                                "categories": {
                                    "finder": "all",
                                    "page": 1,
                                    "current": 3,
                                    "count": 3,
                                    "perPage": 3,
                                    "prevPage": false,
                                    "nextPage": false,
                                    "pageCount": 1,
                                    "sort": null,
                                    "direction": false,
                                    "limit": null,
                                    "sortDefault": false,
                                    "directionDefault": false
                                }
                            }
                        },
                        "data": [],
                        "query": {
                            "page": "2"
                        },
                        "cookies": [],
                        "url": "api/categories.json",
                        "base": "/bot/viglink/cakeviglink",
                        "webroot": "/bot/viglink/cakeviglink/",
                        "here": "/bot/viglink/cakeviglink/api/categories.json",
                        "trustProxy": false
                    },
                    "response": {},
                    "paginate": {
                        "limit": 3
                    },
                    "autoRender": true,
                    "View": null,
                    "plugin": null,
                    "passedArgs": [],
                    "modelClass": "Categories",
                    "viewClass": null,
                    "viewVars": [],
                    "RequestHandler": {
                        "enabled": true,
                        "response": {},
                        "ext": "json",
                        "request": {
                            "params": {
                                "plugin": null,
                                "controller": "Categories",
                                "action": "index",
                                "_ext": "json",
                                "pass": [],
                                "_method": "GET",
                                "prefix": "api",
                                "isAjax": false,
                                "paging": {
                                    "categories": {
                                        "finder": "all",
                                        "page": 1,
                                        "current": 3,
                                        "count": 3,
                                        "perPage": 3,
                                        "prevPage": false,
                                        "nextPage": false,
                                        "pageCount": 1,
                                        "sort": null,
                                        "direction": false,
                                        "limit": null,
                                        "sortDefault": false,
                                        "directionDefault": false
                                    }
                                }
                            },
                            "data": [],
                            "query": {
                                "page": "2"
                            },
                            "cookies": [],
                            "url": "api/categories.json",
                            "base": "/bot/viglink/cakeviglink",
                            "webroot": "/bot/viglink/cakeviglink/",
                            "here": "/bot/viglink/cakeviglink/api/categories.json",
                            "trustProxy": false
                        },
                        "components": []
                    },
                    "Flash": {
                        "request": {
                            "params": {
                                "plugin": null,
                                "controller": "Categories",
                                "action": "index",
                                "_ext": "json",
                                "pass": [],
                                "_method": "GET",
                                "prefix": "api",
                                "isAjax": false,
                                "paging": {
                                    "categories": {
                                        "finder": "all",
                                        "page": 1,
                                        "current": 3,
                                        "count": 3,
                                        "perPage": 3,
                                        "prevPage": false,
                                        "nextPage": false,
                                        "pageCount": 1,
                                        "sort": null,
                                        "direction": false,
                                        "limit": null,
                                        "sortDefault": false,
                                        "directionDefault": false
                                    }
                                }
                            },
                            "data": [],
                            "query": {
                                "page": "2"
                            },
                            "cookies": [],
                            "url": "api/categories.json",
                            "base": "/bot/viglink/cakeviglink",
                            "webroot": "/bot/viglink/cakeviglink/",
                            "here": "/bot/viglink/cakeviglink/api/categories.json",
                            "trustProxy": false
                        },
                        "response": {},
                        "components": []
                    },
                    "Categories": {},
                    "Paginator": {
                        "request": {
                            "params": {
                                "plugin": null,
                                "controller": "Categories",
                                "action": "index",
                                "_ext": "json",
                                "pass": [],
                                "_method": "GET",
                                "prefix": "api",
                                "isAjax": false,
                                "paging": {
                                    "categories": {
                                        "finder": "all",
                                        "page": 1,
                                        "current": 3,
                                        "count": 3,
                                        "perPage": 3,
                                        "prevPage": false,
                                        "nextPage": false,
                                        "pageCount": 1,
                                        "sort": null,
                                        "direction": false,
                                        "limit": null,
                                        "sortDefault": false,
                                        "directionDefault": false
                                    }
                                }
                            },
                            "data": [],
                            "query": {
                                "page": "2"
                            },
                            "cookies": [],
                            "url": "api/categories.json",
                            "base": "/bot/viglink/cakeviglink",
                            "webroot": "/bot/viglink/cakeviglink/",
                            "here": "/bot/viglink/cakeviglink/api/categories.json",
                            "trustProxy": false
                        },
                        "response": {},
                        "components": []
                    }
                }
            ]
        },
        {
            "file": "/var/www/html/bot/viglink/cakeviglink/webroot/index.php",
            "line": 37,
            "function": "dispatch",
            "class": "Cake\\Routing\\Dispatcher",
            "type": "->",
            "args": [
                {
                    "params": {
                        "plugin": null,
                        "controller": "Categories",
                        "action": "index",
                        "_ext": "json",
                        "pass": [],
                        "_method": "GET",
                        "prefix": "api",
                        "isAjax": false,
                        "paging": {
                            "categories": {
                                "finder": "all",
                                "page": 1,
                                "current": 3,
                                "count": 3,
                                "perPage": 3,
                                "prevPage": false,
                                "nextPage": false,
                                "pageCount": 1,
                                "sort": null,
                                "direction": false,
                                "limit": null,
                                "sortDefault": false,
                                "directionDefault": false
                            }
                        }
                    },
                    "data": [],
                    "query": {
                        "page": "2"
                    },
                    "cookies": [],
                    "url": "api/categories.json",
                    "base": "/bot/viglink/cakeviglink",
                    "webroot": "/bot/viglink/cakeviglink/",
                    "here": "/bot/viglink/cakeviglink/api/categories.json",
                    "trustProxy": false
                },
                {}
            ]
        }
    ]
}

@markstory
Copy link
Member

I guess my next dumb question is are there more than 1 page of results in elastic search?

@gieart87
Copy link
Author

Yes mark, I have 29 records and set limit just 3 rows. I attached a screenshot that show this elastic-search work fine when access without params (first page result).
categories_oke
categories

@markstory
Copy link
Member

Ok. I'll take a look and try to reproduce locally.

@markstory markstory self-assigned this Feb 25, 2016
@markstory markstory added the bug label Feb 25, 2016
@gieart87
Copy link
Author

gieart87 commented May 6, 2016

haven't any update yet, @markstory ?

@markstory
Copy link
Member

@gieart87 No, I've not had a chance to look at this yet.

@markstory markstory modified the milestones: 1.0.0, 2.0.x Apr 21, 2018
@markstory markstory removed their assignment Jun 2, 2018
@github-actions
Copy link

github-actions bot commented Jan 8, 2020

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants