Skip to content

Add pagination functionality to search-content command #125

@Gil-Frenkel

Description

@Gil-Frenkel

Is your feature request related to a problem? Please describe.

The output might be really huge when running the search-content command with the --no-interactive flag (with or without --format json).

Describe the solution you'd like

Pagination functionality with default --page_size of 25, and capping of page_size at 100 (i.e., user can set --page_size of 100 - so 100 results per page at most), with a metadata.

the idea behind it is to have a clear results rendering experience, and also to make this CLI useful for AI agents, so it will be feasible to send the search results to their LLMs as context (same as working with a SQL DB agent that is able to results from SQL queries..)

For example:

1 If running with --no-interactive --format json --page-size 50 - I'd expected something like this fields added to the json output:

{
  "page": 1,
  "page_size": 50,
  "total_results": 2934,
  "returned_results": 50,
  "has_more": true,
  "next_page": 15,
  "results": [...]
}

With the "results" key holds the current state output from the CLI. e.g.:

[{"file":"founded_this_note.md","line":8,"content":"search term is in this file", "match_type":"content"}]
  1. If running with interactivity - I'd expect additional button for forward / backward pagination.

Describe alternatives you've considered

None that I can think of.

Additional context

No additional context.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions