Skip to main content
POST
Find lines

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

database
string
required

Target database.

Body

application/json

POST /v1/find/{database}: the lines of an indexed text column that contain a literal. An unknown field is refused.

field_name
string
required

The full-text-indexed column searched.

literal
string
required

The text to find, as a substring of one line of field_name. It must hold at least one letter or digit and no newline, and it is found only where it starts and ends at word boundaries of the column's text (env::var is found, nv::va is not). The full-text grammar characters (", +, -) are read as punctuation.

table_name
string
required

The table searched.

group_by
string | null

A column other than field_name whose distinct values group the line counts (lines per file when it names the path column). Counted over every matching line of every row, not only the lines returned; the groups with the most lines come first, at most 500 of them, and groups_total says how many there were.

ignore_case
boolean

Match regardless of letter case.

limit
integer | null

Lines returned at most: 500 when omitted, and never more than 500; 0 returns the counts alone. The total is reported whatever the limit.

Required range: x >= 0
line_base
string | null

An integer column holding each row's first line in its source (a chunked file's start_line), for a table whose rows overlap: a line two rows both hold is then counted once, at line_base + line_index, before the total, the groups and the limit. Omitted, every row's lines count.

projection
string[]

Columns returned beside each line, so the caller can place it: a code table asks for path and start_line and adds the line's line_index. Omitted, each line's columns is {} and lines order by line_index alone; name at least one column to place or tell apart lines from different rows. field_name itself is refused: the line is already returned.

rerank
null | object

Rerank the matched lines for a question with the deployment's grading model and return the top k; the total and the group counts still cover every match. Refused with 501 on a deployment that runs no grading model.

Response

The matching lines as JSON: total, truncated, lines (each with the projected columns, {} when none were named, its line_index within the row's text and the line, cut to an excerpt around the literal), groups_total (distinct group_by values among the matches; 0 when none was named) and, when a group_by column was named and lines matched, groups with the line count per value (most lines first, at most 500 groups). At most limit lines (500 by default and at most; 0 for the counts alone); the total and the group counts cover every match.

What a find found.

groups_total
integer
required

Distinct values of the group_by column among the matches, before the group cap; 0 when no column was named.

Required range: x >= 0
lines
object[]
required

The first limit matched lines, ordered by the projected values (numbers numerically), then by where the line sits in its source, then by line_index within the row, then by the line text. So the lines of one source come back in the order they appear in it, and a truncated answer is its first limit lines rather than an arbitrary limit of them.

total
integer
required

Matched lines in all, before the limit.

Required range: x >= 0
truncated
boolean
required

Whether lines holds fewer than total.

groups
object[]

Per-group counts, absent when no group_by column was named or when nothing matched: the groups with the most lines first, then by value, at most the group cap of them.