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

Facet statistics pagination #428

Open
lukashornych opened this issue Jan 19, 2024 · 0 comments
Open

Facet statistics pagination #428

lukashornych opened this issue Jan 19, 2024 · 0 comments
Assignees
Milestone

Comments

@lukashornych
Copy link
Collaborator

We want to support pagination of individual facet statistics within group of facet summary. Currently, all facet statistics within a group are returned every time. The problem is there may be tens or hundreds of facets within a single group and typically we want to render only e.g. first 10 facets in a side menu on frontend.
However, we don't want to make the returned facet statistics array more complex by wrapping it into a PaginatedList or something because that would make the API difficult to work with when there is multiple different groups and types of facet summary. And sometimes we don't care about the pagination in this area at all.

That why we've come up with following syntax in GraphQL:
Each facet group would provide total facet count as facetCount next to the actual facetStatistics field, and the facetStatstics field would have option to define pagination within require constraint container (we don't want to provide paging arguments directly in the field, because we want to support both page and strip, which would result in confusing parameters). However in GraphQL, we could alias the require parameter to something like pagination to not give a false idea that a developer can put more constraints inside (in Java there could be maybe interface for it?).

{   
  queryProduct { 
    extraResults {
      facetSummary {
        groups {    
          facetCount # total facet count within returned group, ignoring pagination of facets, replacing the need for entire DataChunk structure
          facetStatistics(
            require: { # standard require constraint container limited to page and strip constraints
              page: { number: 1, size: 10 }
              # or
              strip: { limit: 10, offset: 0 }
            }
          ) {
            facetEntity {
              attributes {
                name
                url
                description
              }
            }
          }
        }
      }
    }
  }
}
@novoj novoj added this to the Alpha milestone Jan 19, 2024
@novoj novoj modified the milestones: Alpha, Beta Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants