Extra module 5 - Advanced Querying

A more robust mechanism to find entities.

Another aspect that could be improved is querying. It would be interesting if, when searching for products, for example, we could have a more robust pagination structure, also including a metadata field with useful data, such as the total item count.

In addition, we could also allow for filtering and sorting the results. With this improvement, we would be able to search only for products that contain a specific text fragment in their name or description, and sort them alphabetically or by price, for example.

When querying entities, these three steps occur in the following order:

  • Filtering - From the set of all the records, criteria are used to only grab a subset of them

  • Sorting - The elements of this subset are then arranged in some way, like alphabetically

  • Pagination - Finally, only some elements are retrieved at once in order to avoid a bottleneck

In this chapter, the focus will be on the aforementioned topics, implementing ways to refine the searching process and have an overall more robust querying.

Last updated