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

ESContentletResourcePortlet returns only live contentlets #15982

Closed
nollymar opened this issue Feb 6, 2019 · 4 comments

Comments

@nollymar
Copy link
Contributor

commented Feb 6, 2019

This endpoint /api/es/search is filtering only live contentlets, working ones are not returned

@nollymar nollymar added this to the Rex Current milestone Feb 6, 2019

@nollymar nollymar self-assigned this Feb 6, 2019

@wezell

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2019

  • we need to pass in PAGE_MODE as a query param
  • PageMode.LIVE is the default and a user must be logged in to be able to set PAGE_MODE to anything other than live

nollymar added a commit that referenced this issue Feb 7, 2019

@nollymar

This comment has been minimized.

Copy link
Contributor Author

commented Feb 7, 2019

PR: #15997

With these changes, the endpoint supports live query param, which can take 3 values:

  • true: returns live contentlets
  • false: returns working contentlets
  • null: returns working contentlets

Note: For the anonymous user, always returns live contentlets, ignoring the live param

Please @john-thomas-dotcms @DeanGonzalez update this doc: https://dotcms.com/docs/latest/elasticsearch-rest-api

@nollymar nollymar removed their assignment Feb 7, 2019

nollymar added a commit that referenced this issue Feb 8, 2019

dsilvam added a commit that referenced this issue Feb 8, 2019

Issue 15982 es contentlet resource portlet returns only live contentl…
…ets (#15997)

* #15982 Adding new param to support working contentlets

* #15982 #15170 Getting working contentlets on relationship box

* #15982 Setting boolean live param default false

@erickgonzalez erickgonzalez self-assigned this Feb 13, 2019

@erickgonzalez

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

Test:
Create a couple of new contentlets of Content Generic, but only save and publish one of them.

Curl as Anonymous User:
For each of the curl's as anonymous user, returns live contentlets (in this case 1 contentlet).

    curl -H "Content-Type: application/json" -XPOST http://localhost:8080/api/es/search -d '
   {
        "query": {
            "bool": {
                "must": {
                    "term": {
                        "contentType": "webPageContent"
                    }
                }
            }
        },
        "size":  2,
        "sort": {
            "modDate": "desc"
        }
    }
    '

     curl -H "Content-Type: application/json" -XPOST http://localhost:8080/api/es/search?live=true -d '
   {
        "query": {
            "bool": {
                "must": {
                    "term": {
                        "contentType": "webPageContent"
                    }
                }
            }
        },
        "size":  2,
        "sort": {
            "modDate": "desc"
        }
    }
    '

    curl -H "Content-Type: application/json" -XPOST http://localhost:8080/api/es/search?live=false -d '
   {
        "query": {
            "bool": {
                "must": {
                    "term": {
                        "contentType": "webPageContent"
                    }
                }
            }
        },
        "size":  2,
        "sort": {
            "modDate": "desc"
        }
    }
    '

Curl with an User:
If the live param is false or not set, returns working contentlets (in this case 2 contentlets).

    curl -u admin@dotcms.com:admin -H "Content-Type: application/json" -XPOST http://localhost:8080/api/es/search?live=false -d '
   {
        "query": {
            "bool": {
                "must": {
                    "term": {
                        "contentType": "webPageContent"
                    }
                }
            }
        },
        "size":  2,
        "sort": {
            "modDate": "desc"
        }
    }
    '

    curl -u admin@dotcms.com:admin -H "Content-Type: application/json" -XPOST http://localhost:8080/api/es/search -d '
   {
        "query": {
            "bool": {
                "must": {
                    "term": {
                        "contentType": "webPageContent"
                    }
                }
            }
        },
        "size":  2,
        "sort": {
            "modDate": "desc"
        }
    }
    '

If the live param is true, returns live contentlets (in this case 1 contentlet).

    curl -u admin@dotcms.com:admin -H "Content-Type: application/json" -XPOST http://localhost:8080/api/es/search?live=true -d '
   {
        "query": {
            "bool": {
                "must": {
                    "term": {
                        "contentType": "webPageContent"
                    }
                }
            }
        },
        "size":  2,
        "sort": {
            "modDate": "desc"
        }
    }
    '

@erickgonzalez erickgonzalez removed their assignment Feb 13, 2019

@bryanboza bryanboza added this to CODY in QA Feb 13, 2019

@bryanboza bryanboza moved this from CODY to REX in QA Feb 13, 2019

@bryanboza

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

Fixed, tested based on the last comment and works as expected

@bryanboza bryanboza moved this from REX to Done in QA Feb 13, 2019

@wezell wezell closed this Feb 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.