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

Resolve Issue : Search REST API returns wrong total_count #21713

Merged
merged 3 commits into from
Mar 16, 2019
Merged

Resolve Issue : Search REST API returns wrong total_count #21713

merged 3 commits into from
Mar 16, 2019

Conversation

ronak2ram
Copy link
Member

Continue Pull: #20253

Description (*)

I added function for getting total_count of result item.

Fixed Issues (if relevant)

  1. Search REST API returns wrong total_count #17295: Search REST API returns wrong total_count

Manual testing scenarios (*)

Request :

rest/V1/search?searchCriteria[requestName]=quick_search_container&searchCriteria[filterGroups][0][filters][0][field]=search_term&searchCriteria[filterGroups][0][filters][0][conditionType]=like&searchCriteria[filterGroups][0][filters][0][value]=test&searchCriteria[current_page]=1&searchCriteria[page_size]=2

Response :

{
    "items": [
        {
            "id": 126,
            "custom_attributes": [
                {
                    "attribute_code": "score",
                    "value": "73.7660923004150400"
                }
            ]
        },
        {
            "id": 61,
            "custom_attributes": [
                {
                    "attribute_code": "score",
                    "value": "73.7660923004150400"
                }
            ]
        }
    ],
    "aggregations": {
        "buckets": [
            {
                "name": "category_bucket",
                "values": [
                    {
                        "value": "32",
                        "metrics": [
                            "32",
                            "1"
                        ]
                    }
                ]
            },
            {
                "name": "stock_status_bucket",
                "values": []
            },
            {
                "name": "rating_summary_bucket",
                "values": []
            },
            {
                "name": "am_is_new_bucket",
                "values": []
            },
            {
                "name": "am_on_sale_bucket",
                "values": []
            },
            {
                "name": "color_bucket",
                "values": []
            },
            {
                "name": "sub_category_bucket",
                "values": []
            }
        ],
        "bucket_names": [
            "category_bucket",
            "stock_status_bucket",
            "rating_summary_bucket",
            "am_is_new_bucket",
            "am_on_sale_bucket",
            "color_bucket",
            "sub_category_bucket"
        ]
    },
    "search_criteria": {
        "request_name": "quick_search_container",
        "filter_groups": [
            {
                "filters": [
                    {
                        "field": "search_term",
                        "value": "test",
                        "condition_type": "like"
                    }
                ]
            }
        ],
        "page_size": 2,
        "current_page": 1
    },
    "total_count": 9
}

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @ronak2ram. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team
Copy link
Contributor

Hi @sivaschenko, thank you for the review.
ENGCOM-4481 has been created to process this Pull Request

@soleksii
Copy link

✔️ QA Passed

Result:

{
"items":[
{
"id": 4,
"custom_attributes":[
{"attribute_code": "score", "value": "8.6994295120239260"}
]
},
{
"id": 3,
"custom_attributes":[
{"attribute_code": "score", "value": "8.6994295120239260"}
]
}
],
"aggregations":{
"buckets":[
{
"name": "category_bucket",
"values":[{"value": "3", "metrics":["3", "2" ] }]
}
],
"bucket_names":[
"category_bucket"
]
},
"search_criteria":{
"request_name": "quick_search_container",
"filter_groups":[
{
"filters":[{"field": "search_term", "value": "test", "condition_type": "like"…]
}
],
"page_size": 2,
"current_page": 1
},
"total_count": 6
}

@ghost
Copy link

ghost commented Mar 16, 2019

Hi @ronak2ram, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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

Successfully merging this pull request may close these issues.

5 participants