Filtering and Sorting Data
When working with APIs that return large volumes of data, effectively managing and refining the results is essential. The Filtering and Sorting Data features allow you to narrow down your search and organize the results according to specific criteria, making it easier to find and utilize relevant information.
Filtering Data
Filtering enables you to retrieve a subset of data based on specific conditions or criteria. This helps in isolating relevant records from a larger dataset by applying various filters. The API supports a range of filtering options to cater to different needs:
- Basic Filters: Apply simple criteria to match exact values or specific conditions. For example, you can filter results to include only those with a certain keyword or status.
- Range Filters: Specify a range of values to filter results within certain limits. This can be useful for date ranges, numerical ranges, or other continuous data.
- Custom Filters: For more advanced needs, you can use custom filtering parameters to build complex queries that combine multiple conditions and logical operators.
Sorting Data
Sorting allows you to arrange the results in a specific order based on one or more fields. This is essential for presenting data in a meaningful sequence, whether alphabetically, numerically, or by date. The API supports sorting in various ways:
- Ascending/Descending Order: Specify the order in which the results should be sorted. Common sorting options include alphabetical order (A-Z), reverse alphabetical order (Z-A), ascending numerical order, or descending numerical order.
- Multiple Sort Fields: You can sort results by multiple fields to achieve more granular control over the order. For example, you might first sort by date and then by relevance.
- Default Sorting: If no sorting parameters are provided, the API will use default sorting criteria to ensure consistent and predictable results.**
"Display" Constraints
Certain constraints are specific to particular APIs and do not apply universally. These are represented as follows:
- M: metadata API
- M2: meta/v2 API
- O: openaccess API
- F: Full Text API
At present, only one type of "display" constraint is supported.
Constraint | Description | Applies to collection | Basic Plan* | Premium Plan* |
---|---|---|---|---|
sort:date | Sorts results by publication date in reverse chronological order {date} | M,M2,F | ||
sort:sequence | Sorts results by Article Sequence number in chronological order | M,M2,F | ||
sort:relevance | Sort results by most relevant one, i.e., with the articles/chapters that are most closely related to the search | M,M2,F |