Date Range Filter Guide
The search_after_date_filter
and search_before_date_filter
parameters allow you to restrict search results to a specific publication date range. Only results with publication dates falling between these dates will be returned.
Dates must be provided in the “%m/%d/%Y” format (e.g., “3/1/2025”). These filters are optional—you may supply either one or both as needed.
Overview
The search_after_date_filter
and search_before_date_filter
parameters control which search results are returned by limiting them to a specific publication date range. This feature is useful when you need to:
• Narrow down search results to a particular time period
• Exclude outdated or overly recent content
• Improve relevance by focusing on content published within a defined window
To constrain search results by publication date, include the following fields in your request payload:
These filters will be applied in addition to any other search parameters (for example, domain filters).
Examples
1. Limiting Results to a Specific Date Range
This example limits search results to content published between March 1, 2025, and March 5, 2025.
Request Example
2. Filtering with a Single Date Parameter
If you only wish to restrict the results to those published on or after a specific date, include just the search_after_date_filter
:
Best Practices
Date Format • Strict Format: Dates must match the “%m/%d/%Y” format exactly. For example, the date “3/1/2025” or “03/01/2025” is acceptable. • Consistency: Use one or both filters consistently based on your search needs. Combining both provides a clear range.
Client-Side Validation • Regex Check: Validate date strings on the client side (or via the API) using a regex such as:
This ensures that dates conform to the required format before sending the request.
Performance Considerations • Narrowing the Search: Applying date range filters typically reduces the number of results, which may improve response times and result relevance. • Avoid Over-Restriction: Ensure that the date range is neither too narrow (limiting useful results) nor too broad (defeating the purpose of the filter).
⸻