Find judgments across sources¶
Use Judgments for a common result shape across archive metadata and live judgment search. It chooses a source from the query; it does not merge both sources for every request.
Search with structured filters¶
Install bharat-judgements[archive] for this complete example:
import asyncio
from bharat_judgements import Judgments
async def main():
async with Judgments() as judgments:
records = await judgments.find(court="delhi", year=2020, party="tata", limit=10)
for record in records:
print(record.cnr, record.decision_date, record.title, record.source)
asyncio.run(main())
This is a title match in the High Court archive, not a search of PDF text. For Supreme Court archive records, party also searches petitioner and respondent fields. Judge matching is a case-insensitive substring; year ranges are inclusive.
Routing rules¶
| Automatic query | Backend | Important limit |
|---|---|---|
cnr supplied | Archive | Prefix identifies the court where recognised; no live case-history lookup |
text alone | Live | Default High Court full-text search, first page only |
| Structured filters | Archive | Requires the archive extra |
text and structured filters | Archive | party takes precedence; otherwise text matches party/title metadata |
| No filters | ValueError | Supply text, CNR or a structured filter |
The structured filters are court, year, judge, party and citation. citation works for SCI archive records; it is ignored for High Court archive records. If you omit a court, archive search can query SCI and High Courts, splitting its result budget between sources rather than returning a globally exhaustive search.
Override a source deliberately¶
source="archive" uses archive metadata. source="live" requires non-empty text; it does not apply court, year, judge, party, citation or CNR filters. Do not pass those filters expecting them to constrain a forced live query.
Live facade queries request at most 25 rows from one page even if limit is larger. Use the direct judgment search client for page iteration or SCR search. Automatic mode does not fall back to another source when a query is empty or fails.
Read the returned record¶
Each record is a Judgment. source identifies archive or live; dates, citations and court information depend on the source and may be absent. to_dict(exclude_none=True) gives serialisable metadata, with date values converted to strings.
The live_to_judgment helper maps a JudgmentResult to this common type. It does not retain the original session data needed to resolve a live PDF.
Retrieve a PDF¶
Call fetch_pdf(record) for an archive result. A CNR string can also be resolved through the archive. language selects a supported SCI rendering; the archive's HC PDFs use their stored path.
A live Judgment raises NotImplementedError here. Download using the original JudgmentResult and JudgmentSearchClient.download_pdf within the live client's session. See the worked live download.
The first SCI PDF for a year can require a whole tar download. Read archive storage before fetching many years.
Failure handling¶
ValueError: no usable query, or a forced live request without text.ImportError: a query routed to archive without the archive dependencies.- CAPTCHA, transport or portal errors: surface the failed source; do not report them as an empty result set.
- Empty list: the chosen source returned no matching records within this query. Try another supported lookup explicitly.
Next: facade API, archive research, or live case records.