Skip to content

feat: search takes a query object and --cursor (1.8.0) - #14

Merged
datalegion-jack merged 2 commits into
mainfrom
feat/search-query-object
Nov 9, 2026
Merged

datalegion-jack merged 2 commits into
mainfrom
feat/search-query-object

Conversation

@datalegion-jack

Copy link
Copy Markdown
Contributor

What

  • person search and company search accept a JSON query object as the query argument (anything starting with {); SQL works as before. Invalid JSON is a usage error.
  • A new --cursor option takes the previous page's next_cursor for deep paging.
  • The README gains an example of each.
  • Version 1.8.0.

Tests

  • A JSON query goes as an object with the cursor; malformed JSON is refused; SQL stays a string.
  • The full suite passes, including the live tests against the API.

🤖 Generated with Claude Code

datalegion-jack and others added 2 commits November 8, 2026 17:15
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@datalegion-jack
datalegion-jack requested a review from a team as a code owner November 9, 2026 05:08
@datalegion-jack

Copy link
Copy Markdown
Contributor Author

Review round 1 (head 0f06ffe)

Verdict: approve.

Findings

None blocking.

Checked and fine

  • search_query (src/datalegion_cli/commands/__init__.py:18) sends SQL as a string and anything starting with { as a parsed object. Malformed JSON exits 2 with a clear message. --cursor is wired into both person search and company search. The client's _strip drops cursor when it isn't set.
  • The CLI has no --offset, so it can never send cursor together with offset, which the API refuses. All other keys are ones the API accepts.
  • Live at this head: company search '{"exists": {"field": "domain"}}' --limit 2 --fields legion_id returned 2 matches and a next_cursor. Passing it back with --cursor returned page 2. next_cursor is in the JSON output, so agents can chain pages.
  • The tests check the real payload for both entities (a parsed query plus cursor) and that the output carries next_cursor. tests/test_commands.py passes (43 tests).
  • The version is 1.8.0 in both pyproject.toml and uv.lock.
  • CI: CodeQL, lint, actionlint and the test jobs have all passed.

@datalegion-jack

Copy link
Copy Markdown
Contributor Author

Review round 2 (head 0f06ffe)

Verdict: approve. No findings. The head is unchanged since round 1, and I re-checked it from a fresh clone:

  • Full test suite: 165 passed, 10 skipped (the skips are the live tests, which need a key).
  • Live: person search '{"term": {"company_name": "acme"}}' --limit 2 --fields legion_id returned 2 matches with next_cursor in the output. Round 1 already showed paging by --cursor working live for company search.
  • A malformed JSON query ('{"term": ') is refused with "The query looks like JSON but doesn't parse", before any request is sent.
  • CI is green on every job.

@datalegion-jack
datalegion-jack merged commit 1eecf8e into main Nov 9, 2026
11 checks passed
@datalegion-jack
datalegion-jack deleted the feat/search-query-object branch November 9, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant