Search opinions
Search for opinions using semantic (vector), keyword (full-text), or hybrid search.
Search Modes:
semantic- Vector similarity search using AI embeddings. Best for conceptual queries like "cases about breach of fiduciary duty". Returns results ranked by semantic similarity.keyword- Traditional full-text search using Elasticsearch. Supports Lexis/Westlaw-style boolean operators. Best for exact phrase matching and known terms. Returns results ranked by BM25 relevance.hybrid- Combines semantic and keyword search using reciprocal rank fusion (RRF) with deduplication. Best for comprehensive search coverage.
Boolean Operators (keyword mode only):
AND- Both terms must appear (e.g.,negligence AND damages)OR- Either term may appear (e.g.,breach OR default)NOT- Exclude term (e.g.,contract NOT employment)"..."- Exact phrase (e.g.,"summary judgment")*- Wildcard for any characters (e.g.,negligen*)?- Single character wildcard (e.g.,wom?n)W/n- Proximity search within n words (e.g.,negligence W/5 damages)()- Grouping (e.g.,(contract OR agreement) AND breach)
Note: Boolean operators must be UPPERCASE. They only work in keyword mode.
Pagination:
- Use
page(1-indexed) andpage_sizefor pagination - Maximum
page_sizeis 100 - Semantic search has limited deep pagination (~500 unique results max)
- Keyword and hybrid support deep pagination via Elasticsearch
Body·SearchRequest
required
application/json
- Type: stringqueryrequired
Search query text
- Type: object · SearchFiltersfilters
Optional filters to narrow search results
- Type: booleaninclude
_facets Include facet breakdowns in the response showing result counts by court, jurisdiction, state, and year. Defaults to
false. Set totrueto enable.Note: Facets are only available in
keywordandhybridmodes (notsemantic). Inhybridmode, facet counts reflect keyword search results only; semantic results are not included. - Type: stringenummode
Search mode:
semantic- Vector similarity search (default)keyword- Full-text searchhybrid- Combined semantic and keyword results using reciprocal rank fusion (RRF)
values- semantic
- keyword
- hybrid
- Type: integerpagemin:1
Page number (1-indexed)
- Type: integerpage
_size min:1max:100Results per page (max 100)
Responses
- application/json
- application/json
- application/json
Request Example for post/search
curl http://app.midpage.ai/api/v1/search \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '{
"query": "breach of fiduciary duty",
"mode": "semantic",
"page": 1,
"page_size": 10
}'
{
"results": [
{
"opinion_id": "8515707",
"score": 0.721916258,
"case_name": "Myer v. Preferred Credit, Inc.",
"court_id": "ohctcomplharris",
"court_name": "Harrison County Court of Common Pleas",
"jurisdiction": "State Trial",
"state": "Arizona",
"date_filed": null,
"snippet": "As such, it is a successor-in-interest, and may be liable on the claims herein...",
"source": "semantic"
}
],
"pagination": {
"page": 1,
"page_size": 1,
"total_results": 3,
"total_pages": 3,
"has_next": true,
"has_prev": false
},
"metadata": {
"mode": "semantic",
"query": "breach of fiduciary duty",
"processing_time_ms": 182
}
}