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

Some finessing from QA - item filters and undefined sorting #406

Merged
merged 4 commits into from
Sep 16, 2024

Conversation

charmingduchess
Copy link
Contributor

  • refactored sort method to actually work
  • added check make sure inner_hits query still happen when item filters are applied

done()
})
})
it('reverts to filtering on inner_hits when item filters are included in the query and returns default item size', (done) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not actually a documented requirement, but I think item filters should override all_items until we have the work done in discovery api to filter and return more than items_size number of items

}
return a[property]?.[0] > b[property]?.[0] ? -1 : 1
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great reusability

const itemFilterQuery = queryKeys
.filter((param) => param.startsWith('item_')).length > 0
const returnAllItems = queryKeys?.includes('all_items') &&
!itemFilterQuery
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but I kind of think use of ?all_items with any item filter should return a 4xx earlier, since it's nonsensical. That would mean we don't have to handle that possibility here. As written, it looks like we'll just ignore all_items if any item filter is applied. But above is also fine.

Copy link
Contributor Author

@charmingduchess charmingduchess Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes there was a decision made around this that I forgot to explain. The front end spec is that a user can filter items, and then click view all to de-paginate the results. We decided to expedite the release of this endpoint by letting the front end decide whether to use all_items or to revert to the already implemented batched filtering solution. Eventually, we actually do want to have some combination of params that will return all of a bib's items for a given filter.

@charmingduchess charmingduchess merged commit 379a051 into main Sep 16, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants